How To Move Boot Partition To Another Partition In RHEL/CENTOS 6

In case if you need relocate /boot partition to another drive or partition due some reasons , then you need to

1. Rename your old boot folder
2. Create new folder for /boot
3. Mount new partition as /boot
4. Modify /etc/fstab
5. Copy boot files to new location
6. use grub console to reconfiguring grub
7. Modify /etc/grub.conf
8. reboot

1. Rename your old boot folder , If it’s partition copy files somewhere safely.

# mv /boot /oldboot

2. Create new folder for /boot

# mkdir /boot

3. Mount new partition to /boot , here sda4 is the new boot partition.

# mount /dev/sda4 /boot/

4. Correct /etc/fstab so that it pointed to a new /boot partition (it is usually recognized by UUID)

# cat /etc/fstab

UUID="a1981e71-e90a-4f12-9093-55ecbc70bd9a" /boot ext3 defaults 0 0

5. Copy boot files to new location

# cp -avpf /oldboot/* /boot/

6. Use grub command line interface to reconfiguring grub and use any other known methords. Type “grub” to access CLI console:

# grub

Probing devices to guess BIOS drives. This may take a long time.

GNU GRUB version 0.97 (640K lower / 3072K upper memory)

[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]

grub> find /grub/stage1 find /grub/stage1 (hd0,3)

grub> root (hd0,3) root (hd0,3) Filesystem type is ext2fs, partition type 0x83

grub> setup (hd0) setup (hd0) Checking if "/boot/grub/stage1" exists... no Checking if "/grub/stage1" exists... yes Checking if "/grub/stage2" exists... yes Checking if "/grub/e2fs_stage1_5" exists... yes Running "embed /grub/e2fs_stage1_5 (hd0)"... 27 sectors are embedded. succeeded Running "install /grub/stage1 (hd0) (hd0)1+27 p (hd0,3)/grub/stage2 /grub/grub.conf"... succeeded Done.

grub> cat (hd0,3)/grub/grub.conf cat (hd0,3)/grub/grub.conf default=0 timeout=10 title linux centos6_64 root (hd0,3) kernel /vmlinuz-2.6.32-642.1.1.el6.x86_64 ro root=/dev/sda1 rhgb noquiet crashkernel=auto SYSFONT=latarcyrheb-sun16 LANG=en_US.UTF-8 KEYTABLE=us initrd /initramfs-2.6.32-642.1.1.el6.x86_64.img

grub> find (hd0,3)/grub/stage1 find (hd0,3)/grub/stage1 (hd0,0) (hd0,1) (hd0,3)

grub> cat (hd0,0)/etc/fstab cat (hd0,0)/etc/fstab # /dev/sda1 / ext3 errors=remount-ro 0 1 /dev/sda2 /home ext4 defaults 1 2 /dev/sda3 swap swap defaults 0 0 UUID="a1981e71-e90a-4f12-9093-55ecbc70bd9a" /boot ext3 defaults 0 0 proc /proc proc defaults 0 0 sysfs /sys sysfs defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts defaults 0 0

7. Correct /etc/grub.conf so that it point to correct partition.

# cat /etc/grub.conf
default=0
timeout=10

Title Linux CentOS Server (2.6.32-642.1.1.el6.x86_64)
root (hd0,3)
kernel /vmlinuz-2.6.32-642.1.1.el6.x86_64 ro root=/dev/sda1 rhgb noquiet crashkernel=auto SYSFONT=latarcyrheb-sun16 LANG=en_US.UTF-8 KEYTABLE=us
initrd /initramfs-2.6.32-642.1.1.el6.x86_64.img

8. Reboot

# shutdown -r now