How to Move the Boot Partition to Another Storage Disk Partition in CloudLinux

March 25, 2025 / Servers, Hosting & Email

This article explains how to move the boot partition to another storage disk partition in CloudLinux.

Issue:

  • The current /boot partition is too small and needs to be migrated to a larger partition on another disk.
  • A larger reserved space is required before the first partition for leapp.

Note: This process applies to CloudLinux 7, CloudLinux 8, and CloudLinux 9 environments.

Solution:
We assume two disks: /dev/sda (existing boot partition) and /dev/sdb (new storage disk). Follow these steps to migrate the /boot partition from /dev/sda to /dev/sdb.

  1. Create a New Partition on /dev/sdb
    1. Ensure there is unallocated space at the beginning of /dev/sdb for the GRUB bootloader. If there is no partition table, create one:
      parted /dev/sdb mklabel msdos

      Note: Ensure /dev/sdb has no important data, as this process will erase existing data.

    2. Create the new /boot partition:
      parted /dev/sdb mkpart primary ext4 1MiB 1024MiB
  2. Format the New Partition
    Format /dev/sdb1 with the ext4 filesystem:

    mkfs.ext4 /dev/sdb1
  3. Copy Boot Files to the New Partition
    Mount /dev/sdb1 and copy the contents of /boot:

    mount /dev/sdb1 /mnt
    rsync -avh /boot/ /mnt/
  4. Install GRUB on the New Disk
    Install the GRUB bootloader onto /dev/sdb:

    grub2-install --boot-directory=/mnt /dev/sdb

    This writes the necessary bootloader files into the reserved space created earlier.

  5. Update /etc/fstab
    1. Modify /etc/fstab to reflect the new boot partition. Retrieve the UUID of /dev/sdb1:
      blkid /dev/sdb1
    2. Sample output:
      /dev/sdb1: UUID="9143bc94-1047-4bd7-b77d-ba393cbc71aa" TYPE="ext4"
    3. Edit /etc/fstab to include:
      UUID=9143bc94-1047-4bd7-b77d-ba393cbc71aa /boot ext4 defaults 1 1
    4. Verify the changes:
      mount -a
  6. Reboot and Change Boot Priority
    1. Restart the system.
    2. Enter BIOS settings and set /dev/sdb as the primary boot disk.
    3. Boot the system and verify that the new partition is mounted:
      df -h
    4. Expected output should display /dev/sdb1 mounted as /boot:
      Filesystem      Size  Used Avail Use% Mounted on
      /dev/sdb1      989M  149M  773M  17% /boot
  7. Recreate GRUB Configuration
    1. Before deleting the old /boot files, regenerate the GRUB configuration:
      grub2-mkconfig -o /boot/grub2/grub.cfg
    2. Sample output:
      Generating grub configuration file ...
      Found linux image: /boot/vmlinuz-...
      Found initrd image: /boot/initramfs-...
    3. Done

Your system is now successfully using the new /boot partition. You can safely remove the old boot files if everything is working correctly.

 

Spread the love