Problem with changes to fstab !

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 !

Who is Participating?
Alf666Connect With a Mentor Commented:
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.
stefan73Connect With a Mentor Commented:
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=.

aot2002Author Commented:
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 ????
Never miss a deadline with

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

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
URGL !!! Sorry bobgunzel, but I have to *strongly* disaprove your comment !!!


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.
GnsConnect With a Mentor Commented:
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
Oh, and perhaps you could jot down the exact error you get when you try booting, and share with us?-)

-- Glenn
aot2002Author Commented:
>>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
I'll post as soon as i test this out in 2hrs !

Thanks for the quick answers !
alf666, because the output from cat is fed through grep before being piped back to fstab what you fear will not occur.

Bob Gunzel

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 ? :-)

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.
> >>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
aot2002Author Commented:
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
All Courses

From novice to tech pro — start learning today.