[gparted] Ensure 1 MiB reserved when moving partition to start of disk



commit ceab9bde57fafbc96f9d90d2a86713cd07126f8b
Author: Curtis Gedak <gedakc gmail com>
Date:   Mon Oct 25 10:50:54 2010 -0600

    Ensure 1 MiB reserved when moving partition to start of disk
    
    The 1 MiB is required for the partition table stored at the
    beginning of the disk device.

 src/Dialog_Partition_Resize_Move.cc |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/Dialog_Partition_Resize_Move.cc b/src/Dialog_Partition_Resize_Move.cc
index 7987ef9..6443090 100644
--- a/src/Dialog_Partition_Resize_Move.cc
+++ b/src/Dialog_Partition_Resize_Move.cc
@@ -132,7 +132,12 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
 	if ( previous <= 0 )
 		MIN_SPACE_BEFORE_MB = 0 ;
 	else
-		MIN_SPACE_BEFORE_MB = Dialog_Base_Partition::MB_Needed_for_Boot_Record( selected_partition ) ;
+	{
+		if ( START <= (MEBIBYTE / selected_partition .sector_size) )
+			MIN_SPACE_BEFORE_MB = 1 ;
+		else
+			MIN_SPACE_BEFORE_MB = Dialog_Base_Partition::MB_Needed_for_Boot_Record( selected_partition ) ;
+	}
 	total_length = previous + selected_partition .get_sector_length() + next;
 	TOTAL_MB = Utils::round( Utils::sector_to_unit( total_length, selected_partition .sector_size, UNIT_MIB ) ) ;
 	



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]