Resize a Boot Partition and Set Up a Swap Partition¶
Resizing a boot partition and setting up a swap partition can be a daunting task, especially for Linux newcomers. However, with the right steps and precautions, you can successfully resize your boot partition and set up a swap partition to improve your system's performance.
Resizing the Boot Partition¶
Before you begin, make sure you have a backup of your important files and data. Resizing a partition can be a risky operation, and you don't want to lose any important data.
To resize the boot partition, you'll need to:
-
Boot into a live environment using a Linux live CD or USB drive.
-
Use a partition editor like GParted to resize the boot partition. However, in our case, the free space was not adjacent to the boot partition, so we had to delete the existing swap partition to make room for the boot partition to be resized.
-
Once the swap partition was deleted, we were able to move the extended partition and resize the boot partition.
-
Apply the changes, create new swap and reboot into your normal environment.
Setting Up a Swap Partition after reboot¶
Reboot may appear stuck since the swap partition uuid is changed but it'll boot, you can set up a new swap partition to improve your system's performance.
To set up a swap partition, you'll need to:
- Identify a partition to use as swap. You can use a separate partition or a file on an existing partition.
- Format the partition as swap using the
mkswapcommand. - Activate the swap partition using the
swaponcommand. - Add the swap partition to your system's
fstabfile.
Using UUID to Identify the Swap Partition¶
To ensure that your system uses the correct swap partition, you'll need to use the UUID (Universally Unique Identifier) of the partition.
To find the UUID of the swap partition, use the blkid command:
sudo blkid
Then, edit the /etc/initramfs-tools/conf.d/resume file and update the UUID:
sudo nano /etc/initramfs-tools/conf.d/resume
Finally, rerun the update-initramfs command and reboot your system:
sudo update-initramfs -usudo reboot