[gparted] Support changing the UUID of a btrfs file system (#751337)
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Support changing the UUID of a btrfs file system (#751337)
- Date: Sun, 28 Jun 2015 17:12:24 +0000 (UTC)
commit 8308ee6051b329284cd16ae66ad37699c4b7130b
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Fri Jun 19 13:02:32 2015 +0100
Support changing the UUID of a btrfs file system (#751337)
Btrfs-progs 4.1, released June 2015, includes support for changing the
UUID of a btrfs file system using the btrfstune command. Check for
availability by looking for the -u option in the btrfstune help output.
Use btrfstune like this:
# umount /dev/sdb1
# btrfstune -f -u /dev/sdb1
Current fsid: e7ad5dba-d721-4f99-990b-1ba2901c8ad2
New fsid: 231563d9-e173-410d-b1da-d34c4319a423
Set superblock flag CHANGING_FSID
Change fsid in extents
Change fsid on devices
Clear superblock flag CHANGING_FSID
Fsid change finished
# echo $?
0
Bug 751337 - btrfstune in btrfs-progs 4.1 supports changing the file
system UUID
include/btrfs.h | 1 +
src/btrfs.cc | 12 ++++++++++++
2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/include/btrfs.h b/include/btrfs.h
index ce76936..5a69d66 100644
--- a/include/btrfs.h
+++ b/include/btrfs.h
@@ -39,6 +39,7 @@ public:
void read_label( Partition & partition ) ;
bool write_label( const Partition & partition, OperationDetail & operationdetail ) ;
void read_uuid( Partition & partition ) ;
+ bool write_uuid( const Partition & partition, OperationDetail & operationdetail );
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition
= false ) ;
bool check_repair( const Partition & partition, OperationDetail & operationdetail ) ;
diff --git a/src/btrfs.cc b/src/btrfs.cc
index b3f141f..a1fee53 100644
--- a/src/btrfs.cc
+++ b/src/btrfs.cc
@@ -107,6 +107,13 @@ FS btrfs::get_filesystem_support()
}
}
+ if ( ! Glib::find_program_in_path( "btrfstune" ).empty() )
+ {
+ Utils::execute_command( "btrfstune --help", output, error, true );
+ if ( Utils::regexp_label( error, "^[[:blank:]]*(-u)[[:blank:]]" ) == "-u" )
+ fs.write_uuid = FS::EXTERNAL;
+ }
+
if ( fs .check )
{
fs .copy = GParted::FS::GPARTED ;
@@ -422,6 +429,11 @@ void btrfs::read_uuid( Partition & partition )
}
}
+bool btrfs::write_uuid( const Partition & partition, OperationDetail & operationdetail )
+{
+ return ! execute_command( "btrfstune -f -u " + partition.get_path(), operationdetail );
+}
+
void btrfs::clear_cache()
{
btrfs_device_cache .clear() ;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]