Reply to comment

Using labels instead of devices for mountpoints

I recently purchased two USB connecting 500Gb drives for server backups.

When I first connected them they appeared as /dev/sda1 for the first and /dev/sdb1 for the second.

The next time I powered them up though the drives appeared on each others mount point , the first drive was now at /dev/sdb1 and the second was at /dev/sda1.

After looking at the mount man page I realised it was possible to mount the drives using their label instead of their device. All it took was a quick edit of /etc/fstab as root , changing :-

/dev/sda1 /mnt/500GbExt1 ext3 defaults,noauto 0 0
/dev/sdb1 /mnt/500GbExt2 ext3 defaults,noauto 0 0

to

LABEL=500GbExt1 /mnt/500GbExt1 ext3 defaults,noauto 0 0
LABEL=500GbExt2 /mnt/500GbExt2 ext3 defaults,noauto 0 0

Now it doesn't matter which USB port or which drives is powered on first , they always appear at the right mount point.

If you don't know the label of the partition , then use e2label to find it :-

e2label /dev/sda1

and perhaps even change it to something more useful :-

e2label /dev/sda1 NewPartitionLabel

I have also moved to UUID's and Volume Names on my workstation , here I have an XFS drive for the MythTV recordings and had to use the xfs_admin command :-

To show the label :-

xfs_admin -l

To change / create a label :-

sudo xfs_admin -L

cool.

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <img> <blockquote> <a> <strike> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.