LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   trying to recover deleted /etc/fstab (https://www.linuxquestions.org/questions/linux-newbie-8/trying-to-recover-deleted-etc-fstab-757028/)

miteshpant 09-22-2009 12:16 PM

trying to recover deleted /etc/fstab
 
hi ,

I have deleted /etc/fstab file in RHEL5
tried to boot the system in single user mode and emergency mode
unable to edit the file and the file is missing , cannot create it, as i am loggged in as read only mode ,

tried to run mount -o remount,rw /dev/sda
but issue is not resolved
please suggest

adamk75 09-22-2009 12:37 PM

/dev/sda is the entire disk. Do you know the specific partition that is / ?

Adam

camorri 09-22-2009 12:42 PM

Have you got a live CD you can boo the system with? If not, I would suggest you get a copy of Knoppix. It will boot most systems. The partitions on the drives will show up as icons on the desktop. They can be mounted, at first that will be read only mode. You can change that to read write mode.

Then you can create a new fstab file to get you started.

You can create entries like this...

Quote:

/dev/sda1 / ext3 relatime 1 1
/dev/sda5 /home ext3 relatime 1 2
I don't know your partitioning information, or what file systems you have. Edit the ext3 file to the correct file system. I think you only need the root and home partitions to boot.

A live bootable CD should save your system.

miteshpant 09-22-2009 12:50 PM

thanks for the replies
my boot partition is on sda3 and i do not have the live cd
i wanted to edit the fstab file while logging on to single user mode is this possible , without a cd .

j_jerry 09-22-2009 01:10 PM

you need permissions; try sudo

miteshpant 09-22-2009 01:18 PM

i am already running as root by using su -

j_jerry 09-22-2009 02:08 PM

Quote:

Originally Posted by miteshpant (Post 3693170)
i am already running as root by using su -

Are you running on the same distro whose fstab is lost ?

Can't you create an /etc/fstab? Tell us how you've tried

miteshpant 09-22-2009 02:18 PM

yes iam on the same distro
first i tried to edit /etc/fstab in single user mode
it denied doing coz of read only mode
then i tried to run mount -o remount,rw /
it give me the following error
warning : can't open /etc/fstab : No such file or directory
mount: can't find / in /etc/fstab or /etc/mtab

i am running these commands after running su -

j_jerry 09-22-2009 02:29 PM

first be root by su root , then create an /etc/fstab file

miteshpant 09-22-2009 02:34 PM

i am already root

j_jerry 09-22-2009 02:39 PM

did you try to create an /etc/fstab ?

This is an example of fstab, edit it

Code:

/dev/hda2          /          ext2          defaults          1 1
/dev/hdb1        /home        ext2        defaults        1 2
/dev/cdrom        /media/cdrom        auto        ro,noauto,user,exec        0 0
/dev/fd0        /media/floppy        auto        rw,noauto,user,sync        0 0
proc        /proc        proc        defaults        0 0
/dev/hda1        swap        swap        pri=42        0 0


Quakeboy02 09-22-2009 02:39 PM

Try remounting the root drive as read/write instead of read only.

miteshpant 09-22-2009 02:43 PM

thaty is what i am trying to do , iam trying to mount rw , passed the arguments from kernel ,

still not sucessfull
jerry i have already run te commands
but unable to edit the file

Quakeboy02 09-22-2009 02:44 PM

What command did you run, and what was the response? It would probably be this one:
Code:

mount -n -o remount,rw /

miteshpant 09-22-2009 02:47 PM

still
warning : can't open /etc/fstab : No such file or directory
mount: can't find / in /etc/fstab or /etc/mtab


All times are GMT -5. The time now is 10:19 PM.