Here is a short howto on creating a new /boot partition in LVM and migrate the existing boot partition to this newly created boot partition. The procedure basically involves creating a new /boot partition and copy all the files/folders from the old /boot to new /boot partition.

 

NOTE: You can try the below steps but need to make sure that there is free LVM space available

 

Creating and Migrating to new /boot partition

 

1. Check if you have free space in LVM

# lvs
  LV     VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root   cl     -wi-ao----  17.00g                                                    
  swap   cl     -wi-ao----   2.00g

 

# vgs
  VG     #PV #LV #SN Attr   VSize   VFree 
  cl       1   2   0 wz--n-  19.00g     10.00g

 

2. Create a new logical volume of 500MB size. You can create a larger size volume as well, but it should not be less than 500MB.

# lvcreate -L 500M -n /dev/cl/boot
Rounding up size to full physical extent 512.00 MB
Logical volume "boot" created

 

3. Create a new ext4 filesystem on the logical volume you have just created.

# mkfs.ext4 /dev/cl/boot
mke4fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
32768 inodes, 131072 blocks
6553 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=134217728
4 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first. Use tune4fs -c or -i to override.

 

4. Create a temporary directory to mount the new boot logical volume.

# mkdir /new-boot

 

5. Mount the new LV on that directory.

# mount -t ext4 /dev/cl/boot /new-boot/

 

6. Copy all the files under /boot to this new boot directory. Make sure you use ‘-p‘ to preserve the permission

# cp -rp /boot/* /new-boot/

 

7. Add an entry in /etc/fstab for the new LV mounted to /boot partition. We

/dev/cl/boot /boot ext4 defaults 0 0

 

8. Unmount the actual /boot partition (if mounted separately) and then remove the folder.

# umount -l /boot
# rmdir /boot/

 

9. Create a new /boot folder so that after reboot it will mount the new LV.

# mkdir /boot

 

10. Reboot the server.

# shutdown -r now

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)