LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Distributions (https://www.linuxquestions.org/questions/linux-distributions-5/)
-   -   bad /etc/fstab How can I save changes during fix file system FEDORA (https://www.linuxquestions.org/questions/linux-distributions-5/bad-etc-fstab-how-can-i-save-changes-during-fix-file-system-fedora-661693/)

John Sorkin 08-09-2008 09:19 PM

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

kilgoretrout 08-09-2008 09:57 PM

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.

syg00 08-09-2008 10:34 PM

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.

John Sorkin 08-09-2008 11:07 PM

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

syg00 08-10-2008 02:32 AM

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

jomen 08-10-2008 02:52 AM

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 /

jbb@vcn.com 08-11-2008 11:49 AM

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.

quazzmarsh 01-25-2009 07:28 AM

Edited etc\fstab and now Im crying
 
Quote:

Originally Posted by jomen (Post 3242395)
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

FizzerJE 03-22-2009 03:36 PM

Apologies for bring up an old thread but just wanted to thank this man...

Quote:

Originally Posted by jomen (Post 3242395)
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...

zatricky 05-09-2009 05:33 AM

Quote:

Originally Posted by jomen (Post 3242395)
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.

nico45FR 07-22-2009 04:04 PM

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 (Post 3420553)
My own experience:
mount -t ext3 /dev/sda1 / -o remount,rw


poettone 06-25-2012 03:43 PM

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!!


All times are GMT -5. The time now is 07:31 PM.