Skip to content

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:

  1. Boot into a live environment using a Linux live CD or USB drive.

  2. 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.

  3. Once the swap partition was deleted, we were able to move the extended partition and resize the boot partition.

  4. 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:

  1. Identify a partition to use as swap. You can use a separate partition or a file on an existing partition.
  2. Format the partition as swap using the mkswap command.
  3. Activate the swap partition using the swapon command.
  4. Add the swap partition to your system's fstab file.

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 -u
  • sudo reboot
The content provided is generated with the help of artificial intelligence (AI) and may contain inaccuracies or outdated information due to the limitations of AI. While I strive to review and validate the content, some errors or inaccuracies may still be present in the final output. Please use this content as a general guide only and verify any critical information through reputable sources before relying on it. I appreciate your understanding and feedback in helping us improve the accuracy and quality of our AI-generated content."