Allow unused space in a partition to equal its size

Newly created LVM2 PVs, before being added to a Volume Group, report
free space equal to the partition size.  Allow free space to equal
partition size.

    # parted /dev/sda10 unit B print
    Error: /dev/sda10: unrecognised disk label
    Model: Unknown (unknown)
    Disk /dev/sda10: 2147483648B
    Sector size (logical/physical): 512B/512B
    Partition Table: unknown
    # lvm pvcreate /dev/sda10
      Writing physical volume data to disk "/dev/sda10"
      Physical volume "/dev/sda10" successfully created
    # lvm pvs --units b -o pv_free /dev/sda10
      PFree
      2147483648B
This commit is contained in:
Mike Fleetwood 2011-11-28 12:43:04 +00:00 committed by Curtis Gedak
parent abd0dd0426
commit 0acb623725
1 changed files with 1 additions and 1 deletions

View File

@ -81,7 +81,7 @@ void Partition::Set( const Glib::ustring & device_path,
void Partition::Set_Unused( Sector sectors_unused )
{
if ( sectors_unused < get_sector_length() )
if ( sectors_unused <= get_sector_length() )
{
this ->sectors_unused = sectors_unused ;
this ->sectors_used = ( sectors_unused == -1 ) ? -1 : get_sector_length() - sectors_unused ;