LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   fstab file got Deleted (https://www.linuxquestions.org/questions/linux-newbie-8/fstab-file-got-deleted-899244/)

SkM007 08-24-2011 03:30 PM

fstab file got Deleted
 
Dear all,

my mistake I deleted fstab file, now after booting I am getting error message saying "you don't have any Linux Partition..."
I know Kernel is not able to mount the partitions coz that file is missing... any idea what to do now; I tried rescue mode but I don't know how to proceed...
forgot to mention that /boot is a standard partition @ /dev/sda1; while /, /home, /var are LV's with address /dev/mapper/vol0-root, /dev/mapper/vol0-home, /dev/mapper/vol0-var...

Plz Help... Thnx in Advance...


SkM...

TobiSGD 08-24-2011 03:34 PM

Boot from a live CD, mount your Linux partition and create a new fstab.
If you need help with that feel free to ask.

SkM007 08-24-2011 04:02 PM

Quote:

Originally Posted by TobiSGD (Post 4452473)
Boot from a live CD, mount your Linux partition and create a new fstab.
If you need help with that feel free to ask.

Thanx for your help... I do have a Live CD but how m I gonna create fstab file... should i copy fstab file from live cd to /etc/; but how will get my fstab's detail, i mean i use UUID for mounting the partitions...

i think i have to do something else... it will be great if you can elaborate step by step process for fstab creation...

Again... Thnx for taking trouble for me...


SkM...

TobiSGD 08-24-2011 04:35 PM

1. Boot from your live-CD.
2. Open a terminal.
3. Launch the command
Code:

blkid
This will show you all partitions with their UUIDs and filesystems. Here for example is the output of that command on my laptop:
Code:

tobi@dragon ~ :) % blkid
/dev/sda1: UUID="1f66de30-a6a5-448f-9bad-5b7a3fe22e1c" TYPE="swap"
/dev/sda2: UUID="2bfe2395-c441-4ec5-89e9-9af815667a83" TYPE="ext4"
/dev/sda3: UUID="a1632bbd-ddf3-4337-810c-6fab59077ed1" TYPE="ext4"
/dev/sdb1: UUID="CF4A-303A" TYPE="vfat"

You can see that I have three partitions on drive sda (which is my internal disk) and one partition on an attached SD-card. The SD-card is not needed in the fstab, so we will omit that.
4. Now we will mount your Linux /-partition, in my case it is sda2:
Code:

sudo mount /dev/sda2 /mnt
You now can access all files on that partition under /mnt.
5. Create a new fstab in the mounted partition:
Code:

sudo vim /mnt/etc/fstab
Substitute vim in this command with your favorite text-editor.
6. At first we add some mounts that are necessary for a system to run properly, I just copied the entries from my fstab, you may want to have a look at your live CD's fstab to compare:
Code:

devpts          /dev/pts        devpts      gid=5,mode=620  0  0
proc            /proc            proc        defaults        0  0
tmpfs            /dev/shm        tmpfs      defaults        0  0

7. Now we add the partitions:
Code:

UUID="1f66de30-a6a5-448f-9bad-5b7a3fe22e1c"    swap    swap    defaults    0 0
UUID="2bfe2395-c441-4ec5-89e9-9af815667a83"    /    ext4    defaults    0 1
UUID="a1632bbd-ddf3-4337-810c-6fab59077ed1"    /home    ext4    defaults    0 1

Of course you have to adapt that to your needs. Substitude my UUIDs with the ones shown to you from the blkid-command. Also, if you don't have a separate /home-partition just omit that line.
8. Save that file and close the editor.
9. Unmount the partition:
Code:

sudo umount /mnt
10 Reboot and look if it works.

SkM007 08-24-2011 06:01 PM

Okay... I got it... I will mount the '/' (in my hdd its /dev/mapper/vol0-root) to a temporary /mnt (of cd) & then i'll create the fstab file...

Thnx a lot sir... u saved my day n my linux too...

SkM007 08-25-2011 12:07 AM

Hey Tobi,

Sorry for troubling u again...

I tried it, but I am getting different output than what u have written...

"df -h" doesn't gave any detail about the partitions in my HDD...
"blkid" there was not output
"fdisk -l" output is
/dev/sda1 Linux
/dev/sda2 Linux LVM
/dev/sda3 swap

sda2 is a PV with all LV's inside (/, /home, /var)...

"fdisk -l /dev/sda2" got message saying /dev/sda2 doesn't contain valid partition table...

"mount /dev/mapper/vol0-root /mnt" got message saying root doesn't exist...


Sorry, I can't attach the snapshot, if its required, i'll send...

Thnx...

SkM...

andrewthomas 08-25-2011 12:41 AM

You may have to run the blkid command as root.

SkM007 08-25-2011 12:45 AM

Quote:

Originally Posted by andrewthomas (Post 4452760)
You may have to run the blkid command as root.

all those commands were executed as root (using sudo)...

TobiSGD 08-25-2011 09:47 AM

May be someone other can help here, I know nothing about LVM and how it handles partitions.

EDDY1 08-25-2011 12:08 PM

Are you able to login single-user or recovery mode?
If you can
Quote:

cd /etc
ls
Look for
/etc/fstab.bak

SkM007 08-27-2011 11:13 AM

Hey...

sorry for the delay... I tried booting thru a Live CD, after that I was getting error message "System is sleeping forever" something like that... I was not able to get Grub loading screen... that's the reason Single User was not possible... & i didn't tried Rescue Mode... actually I re installed the OS, but I'll try it again... I wanna see how to recover it if fstab is missing...

I'll keep this thread open & let me try once again; I'll update here...

Anyway, Thanks for your Support...

EDDY1 08-27-2011 12:00 PM

If you're going to try it again try it in virtual box.

SkM007 08-27-2011 03:54 PM

okay... let me try it & will update you about my situation...


All times are GMT -5. The time now is 05:17 PM.