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
This commit is contained in:
parent
d405bb2264
commit
8308ee6051
|
@ -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 ) ;
|
||||
|
|
12
src/btrfs.cc
12
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() ;
|
||||
|
|
Loading…
Reference in New Issue