[PLUG] hey, you really _should_ reboot after repartitioning!

Russell Senior seniorr at aracnet.com
Wed Dec 31 10:00:03 UTC 2003


>>>>> "Daniel" == Daniel Hedlund <daniel at digitree.org> writes:

Daniel> Reason: When partitioning, the partition table gets written
Daniel> back to the hard disk.  Linux then tries to re-read the new
Daniel> partition table back from the hard disk but fails because the
Daniel> hard disk is currently being used.  

I don't see why it should fail to read.  Here's what the manpage for
fdisk says:

  A sync() and a BLKRRPART ioctl() (reread partition table from disk)
  are performed before exiting when the partition table has been
  updated.  Long ago it used to be necessary to reboot after the use
  of fdisk.  I do not think this is the case anymore - indeed,
  rebooting too quickly might cause loss of not-yet-written data. Note
  that both the kernel and the disk hardware may buffer data.

Here's what the manpage for cfdisk has to say:

  If you enter `yes', cfdisk will write the partition table to disk
  and the tell the kernel to re-read the partition table from the
  disk.  The re-reading of the partition table works is most cases,
  but I have seen it fail.  Don't panic.  It will be correct after you
  reboot the system.  In all cases, I still recommend rebooting the
  system--just to be safe.

Hmm.  I am guessing here that it isn't that it can't _read_ the data,
it's that it can't update the kernel data structure because it is in
use when a partition is mounted.  See blkdev_reread_part() in the kernel's
drivers/block/ioctl.c.  Not quite sure what bd_sem is protecting, but
it seems likely to be involved.

-- 
Russell Senior         ``I have nine fingers; you have ten.''
seniorr at aracnet.com




More information about the PLUG mailing list