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
This commit is contained in:
Mike Fleetwood 2021-05-27 09:13:28 +01:00 committed by Curtis Gedak
parent 325c6eb247
commit 36e43ed7a7
1 changed files with 3 additions and 2 deletions

View File

@ -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 ;