LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 09-22-2009, 12:16 PM   #1
miteshpant
LQ Newbie
 
Registered: May 2009
Posts: 24

Rep: Reputation: 0
Question 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
 
Old 09-22-2009, 12:37 PM   #2
adamk75
Senior Member
 
Registered: May 2006
Posts: 3,091

Rep: Reputation: 396Reputation: 396Reputation: 396Reputation: 396
/dev/sda is the entire disk. Do you know the specific partition that is / ?

Adam
 
Old 09-22-2009, 12:42 PM   #3
camorri
Senior Member
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 14.1
Posts: 4,845

Rep: Reputation: 431Reputation: 431Reputation: 431Reputation: 431Reputation: 431
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.
 
Old 09-22-2009, 12:50 PM   #4
miteshpant
LQ Newbie
 
Registered: May 2009
Posts: 24

Original Poster
Rep: Reputation: 0
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 .

Last edited by miteshpant; 09-22-2009 at 12:52 PM.
 
Old 09-22-2009, 01:10 PM   #5
j_jerry
Member
 
Registered: Sep 2009
Distribution: fedora 11
Posts: 318

Rep: Reputation: 46
you need permissions; try sudo
 
Old 09-22-2009, 01:18 PM   #6
miteshpant
LQ Newbie
 
Registered: May 2009
Posts: 24

Original Poster
Rep: Reputation: 0
i am already running as root by using su -
 
Old 09-22-2009, 02:08 PM   #7
j_jerry
Member
 
Registered: Sep 2009
Distribution: fedora 11
Posts: 318

Rep: Reputation: 46
Quote:
Originally Posted by miteshpant View Post
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
 
Old 09-22-2009, 02:18 PM   #8
miteshpant
LQ Newbie
 
Registered: May 2009
Posts: 24

Original Poster
Rep: Reputation: 0
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 -
 
Old 09-22-2009, 02:29 PM   #9
j_jerry
Member
 
Registered: Sep 2009
Distribution: fedora 11
Posts: 318

Rep: Reputation: 46
first be root by su root , then create an /etc/fstab file
 
Old 09-22-2009, 02:34 PM   #10
miteshpant
LQ Newbie
 
Registered: May 2009
Posts: 24

Original Poster
Rep: Reputation: 0
i am already root
 
Old 09-22-2009, 02:39 PM   #11
j_jerry
Member
 
Registered: Sep 2009
Distribution: fedora 11
Posts: 318

Rep: Reputation: 46
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

Last edited by j_jerry; 09-22-2009 at 02:40 PM.
 
Old 09-22-2009, 02:39 PM   #12
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,245

Rep: Reputation: 121Reputation: 121
Try remounting the root drive as read/write instead of read only.
 
Old 09-22-2009, 02:43 PM   #13
miteshpant
LQ Newbie
 
Registered: May 2009
Posts: 24

Original Poster
Rep: Reputation: 0
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
 
Old 09-22-2009, 02:44 PM   #14
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,245

Rep: Reputation: 121Reputation: 121
What command did you run, and what was the response? It would probably be this one:
Code:
mount -n -o remount,rw /
 
Old 09-22-2009, 02:47 PM   #15
miteshpant
LQ Newbie
 
Registered: May 2009
Posts: 24

Original Poster
Rep: Reputation: 0
still
warning : can't open /etc/fstab : No such file or directory
mount: can't find / in /etc/fstab or /etc/mtab
 
  


Reply

Tags
help


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
how to recover deleted folder 124vikas.dange@gmail.com Linux - Software 1 09-09-2009 07:21 AM
How do I recover a rm deleted folder? CrownAmbassador Linux - Desktop 13 02-16-2009 03:54 AM
I have deleted rc.d from /etc. How can I recover it? rupeshukla Linux - Newbie 5 07-01-2008 04:21 AM
Recover deleted files? subaruwrx Linux - Newbie 8 06-04-2004 08:47 AM
Recover deleted files markdw Linux - General 1 12-07-2001 04:08 PM


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

Main Menu
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