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

Karel Zak kzak at redhat.com
Mon Oct 19 22:10:30 UTC 2009


On Mon, Oct 19, 2009 at 02:29:36PM -0600, Curtis Gedak wrote:
> Jim Meyering wrote:
>> Please explain why you care.
>>
>> As I've said repeatedly, I think it's an advantage to be warned when doing
>> something like that.  That you are pursuing this issue makes me think
>> you must have a compelling use case that requires modifying a partition
>> table while one of its partitions is mounted.  If so, please describe it.
>>   
>
> Good question Jim and I am glad you asked.
>
> The reason I have been following up on this, perhaps incorrectly, is  
> because there is legacy code in GParted that uses the  
> ped_disk_commit_to_os() to determine if a device can have it's partition  
> table re-read by the kernel.  If the function returns a 0, GParted will  
> display a dialog box indicating the list of devices for which this is a  
> problem.
>
> 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).
 
 See libparted/arch/linux.c. It seems that BLKPG ioctls are preferred
 method and BLKRRPAR is fallback solution only.

    Karel

-- 
 Karel Zak  <kzak at redhat.com>



More information about the parted-devel mailing list