LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices



Reply
 
Search this Thread
Old 02-24-2010, 09:15 AM   #1
chuikingman
Member
 
Registered: Aug 2009
Posts: 86

Rep: Reputation: 16
edit/write the /etc/fstab file


Hi,
I comment out some vol group in fstab accidentally.
I also comment the swap space in /etc/fstab
But I cannot edit /remove it back by using vi /etc/fstab again in init 1 and init 6 .
The file system /etc/fstab is read -only . I cannot chmod .....
What can I do in order to recover it
Please advice ....

I paste the console screen in here .
Attached Images
File Type: jpg fstab_err.JPG (122.6 KB, 16 views)
File Type: jpg fstab_err1.JPG (165.5 KB, 11 views)
File Type: jpg fstab_err2.JPG (109.4 KB, 14 views)
 
Old 02-24-2010, 09:48 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729
I am totally confused..

First, how did you put comments into the file if it was read-only? (Or--what were you doing when this accidentally happened?)

Second, why can you not use chmod to change the permissions? (You would have to be root user to do this). What exactly happens if you try to change permissions?

Finally, please put code snippets, terminal sessions, etc. directly into your posts (cut and past), and use [CODE] tags. The screenshots make it harder for the reader to follow the bread crumbs.
 
Old 02-24-2010, 11:31 AM   #3
z-vet
Member
 
Registered: Aug 2004
Location: Israel
Distribution: Ubuntu 10.10
Posts: 271

Rep: Reputation: 34
Use some LiveCD like Knoppix or Ubuntu and edit the file from there.
 
1 members found this post helpful.
Old 02-24-2010, 07:47 PM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
If you're logged in as root, you can insist that it writes the vi/vim changes to disk.
The std way to save+exit is

:x

although some people use the longer method

:wq

To force the changes to be saved, even on read-only file, add '!' thusly:

:x!
 
Old 02-25-2010, 01:04 AM   #5
chuikingman
Member
 
Registered: Aug 2009
Posts: 86

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by pixellany View Post
I am totally confused..

First, how did you put comments into the file if it was read-only? (Or--what were you doing when this accidentally happened?)

Second, why can you not use chmod to change the permissions? (You would have to be root user to do this). What exactly happens if you try to change permissions?

Finally, please put code snippets, terminal sessions, etc. directly into your posts (cut and past), and use [CODE] tags. The screenshots make it harder for the reader to follow the bread crumbs.
Hi,
The whole event is :
In normal state , I use vi to edit /etc/fstab and comment out
some vol group include the swap space .
Afterward , I reboot the system.
Then the red hat linux cannot boot up like the screen I attach .
I cannot change the /etc/fstab any more by vi as it is read-only now .
I cannot chmod to /etc/fstab .There is no effect .
I use the console and I cannot copy the log out ...
I can only paste the console screen output ...
Please aadvice how I can change back the /etc/fstab file as
now , I cannot boot up the red hat linux successfuly .....
Please advice .....
 
Old 02-25-2010, 01:28 AM   #6
mesiol
Member
 
Registered: Nov 2008
Location: Lower Saxony, Germany
Distribution: CentOS, RHEL, Solaris 10, AIX, HP-UX
Posts: 731

Rep: Reputation: 137Reputation: 137
Hye,

try
Code:
mount -o remount,rw /
to get read/write access to your root filesystem. Could you please post the output of
Code:
mount
.
 
  


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
Edit fstab file to make USB disk writable. AGazzaz Linux - General 2 07-10-2008 06:18 PM
Edit fstab to write to fat drive AGazzaz Linux - Laptop and Netbook 5 01-07-2008 03:31 PM
edit the fstab file wannaluvlinux Linux - Software 1 09-27-2004 02:37 PM
How do you edit the /etc/fstab file in RedHat9.0 nat22784 Linux - General 2 02-19-2004 07:24 PM
How do I change "fstab" to Write/Edit Mode? sharathkv Linux - Newbie 4 07-29-2003 08:52 AM


All times are GMT -5. The time now is 09:36 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration