Solved

Problem with changes to fstab !

Posted on 2004-04-04
13
905 Views
Last Modified: 2012-06-22
im not sure if the results are from me making a change to /etc/fstab or not
but i added a line
LABEL=/home       /home           ext3    defaults,usrquota,grpquota 1 2

trying to setup quotas !

i went to reboot !
now i cannot get back into the machine !
i currently dont have specific error messages but i made a linux rescue cdrom and im ready to go in the office tommorrow to find out what exactly happened ?

IS there any chance someone can tell me how to mount the harddrive and edit my file again and then reboot the machine !
please help !


MORE POINTS IF IT WORKS WILL BE AWARDED !
0
Comment
Question by:aot2002
  • 3
  • 3
  • 3
  • +2
13 Comments
 
LVL 12

Assisted Solution

by:stefan73
stefan73 earned 20 total points
Comment Utility
Hi aot2002,
I think you made a mistake with the syntax. A typical fstab looks like this:

# <device>      <mountpoint>    <filesystemtype><options>  <dump> <fsckorder>

/dev/hdb5      /                  ext2           defaults             1       1
/dev/hdb2      /home              ext2           defaults             1       2

You don't have a proper mapping to some /dev device and leave out the LABEL=.

Cheers,
Stefan
0
 
LVL 1

Author Comment

by:aot2002
Comment Utility
understandable i just want to delete that one line now to get the system back up
My question is how can i from a rescue cdrom,
mount the drive and access the /etc/fstab file ????
0
 
LVL 9

Accepted Solution

by:
Alf666 earned 98 total points
Comment Utility
Yes. Exactly.

Run a rescue CD or floppy.
mount /dev/hda1 /mnt (probably hda1. Just to make sure, you can launch "fdisk /dev/hda", type the command "p", and you'll see what partitions you have).

Then, "vi /mnt/etc/fstab".
Then, umount /mnt (important)

Then, reboot.
0
 
LVL 4

Expert Comment

by:bobgunzel
Comment Utility
Mount the drive at a preferably empty directory, f.i. /tmp:
mount /dev/hda1 /tmp
cd /tmp/etc
cat fstab|grep -v LABEL>fstab

That should do it.

Bob Gunzel
0
 
LVL 9

Expert Comment

by:Alf666
Comment Utility
URGL !!! Sorry bobgunzel, but I have to *strongly* disaprove your comment !!!

DO NOT DO THIS !

cat fstab | grep -v LABEL > fstab

will only have one effect : loosing your fstab.

The shell will open the fstab file O_WRONLY|O_TRUNC before launching whatever process. This means that the fstab file will be truncated to a size of zero before even getting the chance to be read by the cat command.

Plus, even if using a temporary file, his config line would be lost. So /home would not get a chance to mount at next boot.

Please, test commands before instructing users to use them. You could f*** up their systems for good.
0
 
LVL 20

Assisted Solution

by:Gns
Gns earned 20 total points
Comment Utility
What distro is this?
Some distros (like RH9 for example) will try mount up the "system image" somewhere on the rescueboots filesystem. After booting, look at it with the "mount" command, doublecheck with "fdisk -l" what partitions you have etc.
Alf666 has already given you advice to this effect... And his advice about Bobs advice should be heeded!

Perhaps you didn't e2label your home partition correctly?
You might have the e2label command so that you can check it out with
e2label /dev/hdXY
(where X and Y are appropriate for your /home partition) ... and if unset (or not "/home")
Or you might have labeled the wrong partition? so that perhaps you don't have a label "/" on the root filesystem anymore?
Fixing the labels would be rather simple
e2label /dev/hdXY the_label_you_want

... But looking at/perhaps changing /etc/fstab should perhaps be your first prio. Are you familiar with vi?

-- Glenn
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 20

Expert Comment

by:Gns
Comment Utility
Oh, and perhaps you could jot down the exact error you get when you try booting, and share with us?-)

-- Glenn
0
 
LVL 1

Author Comment

by:aot2002
Comment Utility
>>What distro is this?
Redhat 9

>>But looking at/perhaps changing /etc/fstab should perhaps be your first prio. Are you familiar >>with vi?

Yes im proficient in VI !
its my stupidty changing the fstab i was following some docs on the web and ran into one which was written incorrectly, i shouldve known better !
i will be going in here about 2 hrs into the office.


>>>>>Comment from Alf666
THANKS FOR CHECKING THE CAT STATEMENT !!!! YOUR AUSOME !
I'll post as soon as i test this out in 2hrs !


Thanks for the quick answers !
0
 
LVL 4

Expert Comment

by:bobgunzel
Comment Utility
alf666, because the output from cat is fed through grep before being piped back to fstab what you fear will not occur.

Bob Gunzel
0
 
LVL 9

Expert Comment

by:Alf666
Comment Utility
Bob,

I'd very much like to know what kind of shell you're using. The order of the command and the time they take for completion is totally irrelevant.

The Bourne shell (sh), and therefore the bash will open files needed by redirections BEFORE forking/exec'ing whatever commands they have to evaluate. I do not want to state a mistake, but I suspect the the csh shells family work the same.

The reason for this is that, if the redirections cannot be made (like the user does not have the proper access rights, or the outpur dir/file does not exist), the commands will never get executed.

So, YES, what I fear will occur.

May I kindly suggest backing up your fstab before trying the same command on your most important production system Bob ? :-)


0
 
LVL 4

Expert Comment

by:bobgunzel
Comment Utility
I'm using bash. I use this method quite often to filter junk from log files and so far I have not ended up with a zero-lenght file.
0
 
LVL 20

Expert Comment

by:Gns
Comment Utility
> >>What distro is this?
> Redhat 9
Good, then perhaps (with a little luck) you'll not need "hunt" for it:-). OTOH, if the fstab is really hosed, you might endup needing to at least mount the partition holding /etc manually. You might do that by label like:
mkdir /mnt/myroot
mount LABEL=/ /mnt/myroot -o rw
... assuming the label is still OK. Multiple mounts is ok, so you might consider doing this anyway, even if it's already mounted (if you feel to "lazy" to check:-)

> >>But looking at/perhaps changing /etc/fstab should perhaps be your first prio. Are you familiar >>with vi?
> Yes im proficient in VI !
Good, then (of course) just edit /mnt/sysimage/etc/fstab or /mnt/myroot/etc/fstab (or wherever you get it mounted).

> its my stupidty changing the fstab...
We've all done less than thought-through things in the past... Formatted the wrong drive, accidentally unbound the wrong raidset... You're in a select club:-). And don't worry, you'll probably get this sorted real easy.

Bob, Alf666 is right... not only from a theoretical standpoint... I can vouch that it is so. One does one such misstake in life, hopefully not twice (I'm not counting the time when I did a tar-copy ("tar...| (cd somewhere; tar x...") where the cd errored out, making me read and write the same hierarchy... because that strictly isn't the same thing:-). Thankfully my incarnation is far in the past.
I don't know if Alf666 mentioned it, but there is one more thing: grep -v LABEL will remove all filesystems mounted by LABEL from fstab. This includes (by default) the root filesystem on a RH9. Not good;-).

-- Glenn
0
 
LVL 1

Author Comment

by:aot2002
Comment Utility
Well, guess what !
When i went in it was sitting at the prompt for maintenence mode !
so i typed my password and then edited the fstab and rebooted everything good to go !

thanks for the help guys
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now