Commit 4d9dc14b authored by Mike Fleetwood's avatar Mike Fleetwood Committed by Curtis Gedak

Set partition type when formatting to cleared (!36)

Formatting a partition to cleared over the top of LVM2 PV leaves the
"lvm" flag set on the partition; where as formatting with an actual file
system over the top of an LVM2 PV clears the "lvm" flag.  This is true
for both MSDOS and GPT partitioned drives.

Fix by setting the partition type when formatting to cleared too.

Closes !36 - Set partition type when clearing partition contents
parent 5d2dc721
......@@ -2105,7 +2105,8 @@ bool GParted_Core::format( const Partition & partition, OperationDetail & operat
if ( partition .filesystem == FS_CLEARED )
return erase_filesystem_signatures( partition, operationdetail ) ;
return erase_filesystem_signatures(partition, operationdetail)
&& set_partition_type(partition, operationdetail);
return erase_filesystem_signatures( partition, operationdetail )
&& set_partition_type( partition, operationdetail )
......@@ -3549,8 +3550,12 @@ bool GParted_Core::set_partition_type( const Partition & partition, OperationDet
Glib::ustring fs_type = Utils::get_filesystem_string( partition.filesystem );
// Lookup libparted file system type using GParted's name, as most match
PedFileSystemType * lp_fs_type = ped_file_system_type_get( fs_type.c_str() );
// Lookup libparted file system type using GParted's name, as most
// match. Exclude cleared as the name won't be recognised by
// libparted and get_filesystem_string() has also translated it.
PedFileSystemType *lp_fs_type = NULL;
if (partition.filesystem != FS_CLEARED)
lp_fs_type = ped_file_system_type_get(fs_type.c_str());
// If not found, and FS is linux-swap, then try linux-swap(v1)
if ( ! lp_fs_type && fs_type == "linux-swap" )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment