Formatting a Boot Partition in RHEL or CentOS 6.8 in Azure
Format the new partition with ext4
or ext3
. For example:
# mkfs.ext4 /dev/sda2
The files from the /boot
directory should be copied to the new boot partition:
# mkdir -p /tmp/sda2 # mount /dev/sda2 /tmp/sda2 # cp -a /boot/* /tmp/sda2
Find the UUID of the new boot partition:
# blkid /dev/sda2 # umount /tmp/sda2
Add an entry to /etc/fstab
to mount the new boot partition, like this:
UUID=<uuid> /boot ext4 rw 0 0
Important: Mount the /boot
partition. For example:
# mount /boot
Re-install GRUB on the current boot device (GRUB files need to be copied to /boot
, which was mounted in the previous step). For example:
# grub-install /dev/sda
Note that GRUB is being installed on /dev/sda
but the boot directory comes from /dev/sda2
.
In CentOS 6.8, grub
is installed, and not grub2
. CentOS 6.8 does not provide a utility to update the /boot/grub/grub.conf
file, so you need to update it manually.
The original grub.conf
file, before modification, follows. The highlighted text indicates what will need to be changed:
default=0 timeout=5 splashimage=(hd0,0)/boot/grub/splash.xpm.gz hiddenmenu title CentOS 6 (2.6.32-642.1.1.el6.x86_64) root (hd0,0) kernel /boot/vmlinuz-2.6.32-642.1.1.el6.x86_64 ro root=UUID=8b9b4465-bdbf-4780-8b1e-d5b4d089a77d rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 console=ttyS0,115200n8 earlyprintk=ttyS0,115200 rootdelay=300 rd_NO_LVM rd_NO_DM initrd /boot/initramfs-2.6.32-642.1.1.el6.x86_64.img
The modified grub.conf
file follows, with highlighted text for the lines that are changed:
default=0 timeout=5 splashimage=(hd0,0)/boot/grub/splash.xpm.gz hiddenmenu title CentOS 6 (2.6.32-642.1.1.el6.x86_64) root (hd0,1) kernel /vmlinuz-2.6.32-642.1.1.el6.x86_64 ro root=UUID=8b9b4465-bdbf-4780-8b1e-d5b4d089a77d rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 console=ttyS0,115200n8 earlyprintk=ttyS0,115200 rootdelay=300 rd_NO_LVM rd_NO_DM initrd /initramfs-2.6.32-642.1.1.el6.x86_64.img
There are a total of three modifications:
- Change
0
to1
in theroot
line:(hd0,0)
becomes(hd0,1)
- Remove
/boot
from thekernel
line and theinitrd
line.
Reboot the system and make sure that it boots properly from the new boot partition.