How To: Migrate /boot from ext2 to ext4

How To: Migrate /boot from ext2 to ext4

Your server uses ext2 filesystem for the /boot partition. But you would prefer to use a journaling filesystem like ext3/ext4.

Step 1

Identify the partition which is mounted to /boot (here it is /dev/sda1):

root@ucs:~# mount| grep /boot
/dev/sda1 on /boot type ext2 (rw,relatime,block_validity,barrier,user_xattr,acl)

Step 2

Unmount the partition

root@ucs:~# umount /boot

Step 3

Create the (internal) journal by using the partition identified above:

root@ucs:~# tune2fs -j /dev/sda1  

Step 4

Edit /etc/fstab and change the line for /boot from “ext2” to “ext3”:
UUID=96ed52e8-e9cd-441a-b4a3-fa7042ad4165 /boot ext2 defaults 0 2
UUID=96ed52e8-e9cd-441a-b4a3-fa7042ad4165 /boot ext3 defaults 0 2

Step 5

Mount the partition again it should not report any errors
root@ucs:~# mount -a

Step 6

Update grub to refer to the updated filesystem.
root@ucs:~# update-grub

Step 7 (optional)

For testing purposes you might want to reboot your server (optional):
root@ucs:~# reboot