LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions
User Name
Password
Linux - Distributions This forum is for Distribution specific questions.
Red Hat, Slackware, Debian, Novell, LFS, Mandriva, Ubuntu, Fedora - the list goes on and on... Note: An (*) indicates there is no official participation from that distribution here at LQ.

Notices


Reply
  Search this Thread
Old 08-09-2008, 09:19 PM   #1
John Sorkin
LQ Newbie
 
Registered: Aug 2004
Posts: 10

Rep: Reputation: 0
bad /etc/fstab How can I save changes during fix file system FEDORA


I modified /etc/fstab and now my system will not boot. When I boot, I get an error during file system check. During boot, when I get the error, I have the opportinity to get to root to fix the filesystem.

When I try to fix the problem by editing /etc/fstab, when I try to save changes (:w!) to /etc/fstab e212 can't open file for writing. Any suggestions for how I can save the needed changes?
Thanks,
John
 
Old 08-09-2008, 09:57 PM   #2
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,988

Rep: Reputation: 388Reputation: 388Reputation: 388Reputation: 388
Download slax:

http://www.slax.org/

Burn the cd and boot off it. Login as root and navigate to your fedora partition mount point(/mnt/device_name_for_fedora_partition). Locate your fedora fstab and edit with kwrite. Livecds are the easiest way to deal with this type of problem.
 
Old 08-09-2008, 10:34 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,145

Rep: Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124
The fedora disk 1 in rescue mode should work just as well.
Should be fixable from the prompt you get at error however - you probably just need to remount the root rw.
 
Old 08-09-2008, 11:07 PM   #4
John Sorkin
LQ Newbie
 
Registered: Aug 2004
Posts: 10

Original Poster
Rep: Reputation: 0
I tried to use a live CD with the idea of modifying /etc/fstab. When I tried to mount my hard drive, mount /dev/sda, I get the message that SDA does not appear if /etc/fstab. It appears that the live CD uses its own version of /etc/fstab, and the version used does not recognize my hard drive. I hope you can help me . . .
Thanks,
John
 
Old 08-10-2008, 02:32 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,145

Rep: Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124
You'll have to use the full command - "mount /dev/???? /mnt/somewhere".
You want the fstab on the disk, not /etc/fstab - say /mnt/somewhere/etc/fstab
 
Old 08-10-2008, 02:52 AM   #6
jomen
Senior Member
 
Registered: May 2004
Location: Leipzig/Germany
Distribution: Arch
Posts: 1,687

Rep: Reputation: 55
You would need to mount it to some directory (you can use an existing one such as /mnt or create one for that purpose.
So, instead of just:
mount /dev/sda1
(just /dev/sda is probably a typo and would likely not work anyway - you need to give the number --> /dev/sda1 for example)
you would type:
mount /dev/sda1 /mnt

Also check that the filesystem itself is mounted in read/write mode - the reason for not being able to save your changes could be that the filesystem is mounted read-only.
If that is the case use a command like that to remount a read-only partition as read-write:
mount -o remount,rw /
 
Old 08-11-2008, 11:49 AM   #7
jbb@vcn.com
LQ Newbie
 
Registered: Jul 2008
Location: Buffalo, Wyoming
Posts: 9

Rep: Reputation: 0
To change the installed /etc/fstab you must first have that as the only /etc/fstab in your path. That involves mounting /dev/sda? (where ? is your root partition number) on mnt in the system presented by the install disc repair function, changing the root point to the mounted root partition, and then editing the /etc/fstab in the new root path. You will also need an edit routine so mounting other partitions in a similar manner BEFORE the chroot may be necessary.
In any event, the process is :

% mount /dev/sda? mnt [so there is no mistake where it is mounted you leave off the /]
[mount whatever else you will need for editing below mnt/ ie. mount /dev/sdc9 mnt/usr, or whatever your needs are]
% cd mnt
% ls -aFC [to check you have the correct discs and partitions mounted under mnt do a few ls of what you think you mounted]
% chroot .
% cp etc/fstab etc/fstab.orig
% [edit] etc/fstab [of course saving your changes]
% reboot [or exit or whatever it takes to get back to booting the installed system]

Provided that you have made the correct changes to fstab, you will then be able to access a properly mounted installation when booting the installed disc.

While editing fstab pay special attention to spelling and correct paths.

Last edited by jbb@vcn.com; 08-11-2008 at 11:50 AM.
 
Old 01-25-2009, 07:28 AM   #8
quazzmarsh
LQ Newbie
 
Registered: Jan 2009
Posts: 1

Rep: Reputation: 0
Edited etc\fstab and now Im crying

Quote:
Originally Posted by jomen View Post
You would need to mount it to some directory (you can use an existing one such as /mnt or create one for that purpose.
So, instead of just:
mount /dev/sda1
(just /dev/sda is probably a typo and would likely not work anyway - you need to give the number --> /dev/sda1 for example)
you would type:
mount /dev/sda1 /mnt

Also check that the filesystem itself is mounted in read/write mode - the reason for not being able to save your changes could be that the filesystem is mounted read-only.
If that is the case use a command like that to remount a read-only partition as read-write:
mount -o remount,rw /
My own experience:

Saved by the forum 4sure.

Fedora 9 starts with an error, exits the boot process and tells u to enter root password.

Tried to edit /etc/fstab with "vi" but I was on readonly mode.

After hours of Ctrl+T and Ctrl+v on my Google Chrome, I realised that i need to

- remount the root directory /

very easy thanks man :

mount -t ext3 /dev/sda1 / -o remount,rw
 
Old 03-22-2009, 03:36 PM   #9
FizzerJE
LQ Newbie
 
Registered: Dec 2004
Posts: 12

Rep: Reputation: 1
Apologies for bring up an old thread but just wanted to thank this man...

Quote:
Originally Posted by jomen View Post
If that is the case use a command like that to remount a read-only partition as read-write:
mount -o remount,rw /
Being a noobie and stupidly labelled one of my partitions wrong I was stuck at 'an error occurred during file system check'

Banging my head trying to edit fstab

Middle of downloading SLAX on my poor 512kb connection 1hr 10mins, didn't realise that there were such updates that needed newer 2.6 live cd, like mounting LVM partions.

Also everyone is saying to download a livecd to edit fstab in the posts I read.. WHY!! Above is such a simple command..

Well thanks mate, seems simple BUT It took me ages to find this post. Hope it helps someone else...
 
Old 05-09-2009, 05:33 AM   #10
zatricky
LQ Newbie
 
Registered: Apr 2009
Posts: 3

Rep: Reputation: 1
Post

Quote:
Originally Posted by jomen View Post
mount -o remount,rw /
I'd added relatime, reldiratime but my kernel isn't set up to support the reldiratime option. Thus, on boot, everything was read only.

I worked out from this how to do mine:
Code:
mount -o remount,defaults /
Thank you very much, Jomen.
 
Old 07-22-2009, 04:04 PM   #11
nico45FR
LQ Newbie
 
Registered: Jul 2009
Posts: 1

Rep: Reputation: 0
Really thank a lot !
the only way to recover my fstab was your statement to recover RW mode on my /.

Quote:
Originally Posted by quazzmarsh View Post
My own experience:
mount -t ext3 /dev/sda1 / -o remount,rw
 
Old 06-25-2012, 03:43 PM   #12
poettone
LQ Newbie
 
Registered: Jan 2005
Location: Midwest
Distribution: Debian
Posts: 6

Rep: Reputation: 0
Wink Excellent!

I wanted to express my gratitude as I know this is a bit dated, but I found the above to solve my issue I was having due to some labels specified in the fstab file but was unable to write them. I had no idea that / was not mounted up already, and I spent about an hour before I found this and it worked like a Charm..

Thank You!!
 
  


Reply

Tags
edit, fstab, readonly



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
File system has gone bad, can no longer boot kcor Slackware 1 09-10-2006 12:42 PM
regarding bad blocks in extended file system rajesh_b Programming 1 06-13-2006 12:38 PM
boot/System.map: Bad file descriptor pixie Fedora 16 03-01-2005 12:19 PM
fstab can't find a file system fdisk can rharvey@cox Linux - Hardware 1 06-02-2004 08:36 PM
Misspelling in fstab, can't write to file system kristjan Linux - Newbie 4 01-08-2004 06:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions

All times are GMT -5. The time now is 10:58 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
Open Source Consulting | Domain Registration