Bug #1667

disklabel / disklabel64 change needs reboot / disk change

Added by Thomas Nikolajsen about 2 years ago. Updated almost 2 years ago.

Status:New Start date:
Priority:Normal Due date:
Assignee:Alex Hornung % Done:

0%

Category:-
Target version:-

Description

Changing disk label from disklabel to disklabel64 format
or vice versa needs reboot (or disk change, eg natacontrol detach / attach).

This has worked without reboot earlier,
as described in disklabel(8) & disklabel64(8);
problem was introduced with devfs as I remeber.

Problem seems to be that in kernel disklabel survives
erasure of label on device (disklabel -W .. / dd if=/dev/zero of=DISK ..)

-thomas


Related todos

History

Updated by Matthew Dillon about 2 years ago

:Changing disk label from disklabel to disklabel64 format
:or vice versa needs reboot (or disk change, eg natacontrol detach / attach).
:
:This has worked without reboot earlier,
:as described in disklabel(8) & disklabel64(8);
:problem was introduced with devfs as I remeber.
:
:Problem seems to be that in kernel disklabel survives
:erasure of label on device (disklabel -W .. / dd if=/dev/zero of=DISK ..)
:
: -thomas

Devfs is supposed to flag writes to the dos slice and/or label area
and re-probe. There's probably some logic missing.

-Matt

Updated by Alex Hornung about 2 years ago

To fix this, please add the following lines in "case DIOCWLABEL:"
(sys/kern/subr_diskslice.c)
disk_msg_send_sync(DISK_SLICE_REPROBE, dev->si_disk, sp);
devfs_config();
just after line 648:
set_ds_wlabel(ssp, slice, *(int *)data != 0);

I can't do it right now, but I'll be back to work on this and more on the
weekend.

This should solve the disklabel issue at least. Direct writes (e.g. dd) should
be detected properly with the DSF_REPROBE magic. If not, please post some more
info on the disk/slice structure.

Cheers,
Alex Hornung

Updated by Thomas Nikolajsen almost 2 years ago

Patch supplied in prev. message didn't solve problem:
after applying patch disk slice is read-only after 'disklabel -W <slice>',
so dd fails (trying to zero initial part of slice).

Details on disk/slice:
fdisk -i ad4 # install MBR
disklabel64 -rw ad4s2 auto # initially (slice empty) succeeds
disklabel64 -W ad4s2
dd if=/dev/zero of=/dev/ad4s2 bs=512 count=32 # succeedes on master; fails w/
patch (issue1667 Feb. 9th 2010) (read-only)
disklabel32 -rw ad4s2 auto # fails 'disk already has a label of a different
type'
disklabel64 ad4s2 # shows 64-bit label

-thomas

Also available in: Atom PDF