messed up /etc/fstab file. Can't remount root partition!
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
messed up /etc/fstab file. Can't remount root partition!
As I was studying redhat, I had to play round with /etc/fstab file. And the lab I was working on said
'comment out the line that defines the root partition in /etc/fstab.'
So I commented out that line and rebooted.
After I go into the maintanance shell by typing init=/bin/sh in kernel command in GRUB, I type
mount -o remount,rw /
to remount root in read,write to uncomment the line in /etc/fstab.
But it says it can't find / in /etc/fstab. (obviously..I just commented it out)
I can't editthe /etc/fstab directly because it's read only file. So I don't know what to do at this point. According to the lab, remount should have no problem.
Did I screw it up and should I re-install OS?
Sorry about my bad explanation. can't explain very well
Not sure you did exactly what you thought, but I can recommend backing up files BEFORE editing (esp key stuff like fstab)
Anyway, grab the install media, boot from that and select the Rescue option, which should eventually mount the HDD under /mnt/sysimage & you go from there.
(NB: check the mount first; it may be ro or rw; I can't remember off-hand)
Not sure you did exactly what you thought, but I can recommend backing up files BEFORE editing (esp key stuff like fstab)
Anyway, grab the install media, boot from that and select the Rescue option, which should eventually mount the HDD under /mnt/sysimage & you go from there.
(NB: check the mount first; it may be ro or rw; I can't remember off-hand)
Thank you for the reply, Chris.
I did copy my original fstab as /etc/fstab.prelab
But I can't replace my original with backup copy.
I tried to overwrite the original by typing ' cp /etc/fstab.prelab /etc/fstab '
Then it said it can't process because /etc/fstab is read-only file.
According to the lab, remount should have no problem.
The lab is wrong. That (short) form of the mount command will only work if the mountpoint is defined in fstab - which, like you said, it isn't any more.
Issue the command with the device specified as well - just cat fstab to get the correct specification. Something like
Code:
mount -o remount,rw /dev/sda1 /
(might be UUID or label instead - see your fstab).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.