Search This Blog

Loading...

Monday, April 27, 2009

How to edit /etc/fstab when at Centos/Redhat “Repair filesystem” prompt?

I faced this situation yesterday when I was working on Fedora Core 6 distribution and was setting up a DRBD cluster for Mysql replication.

I created a separate partition while installing the operating system and mounted it on ‘/data’. Fedora installation does not let you go without specifying the mount point while creating partitions as OS installation time so i did using ‘/data’. I did this for both the machines for cluster and when I configured DRBD for this partition, mount point has been changed.

Mistake: I forgot to remove this entry from /etc/fstab file which takes care of all the mount points. During the setup we did ‘REBOOT’ and STUCK!

Now system was unable to boot the system because it was reading /etc/fstab file was unable to find the device for it. This can also happen when you have some external hard-drive attached with your linux system and you remove device but forgot to clean its entry from /etc/fstab file.

Linux gives you a “Repair Filesystem” prompt in this situation and you can enter that by providing the root password. The problem is that on “Repair Filesystem” prompt, linux file system and rest of the file systems are generally not mounted and if mounted then it is “Read-Only” so you can not change files.

Solution:

Use following command to mount the filesystem with writable permission:

Repair filesystem # mount -w -o remount /

After this you can go and change /etc/fstab file. Restart your computer and that’s it.

See similar posts:

http://thuannvn.blogspot.com/2009/02/linux-recovery-linux-rescue.html

11 comments:

  1. Cheers. Was excatly what I was looking for

    ReplyDelete
  2. man... you are my hero :)

    had this problem with centos. thank you so much

    ReplyDelete
  3. how about you credit where it is due.

    http://www.techiegyan.com/2008/06/28/how-to-edit-etcfstab-when-at-fedora-repair-filesystem-prompt/

    is the original post.

    ReplyDelete
  4. It worked for me in CentOS. I am really grateful. thanks a lot.

    ReplyDelete
  5. thanks for the post :) it's help me :)

    ReplyDelete
  6. @ andrew firestone: no credit is "due" to anyone. This is a function of mount, not someone 's idea after the fact. Repost or not, there's no credit due unless someone is being put on a pedestal here. Im sure most RHEL admins knew about this many years ago, and now "techiegyan.com" wants credit for the order of arguements given to the mount command? Doesnt make any sense.

    ReplyDelete
  7. Wow talk about reviving a dead argument. If I remember this correctly it was a word for work copy of the post linked to (which no longer works). My comment had nothing to do with the process and everything to do with the fact that he copied and pasted someone else's blog and posted it as his own. I understand that you had no way of knowing that since the other blog post (the one linked to) is dead.

    ReplyDelete
  8. thanks a bundle. it works for me.

    ReplyDelete

LinkWithin

Related Posts with Thumbnails