How to edit read only /etc/fstab file ?

While we working with /etc/fstab file like mounting nfs shares or any other newly created partition, system stucks at file system check and wont boot especially if file system check is enabled in /etc/fstab file for that particular mount. It's not  a big deal at all to resolve the issue, all you need to do is to just remove that newly added mount entry or correct it, But but here is the real trouble stops you that is after you logging in to shell entering maintainance password, /etc/fstab file will be mounted as read only so you can't edit the file. Let's see how to edit that file.

First remount "/" partition with "rw" option then you can edit /etc/fstab file in the way you want.

  • Boot the system at boot loader (grub) screen  press "a" (without quotes)
  • At the grub prompt after quiet give space and type init=/bin/bash and hit enter.

<uto rhgb quiet init=/bin/bash

  • it will take you to bash shell with root privilages.
  • Now type the either of the command which works for you that time.

bash-4 # mount -o remount,rw /

or

bash-4 # mount - / - o remount,rw 

That's it now you can open /etc/fstab with vi editor and can edit and save the changes. So you server wont stuck at wrong mount entry in /etc/fstab.

0 comments:

Post a Comment

 
Design by GeekInLinux | Powered by Blogger