Introduction
When working with Linux servers, especially cloud-based systems, you may sometimes encounter the message:
You are in emergency mode.
After logging in, type "journalctl -xb" to view system logs.
This usually happens when the system cannot mount one or more filesystems during boot a common situation seen in Emergency Mode Linux.
A common cause is an incorrect entry inside /etc/fstab, which can break the boot process and force the server into emergency mode.
In this blog, we will walk through a real-world scenario where the server failed to boot because /etc/fstab attempted to mount the wrong device on /var/www.
You’ll learn how to identify the issue, correct the fstab file, and safely restore the system to normal operation.
Identifying the Issue
After logging into emergency mode, running:
systemctl --failed
shows:
var-www.mount loaded failed failed /var/www
This indicates that the system could not mount the /var/www directory during boot.
To determine why, check the /etc/fstab file:
cat /etc/fstab
Inside it, you may see an entry like:
/dev/sdc /var/www ext4 defaults 0 0
At first glance, this looks correct.
However, upon deeper inspection, it becomes clear that /dev/sdc is not a filesystem — it is a disk with an MBR table.
Checking the disk with:
file -s /dev/sdc
returns:
DOS/MBR boot sector, extended partition table
And the actual filesystem is located on the partition:
/dev/sdc1
Verified using:
file -s /dev/sdc1
which shows:
Linux rev 1.0 ext4 filesystem data ...
This means the system was trying to mount the entire disk instead of the partition that actually contains the filesystem.
Because /dev/sdc had no filesystem, the mount failed — causing the emergency mode boot issue.
Correcting the fstab Entry
To fix this, edit the fstab file inside emergency mode:
vim /etc/fstab
Locate the incorrect line:
/dev/sdc /var/www ext4 defaults 0 0
Comment it out:
#/dev/sdc /var/www ext4 defaults 0 0
Save the file and reboot:
reboot
The system should now boot normally without dropping into emergency mode.
Running Filesystem Check (Optional but Recommended)
Because /dev/sdc1 showed:
(needs journal recovery)
it is recommended to run an fsck to ensure the filesystem is clean.
However, never run fsck on a mounted root filesystem.
Option 1: Force fsck on next boot
touch /forcefsck
reboot
Option 2: Boot into recovery mode and manually run:
fsck -fy /dev/sdc1
This safely repairs any pending journal issues.
Conclusion
Emergency mode in Linux often points to problems related to the filesystem, and incorrect fstab entries are one of the most common triggers.
In this scenario, the system failed to boot because /etc/fstab attempted to mount the entire /dev/sdc disk instead of the actual partition /dev/sdc1.
By identifying the failed mount, correcting the fstab entry, and rebooting, the system returned to normal operation.
Always ensure that fstab entries point to valid filesystems — not raw disks — to prevent similar boot failures.
If you encounter this issue in the future, you now have a clear, step-by-step process to diagnose and fix it quickly.
If you’re still stuck in Emergency Mode Linux or facing recurring /var/www mount issues, our experts can help. Skynats offers reliable Linux Server Management Services and 24/7 Server Management Services to diagnose, repair, and fully secure your server. Contact us anytime for instant support and get your system back online quickly.