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

Curtis Gedak gedakc at gmail.com
Tue Oct 20 14:52:38 UTC 2009


Karel Zak wrote:
> 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
>
>   
Thank you Karel for this additional information.  It has helped me to 
realize that the change to parted makes sense and is an improvement over 
previous versions.

 From a user interface perspective, I think parted does the right thing 
by presenting a warning to the user after a partition edit has been 
performed on the device.

Currently GParted presents this warning to the user on each and every 
device scan.  This happens when GParted starts up, after a series of 
partition editing actions are applied, and after a user invoked device 
refresh.  From a user interface perspective, I think this is excessive 
notification to the user.  Hence the problem appears to lie with the 
GParted code.

Thank you Jim for persevering until I finally understood the situation.

Sincerely,
Curtis Gedak



More information about the parted-devel mailing list