• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Create a New /boot Partition in CentOS / RHEL

by admin

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

Filed Under: CentOS/RHEL 6, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL 7 : How to disable IPv6 on a specific interface only
  2. blurlock Command Examples in Linux
  3. pkill: command not found
  4. lvreduce Command Examples in Linux
  5. Why Does a Lun World Wide ID Starts with the Number 3 in Linux dm-multipath
  6. ping not working on a Newly Built CentOS/RHEL server
  7. Linux OS Service ‘NetFS’
  8. /etc/rsyslog.conf – Setup a Filter to Discard or Redirect Messages
  9. CentOS / RHEL : How to install Open Virtual Machine Tools for Virtual machines Hosted on VMWare
  10. How to Add Network Printer via Command Line in CentOS/RHEL

You May Also Like

Primary Sidebar

Recent Posts

  • qm Command Examples in Linux
  • qm wait Command Examples in Linux
  • qm start Command Examples in Linux
  • qm snapshot Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright