Simple clear advice in plain English

Hands on: Disks and file systems

Find out how different the Unix way of disk handling is from the Windows approach

UUIDs
The mechanism of accessing storage devices by the hardware device name has worked well for a long time, but its inadequacies have been addressed recently by the move to Universally Unique Identifiers (UUIDs).

A UUID is a long number, essentially a numerical fingerprint, that is allocated to each filesystem. Rather than mount a partition based on its device name, Linux can now mount it based on its UUID instead.
The Linux kernel scans all the filesystems across all available drives, and keeps a record of the UUID of each one, internally linking it to the associated device name. This means that no matter what device name a partition has, its filesystem can always be located by the same identifier, even if the filesystem has been cloned and moved to another hard drive altogether.

This method is especially useful for booting Linux systems. The Grub bootloader recognises these UUIDs, and can locate and boot any filesystem available, without the complication of having to know which partition, or even which disk, it is located on.

If you install a copy of Ubuntu onto an external drive, so long as that drive is plugged in when the computer is switched on (and the Bios can recognise it), the bootloader can start up the operating system without being configured to look for a specific drive. Rather than being configured to boot, say, the third partition on the second drive, it can be configured just to boot the relevant filesystem by its identifier.

The main drawback of using unique identifiers as opposed to device names is when the partition is reformatted. If you decide to wipe a partition, even if you use the same kind of filesystem as before, the unique identifier will change, although the device name will remain the same.

Again, this is rarely a problem, and also a rare occurrence itself in practice. Where filesystems are automatically mounted in the /etc/fstab file, you can update the UUIDs easily enough to the new codes. Running the command ‘vol_id’ determines a partition’s UUID:

$ sudo vol_id /dev/sda2

A command like this will return the UUID on the partition provided. The identifier follows the tag ‘ID_FS_UUID’ in the command output. This can then be used in the mount command, followed by ‘UUID=’, either with the mount command directly, or in the /etc/fstab file.

Some distributions of Linux will configure existing partitions from any other copies of Linux present on the drive at the time of installation, and so it may be necessary to adjust the identifiers if the other distributions are re-installed or removed.

Labels
Labels offer a simpler alternative to UUIDs, but work in almost exactly the same way. Supported filesystems, such as NTFS and ext3, can be given an easy-to-remember label. For NTFS filesystems, the label is what Windows uses to refer to the drive alongside its drive letter, and can be changed from within Windows itself, or by using the ‘ntfslabel’ command in Linux.

For ext3 filesystems, change the label with the ‘e2label’ command:

$ sudo e2label /dev/sda2 Ubuntu

Reader Comments

   

Add your comment

All fields must be completed. Your email address will not be displayed or used to send marketing messages.

All messages will be checked by moderators before appearing on the site.

See our Privacy Policy for more information.

Related articles

Ubuntu Software Centre

How can I stop Ubuntu launching as the default operating system?

Uninstalling Ubuntu is a complex affair but changing the default operating system back to Windows XP is fairly easy to do with Ubuntu's Startup-Manager

linux-mint-12

Linux Mint is free, looks good and is great for enjoying music and films

This version of Linux includes many media features that work straight away including Flash and DVD playback

Fix-virtualbox-problems-in-ubuntu

Get VirtualBox working in Ubuntu Linux

Virtualbox is great if you need to get Windows apps working in Ubuntu but it may need help to get working

Question & Answer

Q.Why are some of the keys on my keyboard doing strange...

> Read the answer

Q.Is my phone’s Bluetooth any use?

> Read the answer

Q.Can I switch boot drives so that I can work on older...

> Read the answer

Best deals on the web

img

Samsung RV520-A07

£359.98- Buy it now

img

Acer Aspire 5750G (LX.RXP02.019)

£399.99- Buy it now

img

Apple MacBook Pro (MD313B/A)

£904.37- Buy it now

Latest issue & subscription deals

Poll

Are you concerned about viruses that target mobile phones?

Jargon Buster

Computing terms explained in plain English

Virtual drive

A set of files seen by Windows as a separate hard disk.

Great shopping deals from Computeractive