Linux – Centos Failed to mount /sysroot while booting

centoslinux

Whenever I try to boot my CentOS server, it boots in emergency mode and after mounting the partition with command:

$ mount -t ext4 --source /dev/sda4 --target /sysroot

the server boots fine.

How do I permanently mount /dev/sda4 on /sysroot so I don't require to mount it again and again?

Best Answer

The best way to add filesystems to be mounted on boot is /etc/fstab.
See this link for more information: fstab(5)

/dev/sda4   /sysroot   ext4   defaults   0   2