Link to home
Start Free TrialLog in
Avatar of aot2002
aot2002

asked on

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 !


MORE POINTS IF IT WORKS WILL BE AWARDED !
SOLUTION
Avatar of stefan73
stefan73
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aot2002
aot2002

ASKER

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 ????
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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 !!!

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.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Oh, and perhaps you could jot down the exact error you get when you try booting, and share with us?-)

-- Glenn
Avatar of aot2002

ASKER

>>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 !
alf666, because the output from cat is fed through grep before being piped back to fstab what you fear will not occur.

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


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
Avatar of aot2002

ASKER

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