Skip to content
  • Mike Fleetwood's avatar
    Prevent online resizing of file systems mounted read-only (#10) · f8512506
    Mike Fleetwood authored and Curtis Gedak's avatar Curtis Gedak committed
    Resizing a file system mounted read-only fails.  Example:
    
        # mkfs.btrfs /dev/sdb1
        # mount -o ro /dev/sdb1 /mnt/1
    
    In GParted try to resize partition sdb1.  The operation fails like this:
    
        Grow /dev/sdb1 from 512.00 MiB to 1.00 GiB                 (ERROR)
        * calibrate /dev/sdb1                                      (SUCCESS)
        * grow partition from 512.00 MiB to 1.00 GiB               (SUCCESS)
        * grow filesystem to fill the partition                    (ERROR)
          * btrfs filesystem resize 1:max '/mnt/1'                 (ERROR)
              Resize '/mnt/1' of '1:max'
              ERROR: unable to resize '/mnt/1': Read-only file system
    
    See GitLab issue for the testing results of attempting to online resize
    all supporting file system while mounted read-only.  No file system
    allows online resizing while mounted read-only, except for reiserfs.
        Issue #10 - Gparted fails to resize btrfs partition that is mounted
        read-only
        #10
    
    Fix by preventing online resizing of *all* file systems mounted
    read-only, including reiserfs.  Instead of displaying the resize dialog
    in this case, display an information dialog explaining why the partition
    can't be resized.  This is similar to what happens when attempting to
    create a new partition on a disk without a partition table.  The new
    dialog looks like:
    
        (!) Unable to resize read-only file system /dev/sdb1
            The file system can not be resized while it is mounted read-only.
            Either unmount the file system or remount it read-write.
                                                                       [ OK ]
    
    Closes #10 - Gparted fails to resize btrfs partition that is mounted
                 read-only
    f8512506