Mount an external USB disk using UUID


Toshiba Canvio plus 320 gb

You can rely on a desktop or file manager for the automounting of external USB disk but the problem is that it can be mounted in a different path (example, /media/1TB vs. /media/1TB_ ) therefor it seam wise to use the /etc/fstab for this purpose. But there is another problem, Linux system not always identifies a resource to the same device, I mean, an external USB disk can be associated to /dev/sdb1 today and tomorrow be assinged to /dev/sdc1. How to solve the problem in the /etc/fstab? Answer: Using a unique string called UUID (Universally Unique Identifier) which uniquely identifies the device.

The blkid command

In order to get the UUID’s of block devices, just use the blkid command:

root@moody:~# blkid 
/dev/sdb1: LABEL="350GB" UUID="AB64-3A17" TYPE="vfat" 
/dev/sdb2: LABEL="1TB" UUID="dbd6b68d-a690-4a77-a404-7b8880e938e0" TYPE="ext4" 
/dev/sda1: UUID="MfYt3S-Vlzs-MInW-xGWU-j28o-ssJU-Uw029u" TYPE="LVM2_member" 
/dev/mapper/vg-rootfs: UUID="0393994a-75d4-4435-b3fd-2fda39ccd9b3" TYPE="ext4" 
/dev/mapper/vg-swap: UUID="cd790b68-44ca-4f21-8596-850c32b54487" TYPE="swap" 
/dev/mapper/vg-home: UUID="83aa02aa-a68a-4536-8094-382a172d80df" TYPE="ext4"

Let’s take the second line as example. It says that the currently device currently associated to  /dev/sdb2 has n UUID of “dbd6b68d-a690-4a77-a404-7b8880e938e0″, has “1TB” as tag and uses ext4 as file system. With all this information you  can edit the /etc/fstab as follow:

#                                
proc            /proc           proc    defaults        0       0
/dev/mapper/vg-rootfs /               ext4    errors=remount-ro 0       1
/dev/mapper/vg-home /home           ext4    defaults        0       2
/dev/mapper/vg-swap none            swap    sw              0       0
/dev/sr0       /media/cdrom0   udf,iso9660 user,noauto     0       0
UUID="dbd6b68d-a690-4a77-a404-7b8880e938e0" /media/1TB ext4 defaults,users 0 0

Keep in mind the mount point must exist, i.e. folder /media/1TB. In order to try the above entry just mount it from a terminal or check it  when the PC reboots,  it it will be mounted automatically.

References:

  1. #1 by Luis Gallardo on 13/04/2012 - 11:16 pm

    @David puede ser los drivers de Ubuntu, o que no se esté trabajando en USB 2.0 sino en 1.1. Saludos!

  2. #2 by David rodriguez on 13/04/2012 - 1:24 am

    epale lusi buenisimo tu post graciass una pregunta tengo un rollo desde hace tiempo que conecto un disco externo usb 2.0 para pasar unas pelis que baje y cuando los paso tarda muchisimo la tasa de trasnferencia es de 2mb/s a 10mb/s en ubuntu cuando lo hago desde windows la tasa es mas alta aveces creo que llega hasta 30mb/s o 40mb/s algo asi a que se debe eso igualmente pasa por la tarjeta de red tengo una
    Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller y un router gigabit y la maquinita a la que lo paso tambien tiene gigabitethernet y por samba pasa por debajo de los 10 mb/s que debo hacer o que me recomendarias tu que me tiene azul esa broma

(will not be published)