Mucked up fstab

Hi all,

I’m a relative newbie and I’ve lost some important files on my system. I’ve got 2 HDs that I’ve partitioned in various ways. I was going to attach an image of the setup page, but I can’t do this.

Okay layout is as follows:

HD 1
/dev/sda 931.51 GB
/dev/sda1 100.00 MB HPFS/NTFS, NTFS, System Reserved /windows/C
/dev/sda2 683.59 GB HPFS/NTFS, NTFS, Home /media/Home
/dev/sda3 247.82 GB Extended
/dev/sda5 1.95 GB Linux swap, Swap, swap
/dev/sda6 195.31 GB Linux native, Ext4, /
/dev/sda7 50.57 GB Linux native, Ext4, /media/09940446-b8b0-4291-bf35-1f0f4a7d44ec

/dev/sdb 931.51 GB
/dev/sdb1 488.28 GB HPFS/NTFS, NTFS, Back_up /windows/E
/dev/sdb2 443.23 GB Extended
/dev/sdb5 443.23 GB Linux native, Ext4, /home

I wanted to backup data in my /home partition and sort out some other issues. When I first installed 11.3, it wasn’t mounting sda7 nor was it mounting sdb1. So I went into Partitioner and told it to mount them. I had to assign a mount point, so I made sda7 /tmp and I can’t recall exactly what I assigned sdb1 as.

Yes, I was stupid enough not to backup fstab first. I know it backups, but I’ve made several other changes since, so I’ve long since lost my original file. So when I rebooted, I couldn’t log in as myself. I could log in as root. When I tried to undo my stuff-up, I’ve clearly made things worse, or at least, not better.

In my naivety, I have tried updating to 11.4 in the hope that I could redo my partition assignments and work everything out. Alas, that did not work. I have not deleted or formatted the sdb5 partition, so all my data should be there, I can’t can’t get to it. In fact, there is 40GB of data on the disk, I just can’t see it!

So I’ve got all these lovely image files (photos) that I’m desperate to get back. Can I recover from my stupidity? All advice greatly received.



My fstab follows;

/dev/disk/by-id/ata-ST31000528AS_6VP3FQ7H-part5 swap swap defaults 0 0
/dev/disk/by-id/ata-ST31000528AS_6VP3FQ7H-part6 / ext4 acl,user_xattr 1 1
/dev/disk/by-id/ata-ST31000528AS_9VP7EP3J-part5 /home ext4 defaults 1 2
/dev/disk/by-id/ata-ST31000528AS_6VP3FQ7H-part1 /windows/C ntfs-3g users,gid=users,fmask=133,dmask=022,locale=en_GB.UTF-8 0 0
/dev/disk/by-id/ata-ST31000528AS_9VP7EP3J-part1 /windows/E ntfs-3g users,gid=users,fmask=133,dmask=022,locale=en_GB.UTF-8 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs noauto 0 0
debugfs /sys/kernel/debug debugfs noauto 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0

To see what is actually mounted, just type:


You should find sdb1 under /windows/E (according to your /etc/fstab ).
sda7 is not mounted and mounting it in /tmp is a bad idea. /tmp is used for temporary stuff. You could for example mount sda7 in /data. To do so, as root:

  • create the directory /data
mkdir /data
  • add this line at the end of /etc/fstab:
/dev/disk/by-id/ata-ST31000528AS_6VP3FQ7H-part7 /data ext4 acl,user_xattr 1 2

It will get automatically mounted next time you reboot and if you want to mount it before, just type:

mount /data

Also try not to think in term of sda, sdb and never use these names in /etc/fstab (except for comments).

  • You can also copy/paste the following command into a terminal to display all by-id symlinks and the devices they refer to:
find /dev/disk/by-id -type l -ls | awk '{ print $11, $12, $13}'

Try parted magic
Boot from it and Use the partitioner to check the partition, then
see if you can mount the partition/s and at least backup files

But a re-install of 11.4 and setting sda6 as root and sdb5 as /home
should fix it

Can we assume the boot flag is on sda3 ? But it’s booting grub OK isn’t it?

You don’t need to have every partition inside fstab to use them in the 1st place, the rather if they are listed in fstab wrongly, this would add unnecessary difficulties to mount them, because when executing mounts, the linux kernel always try to refer to fstab, and assumed fstab to be faultless.

Put # sign at beginning of each unnecessary fstab lines to temporary turn them off and reboot system.

Then use mount command as root to mount them 1 by 1, it is actually quite smart and capable of auto detect file system type, so for newbie it does better than fstab. After successfully mounted this way copy the successful mounts into fstab.

You seem to be using the long-winded disk-by-id paths to mount, they are long and confusing, and hard to debug as a result. e.g. dev/disk/by-id/ata-ST31000528AS_6VP3FQ7H-part5 .

To be simple use /dev/sda5 instead of the above always make things easier.

mount /dev/sda5 /mnt 

When your fstab did not specify anything (wrong things specified is worse than nothing specified) the above usually work.

Then type again


To show how was it mounted, including the fs-type auto detected.

The following can automatically deal with mounting swap. You can follow it to edit fstab afterwards.

swapon -as

and also safe in case device names vary. Please read some documentation (and many posts here) about device name changing and the udev daemon.

No. That it looks simpler to you doesn’t mean it is appropriate. If it were, all Linux setups would use this notation while creating /etc/fstab and none of them does. To keep it safe, simply never use device names in /etc/fstab whatever else you are planning to do.

# Modified by YaST2. Last modification on Mon Apr 11 08:51:04 SGT 2011
# Configure custom boot parameters for updated kernels in /etc/sysconfig/bootloader

default 0
timeout 8
##YaST - generic_mbr
gfxmenu (hd0,1)/boot/message
##YaST - activate

###Don't change this comment - YaST2 identifier: Original name: linux###
title Desktop -- openSUSE 11.4 -
    root (hd0,1)
    kernel /boot/vmlinuz- root=/dev/sda2 resume=/dev/sda1 splash=silent quiet  showopts vga=0x314
    initrd /boot/initrd-

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 11.4 -
    root (hd0,1)
    kernel /boot/vmlinuz- root=/dev/sda2 showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe vga=0x314
    initrd /boot/initrd-

###Don't change this comment - YaST2 identifier: Original name: floppy###
title Floppy
    rootnoverify (fd0)
    chainloader +1

This is my opensuse 11.4 default setup by YAST installer which is a virtual machine. It is using** root=/dev/sda2** by YAST installer, I did not change that.

Actually systems like these VMs (have like a hundred since past years) are suitable to use ** root=/dev/sda2** because they are never changed. I fixed VM snapshots on them, and I never do any online update of these machines, they are for tests and learning purpose for different distributions & OS, including BSD Solaris etc.

I do have troubles with ** root=/dev/sda2** type of notations, and troubles are caused by BIOS changes, and HOT-SWAPPING SATA HDDs, in these scenarios BIOS reassigns the SATA drive letters e.g. sdc will become sdb when sdb is un-plugged and so on.

To help a forumer here via post without chance to be access his computer, trying to keep things simple will help them out of troubles sooner, I hope. :\ In my own physical systems I always edit my menu.lst or grub.cfg to convert all notations to UUID, although UUID are very long and complicated, but very generic in changing hardware environment, e.g. hot-swapped SATA raid or hot-plugged back-up HDDs. UUID only change when partitions are formatted. So if I interchange position of my SATA drives within hot-swap bays, I need not go to BIOS to adjust the orders of SATA drives in BIOS. My fstab using UUID will be able to find volumes to mount.:wink:

However, i won’t do this to assist someone online. UUIDs I can only copy them by cut & paste, because typing them will by myself will surely go wrong, they are not any easier to type compared with disk/by-id:


Surely the last one have the least chance to go wrong by typing.

On 2011-04-16 17:06, uy wrote:
> This is my opensuse 11.4 default setup by YAST installer which is a
> virtual machine. It is using* root=/dev/sda2* by YAST
> installer, I did not change that.

It is not fstab.

Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

blkid -s UUID /dev/sda6

OK, / (root) is on sda6 and /home should be on sdb5, windows (C,E) on sda1 and sdb1.
Your /etc/fstab doesn’t mount sda2 or sda7.

As suggested above either use a mkdir /some_mount_point or use mkdir /mnt/some_mount_point instead of /media/some_mount_point.
IMHO, /media is sort of reserved for removable media.

According to your /etc/fstab /home should be mounted and available to you. Unless this isn’t a complete /etc/fstab.
To check pls post using SUSE Paste your output from:

su -c "fdisk -l" 
cat /etc/fstab