HELP WITH FSTAB
I have encountered a very serious and unthinkable proble with Linux... i had rebooted my server as always on the weenkend. and it wouldn't boot up..
Says that /etc/fstab has problems .. and gets into the maintenance mode where i can go in and see that /etc/fstab is actually 0 bytes. there is no information on the partitions that i had in the disk and wouldn't mount anything...
i am lost here, i am not an expert and can't write my own fstab... it might be relatively easy for some but i am not at all that level..
Could some one send some information how to get my self back into normal booting process (whcih i feels is not that simple as linux cannot even determine which is the root partition)
i am running this server as my site also and had arnd 900 MB of data which is crucial and there is no backup (except for a backup on the same Server).
any comments or help will be appreciated
Well, you must of course know what partition is used for what. After that, writing an fstab isn't hard at all, I promise you. Even my grandmother could do it. Don't worry, though; the data on the actual other partitions won't be lost.
It's a better question why your fstab was truncated in the first hand. Why are you rebooting this server at all, and how do you accomplish that?
well this server has an XP partition also and mostly on weekends i logon to this Xp and download some songs to make the CDs... nothing very out of ordinary that i am doing on this box..
as for the name of the partions.. i am almost certain that i know all./. does it make a difference in the sequence of the partitions ??
The sequence? What do you mean?
What you can do is this. If you only have one hard drive, run "fdisk -l /dev/hda" to see what partitions you have, and then mount them each in turn somewhere to see what is on them.
Then just add them to your /etc/fstab along with where you actually want them to be mounted. The format for /etc/fstab is really simple. Each line follows the following syntax:
device mntpoint fstype options dfreq fsckseq
device is the device that the filesystem resides on, like /dev/hda1.
mntpoint is the path where you want to mount the filesystem.
fstype is the file system type, like ext2, ext3, vfat, iso9660 or ntfs. If you are unsure, mount your partition somewhere, and run mount without any arguments to see what filesystem type it has been autodetected to be.
options is the mount options that you want to use. For hard drives, just use "defaults". See the manpage for mount for all available options.
dfreq is how often you want the filesystem to be dumped to a backup tape. You probably don't want that at all, so just set it to 0 (zero) to disable it.
fsckseq is the order in which you want the filesystems to be checked if the system was shut down uncleanly. If you don't want that at all, set it to zero.
by the sequence i meant , how the dist is partitioned.. likw first partition is root and then swap and then home.. if i mount before swap is that a probelm ??
anyway, your descriptiion is quite helpfull.. i will try to do that in the evening at home....
onew more clarification: while i am in the maintenance mode shell of LINUX and i mount the File systems that i desired at particular mount points. can i access the data from that mount and If YES then can i copy that data to another file system ( XP filesystem) ...
let me know if yes then i can plpay around this issue and learn and still be safe with my data ...
I wouldnt recomend it, because ntfs write support is quite buggy, so it could screw up your whole harddrive.
It doesn't matter in what order you mount them, no. Only if you have a partition that is to be mounted inside another partition, of course, but I'm guessing that you don't have such a setup. Of course, the root filesystem should be the first one, but since it's already mounted, it probably doesn't matter.
If you mount a filesystem, then of course you can access it. That's what mounting is for. if the XP filesystem is NTFS, then you can not copy stuff to it, since Linux only has read support for NTFS.
It seldomly harms anything to just mount the partition. If you want to be _absolutely_ sure, just mount the filesystem as read only (add ro to the mount flags, as in "mount -o ro /dev/bajs /mnt/bajs"). Then nothing can touch it at all. It shouldn't be necessary at all, since no programs should be running to touch the files at all, though.
Some more clarifications:
To add a swap partition, just type anything in the mntpoint column (swap partitions aren't really mounted, they are just turned on as swap space, with the swapon command). A common value is just "swap". The fstype for swap partitions must be "swap".
I think you must add a line for the /dev/pts virtual filesystem. Add one like this:
You might also have to add one for the proc filesystem. Add one like this:
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
that information was certainly helpfull.. i will try this stuff when i go back home this evening...
Will post any results or problems /queries by evening...
last Query for now:
"what if i try to install the linux i am using again and mount the file systems later when everything is installed ..."
I wouldn't prefer that, since it would reset your entire installation. If you want to do that, then fine... but I wouldn't.
well i got a neat utility called explore2fs, which can browse the linux file systems ..i backed up my data from those partition into XP one and reloaded everything... :) finally i ahve everythig back and the site is also back up this morning
thanks alll who have posted replies to this.....