On Fri, Aug 09, 2013 at 04:54:01PM -0400, Kenneth R Westerback wrote: > On Fri, Aug 09, 2013 at 11:38:16AM +0200, Federico Giannici wrote: > > I don't know how I made it (probably in previous releases of OS), > > but now I have a disk with the following disklabel: > > > > # /dev/rsd2c: > > type: SCSI > > disk: SCSI disk > > label: ST1000DM003-9YN1 > > duid: b0e3fc037df87899 > > flags: > > bytes/sector: 512 > > sectors/track: 63 > > tracks/cylinder: 255 > > sectors/cylinder: 16065 > > cylinders: 121601 > > total sectors: 1953525168 > > boundstart: 64 > > boundend: 1953520065 > > drivedata: 0 > > > > 16 partitions: > > # size offset fstype [fsize bsize cpg] > > a: 1953519936 64 4.2BSD 8192 65536 1 # /bu > > c: 1953525168 0 4.2BSD 2048 16384 1 > > > > > > As you can see the "c" partition is not of type "unused", and some > > commands complain of this. > > > > I wasn't able to change this situation. I tried with "disklabel -E > > sd2", "disklabel -d sd2", "disklabel -R sd2 proto" (with a proper > > "proto" file), but nothing changed. > > > > What is the proper way to handle this? > > Please note that "a" partition contains data that must be preserved > > (I umounted that partition before all disklabel commands). > > > > The system is a 5.3 amd64, and sd2 is a normal SATA disk. > > > > Thanks. > > > > disklabel(8) contains a description of the 'z' command available > in the -E mode. It should kill 'c' dead. Just add 'a' back with the > same parameters it had brfore. > > Not that Nick's solution isn't more fun! > > .... Ken >
Or it could be a nifty snare in the kernel that is accidentally preserving info that should not be preserved. This is probably not the best patch, but it does let me use 'disklabel -e sd2' to set 'c' to 'unused'. .... Ken Index: subr_disk.c =================================================================== RCS file: /cvs/src/sys/kern/subr_disk.c,v retrieving revision 1.150 diff -u -p -r1.150 subr_disk.c --- subr_disk.c 3 Jul 2013 15:21:40 -0000 1.150 +++ subr_disk.c 10 Aug 2013 03:23:26 -0000 @@ -655,6 +674,8 @@ setdisklabel(struct disklabel *olp, stru if (DL_GETPOFFSET(npp) != DL_GETPOFFSET(opp) || DL_GETPSIZE(npp) < DL_GETPSIZE(opp)) return (EBUSY); + if (i == RAW_PART) + continue; /* * Copy internally-set partition information * if new label doesn't include it. XXX