Saturday, August 27, 2016

Edit /etc/fstab in maintenance mode


Imagine your server crashes (due to some hardisk I/O error, for instance, or removed the hdd by mistake). Then if you reboot your machine, it’ll spit out something like:

Checking filesystems...
   e2fsck: Cannot continue, aborting
   Type root password for maintenance mode or CTRL+D to continue
Lets suppose the culprit of this is some HDD (for instance, /dev/mapper/Vt31-p1 which should be mounted in /software).

Then if you read the contents of /etc/fstab you will see one line like:

/dev/mapper/Vt31-p1    /t31                    ext3    defaults        1 2
If you try to comment this line, your editor will complain and tell “changes cannot be written” or something like that. Why is this? Well, your /etc files have been mounted on a non writable partition (maintenance mode, you remember?). So you will have to remount this partition in RW mode. Just like this:

mount -o remount,rw /
Then edit fstab, save your changes and reboot.

No comments:

Post a Comment