This article covers 2 methods of resizing Linux partitions, with information specific to BootIt NG users.
Warning: When resizing any partition, there is always some risk of data loss, regardless of which method is used to resize it. It is highly recommended that you have a reliable backup of the partition (such as a partition image) before proceeding with the resize operation.
Method 1: Use the GParted Live CD to resize in one step. This method is appropriate only for BootIt NG users who limit primaries, meaning that the Limit Primaries setting in the Settings dialog is checked. GParted is a graphical partitioning utility, and is available on many Linux Live CDs, as well as on many installation CDs that double as Live CDs. The most commonly used Live CD for this purpose is probably the GParted Live CD, which is a bootable CD containing primarily the GParted program. It can be used to resize Linux partitions in one step from a graphical environment. For more information on how to use GParted, please refer to the GParted documentation.
Caution: GParted will not be appropriate for resizing partitions on systems where BootIt NG is configured to not limit primaries, meaning the Limit Primaries setting in the Settings dialog is not checked. This is because when primaries are not limited, all partitions known to BootIt NG may not be in the MBR partition table at any given time. GParted will see any partition not included in the MBR partition table as unpartitioned space, and therefore could overwrite existing partitions that it doesn't know about. This will cause data loss. For this situation, Method 2 described below is recommended.
Method 2: Use the combination of BootIt NG and the Linux file system resizing utilities. This method is appropriate for BootIt NG users who do not limit primaries, as well as for those that do. It involves a two step process; one to resize the partition itself using BootIt NG, and the other to resize the file system contained in the partition using the appropriate Linux file system resizing utility. Using this method will require BootIt NG as well as a Live CD containing the Linux file system resizing software. The Linux file system resizing utilities are available on the IFL Boot Disk (Image for Linux), as well as on many Linux Live CDs such as Knoppix.
The two most common Linux file systems are ext2/ext3/ext4 and reiserfs. Both of these file systems have a set of utility programs associated with them, and in both cases the program set includes a file system resizing utility. For ext2/3/4 the resize utility is resize2fs, while for reiserfs the resize utility is resize_reiserfs. Both are strictly command line utilities, and both will resize only the file system, and not the actual partition.
Important Note: If using resize2fs to resize an ext4 file system, ensure that you are using version 1.41.5 or later of resize2fs. Using any earlier version can result in file system corruption. If using the IFL Boot Disk, it should be version 2.40 or later to safely use resize2fs to resize ext4. Run the command 'resize2fs' without parameters to display the version.
The procedure for resizing a Linux partition with this method is different depending on whether you are expanding or shrinking the partition. The steps must be performed in a different order. The following are example sequences of how to expand and shrink a Linux partition using the combination of BootIt NG and the Linux resizing utilities on the IFL Boot Disk.
Expanding a partition: The Linux file system resizing utilities will not expand a file system beyond the boundaries of the existing partition. Therefore, the partition itself must be made larger first, and then the file system can be expanded to fill the larger partition. As an example, the following sequence of steps will expand an ext2/3/4 Linux partition from 2000 MB to 3000 MB:
1. In BootIt NG, highlight the 2000 MB Linux partition in Partition Work, and choose Resize.
2. In the New Size dialog, enter 3000 and choose OK. The actual resulting size displayed after you choose the OK button may be be slightly less than 3000 due to partition alignment requirements.
3. Reboot the system from the IFL Boot Disk, and then exit to the Linux command prompt from the main menu.
4. You will need to know the Linux designation for the partition being resized (such as /dev/sda2 or /dev/sdb3). If unfamiliar with this, please refer to the KB article Overview of working with partitions in Linux for an explanation. For this example we will use /dev/sdb2 as the partition to resize.
5. Run the command 'e2fsck -f /dev/sdb2' to check for file system errors before resizing. If you skip this step, the resize2fs utility may refuse to run, and in that case it will display a message prompting you to run the e2fsck command.
6. Run the command 'resize2fs -p /dev/sdb2' to expand the ext2/3 file system to fill the 3000 MB partition. Note that when no size is given on the command line, the default is to expand the file system to match the size of the partition.
Shrinking a partition: When shrinking a partition, the file system must be resized first to the smaller size, and then BootIt NG can be used to shrink the partition to match. Note that BootIt NG will not make a Linux partition smaller than the file system it contains. As an example, the following sequence of steps will shrink an ext2/3 Linux partition from 3000 MB to 2000 MB:
1. Boot the system from the IFL Boot Disk, and then exit to the Linux command prompt from the main menu.
2. You will need to know the Linux designation for the partition being resized (such as /dev/sda2 or /dev/sdb3). If unfamiliar with this, please refer to the KB article Overview of working with partitions in Linux for an explanation. For this example we will use /dev/sdb2 as the partition to resize.
3. Run the command 'e2fsck -f /dev/sdb2' to check for file system errors before resizing. If you skip this step, the resize2fs utility may refuse to run, and in that case it will display a message prompting you to run the e2fsck command.
4. Run the command 'resize2fs -p /dev/sdb2 2000M' to shrink the ext2/3/4 file system from 3000 MB to 2000 MB. Note that for the size parameter, the suffixes 'K' for kilobytes, 'M' for megabytes, 'G' for gigabytes, or 's' for sectors can be used. In this case we wanted 2000 MB, so 2000M was used.
5. Reboot the system into BootIt NG, highlight the Linux partition in Partition Work, and then choose Resize. Note that in the Resize dialog, BootIt NG will now display the new size of the file system as Min Size.
6. In the New Size dialog enter 2000, then choose OK. Note that in some cases, BootIt NG may not accept the value displayed as Min Size due to partition alignment. In that case, increase the new partition size in increments of 1 or 2 MB at a time until it does accept it - you shouldn't need to go any higher than 8 MB above the Min Size value displayed.
Additional Information: The 2 examples above are specific to resizing an ext2/3/4 partition, and therefore use the resize2fs utility for resizing the file system, and the e2fsck utility to check the file system. If you are working with a reiserfs partition instead, you will need to substitute the appropriate reiserfs utilities. The following would be the equivalent commands if working with reiserfs:
Check the file system: 'reiserfsck /dev/sdb2'
Expand file system to fill existing partition: 'resize_reiserfs /dev/sdb2'
Shrink file system to 2000 MB: 'resize_reiserfs -s 2000M /dev/sdb2'
The procedures for reiserfs would otherwise be the same as for the ext2/3/4 examples given above.