Shrink file systems to exact size (#701075)

Ext[234] file systems were being shrunk 1 KiB too small.  Ntfs and
reiserfs file systems were being shrunk 1 byte too small.  The resultant
file systems were ending up 1 block smaller than they could have been.

This looks like an accidental leftover from when GParted use to:
1) Shrink the file system 1 cylinder too small
2) Shrink the partition
3) Grow the file system to fill the partition
Relevant commit:

    d663c3c277
    removed cylindersize buffering during resize from the filesystems

Closes Bug #701075 - Setting the backup boot sector when resizing NTFS
This commit is contained in:
Mike Fleetwood 2013-05-27 18:04:44 +01:00 committed by Curtis Gedak
parent e66a6525f2
commit 3461413d28
3 changed files with 4 additions and 4 deletions

View File

@ -186,7 +186,7 @@ bool ext2::resize( const Partition & partition_new, OperationDetail & operationd
if ( ! fill_partition )
str_temp += " " + Utils::num_to_str( Utils::round( Utils::sector_to_unit(
partition_new .get_sector_length(), partition_new .sector_size, UNIT_KIB ) ) -1 ) + "K" ;
partition_new .get_sector_length(), partition_new .sector_size, UNIT_KIB ) ) ) + "K" ;
return ! execute_command( str_temp, operationdetail ) ;
}

View File

@ -199,7 +199,7 @@ bool ntfs::resize( const Partition & partition_new, OperationDetail & operationd
{
str_temp += " -s " ;
str_temp += Utils::num_to_str( Utils::round( Utils::sector_to_unit(
partition_new .get_sector_length(), partition_new .sector_size, UNIT_BYTE ) ) -1 ) ;
partition_new .get_sector_length(), partition_new .sector_size, UNIT_BYTE ) ) ) ;
}
//simulation..

View File

@ -160,7 +160,7 @@ bool reiserfs::resize( const Partition & partition_new, OperationDetail & operat
if ( ! fill_partition )
{
size = " -s " + Utils::num_to_str( Utils::round( Utils::sector_to_unit(
partition_new .get_sector_length(), partition_new .sector_size, UNIT_BYTE ) ) -1 ) ;
partition_new .get_sector_length(), partition_new .sector_size, UNIT_BYTE ) ) ) ;
}
Glib::ustring cmd = "sh -c 'echo y | resize_reiserfs" + size + " " + partition_new .get_path() + "'" ;