diff --git a/include/btrfs.h b/include/btrfs.h index ce769368..5a69d666 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 b3f141fd..a1fee532 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() ;