LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   FSTAB (https://www.linuxquestions.org/questions/linux-newbie-8/fstab-747185/)

balaji2219 08-13-2009 12:32 AM

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.

mobinskariya 08-13-2009 12:45 AM

just try by giving the absolute path of the command..

vishesh 08-13-2009 12:58 AM

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

balaji2219 08-13-2009 02:45 AM

hi
 
Quote:

Originally Posted by vishesh (Post 3641430)
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.

mobinskariya 08-13-2009 02:49 AM

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

vishesh 08-13-2009 05:13 AM

Dear
try to remount to / in rw mode

mount -o rw,remount /

Now try /bin/cp

thnks

catkin 08-13-2009 05:18 AM

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

mount -o remount,rw /

shahz 08-13-2009 06:12 AM

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.

mushroomboy 08-13-2009 06:40 AM

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


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