LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Rescue problem - How do I edit /etc/fstab without vi? (https://www.linuxquestions.org/questions/linux-software-2/rescue-problem-how-do-i-edit-etc-fstab-without-vi-217293/)

mwarren2 08-13-2004 04:45 PM

Rescue problem - How do I edit /etc/fstab without vi?
 
I had a corrupt file system problem, and had to run fsck manually. (Debian Linux).
In order to do so, I had to stop the system mounting the various /dev/hda5, /dev/hda6,/dev/hd7 because otherwise fsck said it couldn't repair them because they were in use, not even with the -f option.

So I changed /etc/fstab, and gated with # the three lines that mounted them.
Big mistake, as it now turns out.
I managed to repair the file system manually, but...... I can't put anything back as it was.

I can now boot up to a certain point, where the system asks me for the root password for maintenance. I have the root file system mounted, but nothing else. This means that I can roam about the root file system, and I can cat /etc/fstab, but without vi I can't put it back as it was.

How can I edit /etc/fstab to put everything back to normal? - I only have the use of programmes in /bin and /sbin, none of which enable me to edit.

I have tried creating a rescue floppy disk from Windows, which is working normally, so I have access to the web (hence this post) and the rescue floppy correctly started the system, but rescueing the root disk from the floppy just brought me to the same point as booting normally. i.e. no editing programmes.


Any help appreciated, I see to be in a big hole here.

Tinkster 08-13-2004 04:58 PM

You could cat it ...
then echo individual lines into /etc/fstab.new
echo "blurb blurb .... 1 1" > /etc/fstab.new
echo "blurb2 blurb2 .... 1 1" >> /etc/fstab.new

And once it looks as desired, cp it over? :)

Or, if your machine is like mine, use sed or
awk to make life easier ;)


Cheers,
Tink

mwarren2 08-13-2004 05:01 PM

Thanks, that looks like what I needed.

I'll give it a try.

gplacek 08-13-2004 05:02 PM

you mean the / or the /root dir? vi should be in your /bin unless its some /bin thats mounted on a floppy? So you are saying that you can not boot to any of your linux partitions, just off a floppy? /bin/vi and /bin/ed are in my /bin. It sounds like your /dev/hd? is mounted in your /. I dont know much about Debain, I've never used it. It seems like your saying you can boot your system? There should be editors in /bin. I know there is in mine. Tell us more about what you are trying to do. Just edit your /etc/fstab, or start x11? From wht you say it sounds like you have access to your system, and not the network?

gplacek 08-13-2004 05:03 PM

opps ... heh heh .. disreguard all that I wrote.. heh heh :-)

Tinkster 08-13-2004 05:11 PM

Quote:

Originally posted by mwarren2
Thanks, that looks like what I needed.

I'll give it a try.

Pleasure mate, keep us posted!


Cheers,
Tink

mwarren2 08-13-2004 05:38 PM

I'm posting this from Linux - my problem is solved and everything seems back to normal.
Thanks for the help.

I see that I have sed and awk in my /bin folder, but in the event I used echo like you suggested.

Thanks.

Tinkster 08-13-2004 05:46 PM

Congratulations! :)

Cheers,
Tink


All times are GMT -5. The time now is 06:25 PM.