LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 02-15-2013, 01:12 AM   #1
LinuxN00bee
LQ Newbie
 
Registered: Feb 2013
Posts: 2

Rep: Reputation: Disabled
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
 
Old 02-15-2013, 02:12 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,417

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
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)
 
Old 02-15-2013, 02:19 AM   #3
LinuxN00bee
LQ Newbie
 
Registered: Feb 2013
Posts: 2

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by chrism01 View Post
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.
 
Old 02-15-2013, 02:44 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,417

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
Did you do what I said ie reboot with install media etc?
 
Old 02-15-2013, 04:32 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,999

Rep: Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219
Quote:
Originally Posted by LinuxN00bee View Post
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).

Last edited by syg00; 02-15-2013 at 04:34 AM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] how can i remount root filesystem as read/write after modify readonly-root file jcwkyl Linux - Newbie 3 12-21-2010 11:40 PM
messed up my fstab file dave`2005 Linux - Newbie 6 03-12-2006 12:36 AM
Remount using fstab entries keimdf Linux - Newbie 5 12-22-2004 07:48 AM
messed up my fstab file aditya Linux - Newbie 1 10-07-2002 01:49 AM
remount root to new partition khutze Linux - Software 0 08-20-2002 06:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration