Categotry Archives: fstab

0

Removable USB devices and fstab settings

by

I have a 1 t/b back up drive, which is a USB drive.

However, the device names seem to change automagically.

Power interruptions, or even things like Virtual Box will cause the drive to dismount and re-mount, changing the device name, and causing havoc elsewhere for things like my music and ftp site which are stored on this device.

So, what’s the easy way to fix this? Well thanks to Loni, here’s what we did:

1. Change directory so we can get information by UUID. (Universally Unique Identifier)


cd /dev/disk/by-uuid

2. Look at the UUID’s in the system:


ls -l

You will get output that looks like this:

@Homer:/dev/disk/by-uuid$ ls -l
total 0
lrwxrwxrwx 1 root root 10 2010-07-08 00:21 14ff50b3-49c0-4dbb-a392-55fb94a7730f -> ../../sdb2
lrwxrwxrwx 1 root root 10 2010-07-07 17:21 5ed81b0d-ae9a-41b1-b4c7-02b500b94bea -> ../../sda5
lrwxrwxrwx 1 root root 10 2010-07-07 17:21 92569F58569F3C43 -> ../../sda1
lrwxrwxrwx 1 root root 10 2010-07-07 17:21 949CA48C9CA46A86 -> ../../sda3
lrwxrwxrwx 1 root root 10 2010-07-07 17:21 c07c1084-ff98-49dc-87c7-672651dc4d2e -> ../../sda4
lrwxrwxrwx 1 root root 10 2010-07-08 00:21 FC1268B212687414 -> ../../sdb1

4. Now let’s edit the Linux file structure table, fstab

Note any thing with a # in it is a comment does not need to be coded!


cd /etc

5. First let’s backup the file in case we make mistake (always have a path back to the way it was, before you messed it up!) More complete details are here.


sudo cp fstab fstab.bkup

6. Now edit the file:


sudo nano fstab

OR


gksudo gedit fstab # use gedit

7. add the following similar lines:


UUID=14ff50b3-49c0-4dbb-a392-55fb94a7730f /waynobfd ext4 rw 0 0
#
UUID=FC1268B212687414 /waynontfs ntfs rw,nosuid,nodev,allow_other,blksize=4096 0 0

The first line above, mounts an ext4 partition by UUID (from the information we obtained before) and gives it the mount point of /waynobfd (previously created with the mkdir command.)

The second line above mounts an ntfs partition, called waynontfs. Handy for use with Windows.

By using UUID, if the device changes due to things like VirtualBox or maybe a power hiccup that affects the drive, though the device may change, the mount point will always be correct.

End of Problems! Thanks Loni!

1

Recovering after hosing /etc/fstab

by

Well —

I shot myself in the foot the other day, on my Ubuntu 8.10 System.  I made a change to fstab (the Linux file structure table) — but didn’t do it correctly……

When done editing, I did:

I did a sudo mount -a -o remount

and it re-mounted / (root directory) as read only…..since fstab was hosed…

Uh oh…….

Then I made the fatal mistake of re-booting.

I just dug the whole deeper.

After a day and half of schlepping I figured out, all I needed to do (in recovery mode as root) was:

mount -o remount rw /

then it was easy to fix.

I also discovered you can’t access devices by /dev/media….

So when I used the partition name for my backup medium /dev/sdb2  things worked!  3 min fix, day and half to figure out!

DOH!
Wayno