Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Problem with changes to fstab !

Posted on 2004-04-04
13
Medium Priority
?
913 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 3
  • +2
13 Comments
 
LVL 12

Assisted Solution

by:stefan73
stefan73 earned 80 total points
ID: 10755408
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
ID: 10755505
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 392 total points
ID: 10755582
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
Implementing Azure Infrastructure Exam 70-533

This course is designed to familiarize and instruct students in the content that is covered by Microsoft Exam 70-533, Implementing Microsoft Azure Solutions. It focuses on all the November 2016 objective domain topics.

 
LVL 4

Expert Comment

by:bobgunzel
ID: 10755597
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
ID: 10755629
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 80 total points
ID: 10755861
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
 
LVL 20

Expert Comment

by:Gns
ID: 10755877
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
ID: 10756144
>>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
ID: 10756219
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
ID: 10756312
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
ID: 10756356
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
ID: 10756452
> >>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
ID: 10758876
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

CHALLENGE LAB: Troubleshooting Connectivity Issues

Goal: Fix the connectivity issue in the lab's AWS environment so that you can SSH into the provided EC2 instance.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
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.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

704 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