LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 08-13-2009, 01:32 AM   #1
balaji2219
LQ Newbie
 
Registered: Jan 2009
Posts: 16

Rep: Reputation: 0
FSTAB


Hi all,

I m using RHEL AS5, by mistake I deleted the fstab file and restarted the machine, and when I am trying to restore backup file in the single user mode it is not allowing me to do so.

#cp /etc/fstab.orig /etc/fstab

cp: can not create regular file 'etc/fstab'

when I gave command whoami it says command not found and when I tried su - it says seesion could not be opened.

can anyone help me please to avoid formatting.

Regards,


Balaji.
 
Old 08-13-2009, 01:45 AM   #2
mobinskariya
Member
 
Registered: Sep 2007
Location: Kerala, India
Distribution: ubuntu 10.04
Posts: 367

Rep: Reputation: 55
just try by giving the absolute path of the command..
 
Old 08-13-2009, 01:58 AM   #3
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 661

Rep: Reputation: 66
first ensure, where are you using pwd
#pwd
/
Now remember that, command are separate executable files that present in directory specified by $PATH variable. So since $PATH variable in not in use in single user mode, specify absolute path of file.

Now ensure that / is mounted, by using 'mount' command.

suppose to execute cp command
write
/bin/cp /etc/fstab.org /etc/fstab

thnks
 
Old 08-13-2009, 03:45 AM   #4
balaji2219
LQ Newbie
 
Registered: Jan 2009
Posts: 16

Original Poster
Rep: Reputation: 0
hi

Quote:
Originally Posted by vishesh View Post
first ensure, where are you using pwd
#pwd
/
Now remember that, command are separate executable files that present in directory specified by $PATH variable. So since $PATH variable in not in use in single user mode, specify absolute path of file.

Now ensure that / is mounted, by using 'mount' command.

suppose to execute cp command
write
/bin/cp /etc/fstab.org /etc/fstab

thnks

Thanks Guys

I tried that also, it is not allowing me to write anything in any partition, it says read only file system, I wonder why it is saying session could not be opened when I give su -.

Also last time when I had deleted one line in fstab, just to check how single user mode works, it allowed me to restore the backup file.
 
Old 08-13-2009, 03:49 AM   #5
mobinskariya
Member
 
Registered: Sep 2007
Location: Kerala, India
Distribution: ubuntu 10.04
Posts: 367

Rep: Reputation: 55
try editing the grub and mount it as rw.may b it is some sort of unconventional way..i wont guarentee nything.try at ur own risk

Last edited by mobinskariya; 08-13-2009 at 03:50 AM.
 
Old 08-13-2009, 06:13 AM   #6
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 661

Rep: Reputation: 66
Dear
try to remount to / in rw mode

mount -o rw,remount /

Now try /bin/cp

thnks

Last edited by vishesh; 08-13-2009 at 07:17 AM.
 
Old 08-13-2009, 06:18 AM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
You need the remount option to remount / as read+write:

mount -o remount,rw /
 
Old 08-13-2009, 07:12 AM   #8
shahz
Member
 
Registered: Sep 2006
Location: Quetta, Pakistan
Distribution: RHEL, Ubuntu, Fedora
Posts: 368

Rep: Reputation: 29
did you try in rescue mode to recover the fstab file. and in rescue mode also chroot to /mnt/sysimage/. and then try to recover.
 
Old 08-13-2009, 07:40 AM   #9
mushroomboy
Member
 
Registered: Jan 2006
Distribution: Debian Testing ALWAYS!!!
Posts: 363

Rep: Reputation: 43
You could also just try booting into another OS and making your own fstab? Maybe a live CD could help?
 
  


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
HAL, and fstab, I want my old fstab back thllgo Linux - Server 2 08-10-2007 11:11 AM
Suse won't boot after fstab changes - fstab not editable baking-a-77 Linux - Newbie 10 06-02-2007 11:51 AM
fstab problem: mount: can't find dvd in /etc/fstab or /etc/mtab Nikon01 Slackware 5 11-17-2006 07:15 AM
(version 5.1 chapter 08 fstab) vs (man fstab) rgiggs Linux From Scratch 2 06-03-2004 06:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:24 PM.

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