[gparted] Copy XFS label when copying the file system (!85)



commit 36e43ed7a72ae0d6fadb092b8ada86a02b53c9bb
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Thu May 27 09:13:28 2021 +0100

    Copy XFS label when copying the file system (!85)
    
    As GParted performs block copy of partitions then the label, which is
    stored in the file system superblock, is also copied.  This is true for
    copies performed using the GParted internal block copy and for EXT2/3/4
    and NTFS which are copied using the file system specific commands
    e2image and ntfsclone respectively.  However when an XFS file system is
    copied the label is not copied because a new file system is created
    using mkfs.xfs and the files copied using xfsdump | xfsrestore.
    
    Preview of the copy operation in GParted also reflects the fact that the
    label will be copied.
    
    Fix this by simply specifying the desired label when creating the new
    destination XFS.
    
    Closes !85 - Make XFS copy duplicate the file system label and UUID

 src/xfs.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/xfs.cc b/src/xfs.cc
index 56f99cfb..fc9d5931 100644
--- a/src/xfs.cc
+++ b/src/xfs.cc
@@ -228,8 +228,9 @@ bool xfs::copy( const Partition & src_part,
 {
        bool success = true ;
 
-       success &= ! execute_command( "mkfs.xfs -f " + Glib::shell_quote( dest_part.get_path() ),
-                                     operationdetail, EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE );
+       success &= ! execute_command("mkfs.xfs -f -L " + Glib::shell_quote(dest_part.get_filesystem_label()) +
+                                    " " + Glib::shell_quote(dest_part.get_path()),
+                                    operationdetail, EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE);
        if ( ! success )
                return false ;
 


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