...
 
Commits (4)
  • Mike Fleetwood's avatar
    Set partition type when formatting to cleared (!36) · 4d9dc14b
    Mike Fleetwood authored
    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
    4d9dc14b
  • Mike Fleetwood's avatar
    Stop recognising retired libparted linux-swap names · 40ec0deb
    Mike Fleetwood authored
    With this commit in parted 1.8.3 [1], libparted changed from reporting
    the name of Linux swap as:
        linux-swap
    to reporting either:
        linux-swap(old)
        linux-swap(new)
    Later with this commit in parted 1.9 [2], libparted stopped reporting
    those names and reported these instead:
        linux-swap(v0)
        linux-swap(v1)
    
    Demonstration:
        # mkswap /dev/sdc1
        Setting up swapspace version 1, size = 1048572 KiB
        no label, UUID=a2010834-003d-4bf2-9e94-58383fe20a26
        # blkid /dev/sdc1
        /dev/sdc1: UUID="a2010834-003d-4bf2-9e94-58383fe20a26" TYPE="swap"
        # parted -v
        parted (GNU parted) 2.1
        ...
        # parted /dev/sdc unit s print
        ...
        Number  Start  End       Size      Type     File system     Flags
         1      2048s  2099199s  2097152s  primary  linux-swap(v1)
    
    As GParted now requires libparted 2.2 or later [3], remove recognition
    for those no longer libparted reported linux-swap names.  Note that the
    "swap" name is reported by blkid.
    
    [1] http://git.savannah.gnu.org/cgit/parted.git/commit/?id=98a53fd115ca012edf226525b8d4be628454f99e
        Enable support for swsusp partitions, and the ability to
        differentiate between old and new versions of linux-swap partitions.
        Changed the swap_init signature and removed extra ped_geometry_read
        from _swap*_open.
    
    [2] http://git.savannah.gnu.org/cgit/parted.git/commit/?id=cfafa4394998a11f871a0f8d172b13314f9062c2
        Rationalise linux-swap fs names, and add a "linux-swap" alias
    
    [3] 8df975c7
        Increase minimum required libparted to 2.2 (!22)
    40ec0deb
  • Mike Fleetwood's avatar
    Stop trying unneeded alternative libparted linux-swap names · ab1381b1
    Mike Fleetwood authored
    With that same commit in parted 1.9 [1], libparted only recognised these
    linux-swap names via deprecated aliases:
        linux-swap(old)
        linux-swap(new)
    but does accept this name as a current alias:
        linux-swap
    for:
        linux-swap(v1)
    
    Demonstration:
        # parted -v
        parted (GNU parted) 2.1
        ...
    
        # parted /dev/sdc mkfs yes 1 "linux-swap(new)" unit s print
        ...
        [0] filesys.c:148 (ped_file_system_type_get(): File system alias linux-swap(new) is deprecated
        ...
        Number  Start  End       Size      Type     File system     Flags
         1      2048s  2099199s  2097152s  primary  linux-swap(v1)
    
        # parted /dev/sdc mkfs yes 1 "linux-swap" unit s print
        ...
        Number  Start  End       Size      Type     File system     Flags
         1      2048s  2099199s  2097152s  primary  linux-swap(v1)
    
    Again as GParted now requires libparted 2.2 or later:
    1) Stop using alternative "linux-swap(new)" name as that is deprecated
       by libparted.
    2) Also stop using alternative "linux-swap(v1)" name as that code is
       never used because libparted recognised the GParted "linux-swap"
       name as a current alias.
    
    [1] http://git.savannah.gnu.org/cgit/parted.git/commit/?id=cfafa4394998a11f871a0f8d172b13314f9062c2
        Rationalise linux-swap fs names, and add a "linux-swap" alias
    ab1381b1
  • Mike Fleetwood's avatar
......@@ -1465,12 +1465,9 @@ FSType GParted_Core::detect_filesystem( PedDevice * lp_device, PedPartition * lp
else if ( fsname == "ext4" ||
fsname == "ext4dev" )
return FS_EXT4;
else if ( fsname == "linux-swap" ||
fsname == "linux-swap(v1)" ||
fsname == "linux-swap(new)" ||
fsname == "linux-swap(v0)" ||
fsname == "linux-swap(old)" ||
fsname == "swap" )
else if (fsname == "linux-swap(v0)" ||
fsname == "linux-swap(v1)" ||
fsname == "swap" )
return FS_LINUX_SWAP;
else if ( fsname == "crypto_LUKS" )
return FS_LUKS;
......@@ -2105,7 +2102,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);
else
return erase_filesystem_signatures( partition, operationdetail )
&& set_partition_type( partition, operationdetail )
......@@ -3549,22 +3547,18 @@ 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() );
// If not found, and FS is linux-swap, then try linux-swap(v1)
if ( ! lp_fs_type && fs_type == "linux-swap" )
lp_fs_type = ped_file_system_type_get( "linux-swap(v1)" );
// If not found, and FS is linux-swap, then try linux-swap(new)
if ( ! lp_fs_type && fs_type == "linux-swap" )
lp_fs_type = ped_file_system_type_get( "linux-swap(new)" );
// 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 udf, then try ntfs.
// Actually MBR 07 IFS (Microsoft Installable File System) or
// GPT BDP (Windows Basic Data Partition).
// Ref: https://serverfault.com/a/829172
if ( ! lp_fs_type && fs_type == "udf" )
if (! lp_fs_type && partition.filesystem == FS_UDF)
lp_fs_type = ped_file_system_type_get( "ntfs" );
// default is Linux (83)
......