[gparted] Make resize of whole disk file systems work (#743181)



commit c01106c54e98fa77c899adffa5797b7d173ab982
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Fri Feb 6 13:27:59 2015 +0000

    Make resize of whole disk file systems work (#743181)
    
    Only allow resizing, not moving of a whole disk device file system.
    There is no actual partition to move and moving a file system away from
    the start of a disk only makes it unrecognisable.
    
    Also don't perform the partition resize step as there's no actual
    partition to be resized.  Only the file system is being resized.
    (Libparted actually allows the virtual partition spanning a whole disk
    device to be resized, implementing it as a no-operation, but only for
    recognised file systems.  For unrecognised file systems it fails with
    "unrecognised disk label").
    
    Note that the existing resize dialog was designed for resizing partition
    boundaries, and their contained file systems, not for resizing file
    systems within a fixed boundary.  The difference is noticeable when
    there is unallocated space because the file system doesn't fill the
    whole disk device.  The dialog starts resizing a virtual partition the
    size of the whole disk device, not the actual size of the file system.
    Leave addressing this for a possible future update.
    
    Bug 743181 - Add unpartitioned drive read-write support

 src/Dialog_Partition_Resize_Move.cc |    4 ++--
 src/GParted_Core.cc                 |    9 ++++++---
 2 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/Dialog_Partition_Resize_Move.cc b/src/Dialog_Partition_Resize_Move.cc
index 7262ea0..95bf4da 100644
--- a/src/Dialog_Partition_Resize_Move.cc
+++ b/src/Dialog_Partition_Resize_Move.cc
@@ -76,8 +76,8 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
                fs .grow   = FS::NONE ;
        }
 
-       //see if we need a fixed_start
-       if ( fs .move && ! selected_partition .busy )
+       // See if we can allow the start of the file system to move
+       if ( fs.move && ! selected_partition.busy && ! selected_partition.whole_device )
        {
                set_title( String::ucompose( _("Resize/Move %1"), selected_partition .get_path() ) ) ;
                frame_resizer_base ->set_fixed_start( false ) ;
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 569afb4..9b333d2 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -2486,7 +2486,8 @@ bool GParted_Core::resize( const Partition & partition_old,
        if ( partition_new.filesystem == FS_LINUX_SWAP )
        {
                // linux-swap is recreated, not resize
-               success =    resize_move_partition( partition_old, partition_new, operationdetail )
+               success =    ( partition_new.whole_device ||
+                              resize_move_partition( partition_old, partition_new, operationdetail ) )
                          && resize_filesystem( partition_old, partition_new, operationdetail );
 
                return success;
@@ -2497,12 +2498,14 @@ bool GParted_Core::resize( const Partition & partition_old,
        {
                success =    ( partition_new.busy || check_repair_filesystem( partition_new, operationdetail 
) )
                          && resize_filesystem( partition_old, partition_new, operationdetail )
-                         && resize_move_partition( partition_old, partition_new, operationdetail );
+                         && ( partition_new.whole_device ||
+                              resize_move_partition( partition_old, partition_new, operationdetail ) );
        }
        else if ( delta > 0LL )  // grow
        {
                success =    ( partition_new.busy || check_repair_filesystem( partition_new, operationdetail 
) )
-                         && resize_move_partition( partition_old, partition_new, operationdetail )
+                         && ( partition_new.whole_device ||
+                              resize_move_partition( partition_old, partition_new, operationdetail ) )
                          && maximize_filesystem( partition_new, operationdetail );
        }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]