GEOM issue -- making changes to slices/partitions on used disk

John Fox jjf at mind.net
Tue Jun 20 16:38:48 UTC 2006


This happened on a FreeBSD 6.0 machine.

Installed a SCSI drive on the machine -- drive had been used
for testing previously and had an ext2 FS on it.  I was able
to use the sysinstall fdisk utility to remove the ext2fs
partition and create a FreeBSD slice that utilized the entire
disk.

Then I loaded up the sysinstall disklabel utility, setup
my partitions and when I went to write my changes, recieved
an error about being unable to mount these new partitions --
said mount point did not exist.

I decided I'd just try it again, so I exited sysinstall and
restarted it.  In the disklabel tool, I added only a swap
partition.  Swap partition was created without a problem.

Exited sysinstall, restarted it to add the other new
partitions.  I could not write anything, however, as
whenever I attempted to do so, I got the error message
"ERROR: Unable to write data to disk da1".

I decided I'd remove the slice and start fresh, however
when I attempted to write this change, I again got an
error message stating that data could not be written.

At this point I did some research, and it seems that the
issue is related to GEOM not allowing alteration of 
MBR/slices/partitions on used devices, and that the solution
is to set sysctl knob kern.geom.debugflags=16 
(Found it on this thread: http://groups.google.com/group/mailing.freebsd.current/browse_thread/thread/e7db21985d1b1cc3/3113b6502c5450ef?lnk=st&q=freebsd+sysinstall+fdisk+ERROR%3A+Unable+to+write+data+to+disk&rnum=4&hl=en#3113b6502c5450ef)

Also on this thread is a word of caution, stating that use
of this sysctl knob has been known to result in dev entries
getting confused and blowing away the wrong partition -- which
would obviously be quite undesirable.

This seems like a rather clunky solution, and the posts in the
cited thread are two years old, so I am wondering if there's
another way to go now, or if the bugs are now worked out and
it's safe to use this sysctl knob.

One more thing to note: the posts in the thread mention 5.x
specifically, but the behavior certainly seems to match that
encountered on my 6.0 box.

Any thoughts or input are quite appreciated!

Thank you,

John
--
jjf at mind.net
John Fox,  Systems Administrator
InfoStructure - http://www.mind.net
Vox: (541)773-5000 / Fax: (541)488-7599


More information about the freebsd-questions mailing list