[parted-devel] Warning message if create partition when a partition is mounted

Karel Zak kzak at redhat.com
Wed Dec 2 16:06:08 UTC 2009


On Wed, Dec 02, 2009 at 03:40:09PM +0100, Petr Uzel wrote:
> On Tue, Oct 20, 2009 at 12:10:30AM +0200, Karel Zak wrote:
> > On Mon, Oct 19, 2009 at 02:29:36PM -0600, Curtis Gedak wrote:
> > >
> > > I assume (and I could be wrong here) that the kernel _can_ re-read the  
> > > partition table because I am able to format and mount the newly created  
> > > partition without a reboot.  This leads me to believe that the return  
> > 
> >  You can't successfully call the BLKRRPAR ioclt if there is any open
> >  (used partition) -- see fs/partitions/check.c in Linux kernel. Try:
> > 
> >    # blockdev --rereadpt /dev/sda
> >    BLKRRPART: Device or resource busy
> > 
> >  but you can use BLKPG_ADD_PARTITION or BLKPG_DEL_PARTITION (it means
> >  explicitly add / remove the partition).
> 
> Yes, but this exactly the functionality that commit
> [1d8f9bece138e4d8e58f7b059b4195aff6f39deb linux-commit: remove the use of the BLKPG ioctl]
> removed from parted.
> 
> >  See libparted/arch/linux.c. It seems that BLKPG ioctls are preferred
> >  method and BLKRRPAR is fallback solution only.
> 
> That's no longer true (due to that commit).

 Oh, it seems my git tree wasn't up to date :-(

> I agree that issuing a warning when modifying partition table on disk
> where some of the partitions are mounted is a good idea, however

 Yes, I agree too.

> exactly as Curtis pointed out, parted lost the ability to e.g. add new
> partition to the end of disk without a reboot, which I consider a
> regression.
>
> Just an idea: perhaps parted could selectively call BLKPG ioctls after
> each operation instead of deleting/adding all partitions at once as

 Hmm.. is it good idea to force system to use your partitions when you
 are still working on the partition table?

 Anyway, Hans' note from the commit 1d8f9bece138e4d8e58f7b059b4195aff6f39deb
 about parted's vs. kernel's view is still valid:

    An even bigger problem IMHO is the use of the BLKPG ioctl instead of
    BLKRRPART at all. What this does is tell the kernel parted's view of
    the partition table and make it use that, instead of telling the
    kernel to reread the partition table.  According to the parted sources
    this is done for the case where the kernel does not know the disklabel
    type. However as soon as the system is rebooted, the system will be
    using the kernel's view.

> before. This could be also done only if there are some partitions
> mounted and thus BLKRRPART is not an option. What do you think?

 From my point of view BLKRRPART-only solution (without BLKPG_* ioctls) 
 is not so bad idea. Don't forget that we have partx(8), addpart(8) or
 delpart(8) for advanced users.

    Karel

-- 
 Karel Zak  <kzak at redhat.com>



More information about the parted-devel mailing list