server startup error: "cannot find / in /etc/fstab or /etc/mtab"; /etc/fstab readonly
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
server startup error: "cannot find / in /etc/fstab or /etc/mtab"; /etc/fstab readonly
Dear Ladies and Gentlemen,
Big Problem
I have a server with the last five years of my work running FC4 which I recently shutdown and rebooted as I wanted to relocate it as a result of an office move. The following error appeared on start up: "cannot find / in /etc/fstab or /etc/mtab - remounting root filesystem in read-write mode".
What I am a little ashamed to admit at this point is that I was 'fiddling' around with the fstab file shortly before the 'last' shutdown.
Amateur Self-Diagnosis
While I thought I was being careful, I can only think that somehow I managed to delete the lines in /etc/fstab referring to the '/' and '/boot' mount points. Very careless, I hear you say... and 'to boot', I do not appear to have any backup of /etc/fstab.
The only alternative that I think is feasible is that I interupted the mandatory fsck which follows a reboot after a server has been running for >100 days or so (the server inquestion had been up for 147 days ish), and that this has caused the filesystem to remount read-only.
My troubled server is called 'mother', and a df following an error-riddled restart now looks like this:
[root@mother ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/shm 1915288 104 1915184 1% /dev/shm
/dev/hde1 7937796 4968436 2566132 66% /home
/dev/mapper/vg1-lv1 7937796 4968436 2566132 66% /var/spool/mail
/dev/sdb2 7937796 4968436 2566132 66% /var/lib/pgsql/data
/dev/sda2 7937796 4968436 2566132 66% /var/lib/pgsql/log
df: `/home/public': No such file or directory
[root@daughter by-path]# more /etc/fstab
#
# /etc/fstab
# Created by anaconda on Fri Sep 25 17:26:02 2009
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or vol_id(8) for more info
#
UUID=7fe47370-ddf9-4952-9bf4-be887d1b8d8c /boot ext3 defaults 1 2
/dev/mapper/vg0-lv0 / ext4 defaults 1 1
/dev/mapper/vg1-lv0 /home ext4 defaults 1 2
/dev/mapper/vg0-lv1 swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
#devpts options modified by setup update to fix #515521 ugly way
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
Cut to the Chase
In order to get mother working properly again, my conclusion and best guess from the investigative work above is that I have to add
two lines back into /etc/fstab as follows:
/dev/vg0/lv0 / ext3 defaults 1 1
/dev/sda1 /boot ext3 defaults 1 2
But I'm s**t scared of doing this without some expert guidance for fear of losing everything for good and, besides, I can't seem to
edit /etc/fstab anyway which is now resolutely claiming to be permanently read-only.
Please help!!
Best,
Nick W (Knee-co)
Appendix:
[root@mother ~]# fdisk -l
Disk /dev/hde: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hde1 1 14593 117218241 83 Linux
Disk /dev/sda: 18.1 GB, 18198822912 bytes
255 heads, 63 sectors/track, 2212 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 12 96358+ 83 Linux
/dev/sda2 13 62 401625 83 Linux
/dev/sda3 63 572 4096575 83 Linux
/dev/sda4 573 2212 13173300 f W95 Ext'd (LBA)
/dev/sda5 573 1081 4088511 83 Linux
/dev/sda6 1082 1208 1020096 82 Linux swap / Solaris
/dev/sda7 1209 2212 8064598+ 83 Linux
Disk /dev/sdb: 36.3 GB, 36397645824 bytes
255 heads, 63 sectors/track, 4425 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 1020 8193118+ 83 Linux
/dev/sdb2 1021 4425 27350662+ 83 Linux
Disk /dev/dm-0: 8321 MB, 8321499136 bytes
255 heads, 63 sectors/track, 1011 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/dm-0 doesn't contain a valid partition table
[root@mother ~]#
It's likelly you just accidentally removed the "/" and "/boot" lines. BTW. The reason why your rescue disk failed to mount the partition is likelly because your boot and / partitions are in a LVM. Get your self a liveCD with LVM support and see if you can mount your partitions.
What I think I would do is to make a backup image first. Almost any live-linux-cd will allow you to do that.
Then from in the live-cd I would look at the contents of the different partitions to see which part of the file structure they contain and write it down.
You should then be able to build a fstab file that corresponds to what is on the disk. Copy it in place and try it. If it works great. If not back up and recheck everything and try again.
You can always put the original image back on the disk from the backup image you made in the first step.
Most live-cd's have gparted or similar on them that will allow you to look at the partitions on the drive (BUT DON'T CHANGE THEM) and that may help in getting fstab rebuilt. You may also take a look at the mtab you have. Not sure if the system will automagicly rebuild it for you or not. So you may have to rebuild it too.
Just be sure to make your backups first. Did I mention that you need to make backups first.
guys - thanks so much for the tips - I'm going to have a go with what you suggest once I'm back from a brief work trip abroad. They have given me the confidence to believe that not all is lost!
I'll report back once I've had a go with a live cd.
Gents,
Thanks for posting replies and for pointing me in the right direction.
I manged to boot from a live CD (knoppix) and, once I found which partition /etc/fstab was on, edited it accordingly.
It turns out that I had indeed carelessly deleted the following line the last time I edited the file:
/dev/sda7 / ext3 defaults 0 0
Anyway, 'situation normal' now and blood pressure stable.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.