Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

How To Use UUID To Mount Partitions / Volumes ... http://www.cyberciti.biz/faq/linux-finding-using-uuid...

Home
About
Forum
Low graphics
Shell Scripts
RSS/Feed

Linux FAQ / Howtos

How To Use UUID To Mount


Partitions / Volumes Under Ubuntu
Linux
by Vivek Gite · 5 comments

Q. Can you explain UUID concept related to Linux ext3 partitions


and storage devices? How do I update /etc/fstab using UUID under
Ubuntu Linux or any other Linux distro?

A. A Universally Unique Identifier (UUID) is an


identifier standard used in software construction,
standardized by the Open Software Foundation
(OSF) as part of the Distributed Computing
Environment (DCE). The intent of UUIDs is to
enable distributed systems to uniquely identify
information without significant central
coordination. Thus, anyone can create a UUID and use it to identify something
with reasonable confidence that the identifier will never be unintentionally used
by anyone for anything else. Information labeled with UUIDs can therefore be
later combined into a single database without needing to resolve name conflicts.

UUID and Partitions


Linux's ext2/ext3 filesystem uses UUID to identify partitions.

UUID benefits

1 de 6 31-07-2010 04:52
How To Use UUID To Mount Partitions / Volumes ... http://www.cyberciti.biz/faq/linux-finding-using-uuid...

As a sesonded UNIX admin I have to deal with various data storage technologies
such as SAN, iSCSI, DAS, scsi disks volumes. Sometime you may need to move
storage from one device to another and updating /etc/fstab can be pain in a$$.
With UUID Linux kernel should automatically find and map (read as mount to
exact location) volumes to storage device. This saves lots of time and avoid
/etc/fstab breaks.

However, UUID may be not very useful for single desktop computer at home as
you do not have enterprise grade storage and requirements.

How do I find out UUID for /dev/sdb2?


To probe filesystem type and read label and uuid for /dev/sdb2 (or any other
device) use vol_id command:
# vol_id --uuid {/dev/device}
# vol_id --uuid /dev/sdb2
$ sudo vol_id --uuid /dev/sdb2
Sample output:
41c22818-fbad-4da6-8196-c816df0b7aa8

List all UUIDs

Use blkid command-line utility to locate/print block device attributes:


$ sudo blkid
Sample output:
/dev/sda1: TYPE="ntfs" UUID="A0F0582EF0580CC2"
/dev/sda2: UUID="8c2da865-13f4-47a2-9c92-2f31738469e8" SEC_TYPE="ext2" TYPE="ext3"
/dev/sda3: TYPE="swap" UUID="5641913f-9bcc-4d8a-8bcb-ddfc3159e70f"
/dev/sda5: UUID="FAB008D6B0089AF1" TYPE="ntfs"
/dev/sdb1: UUID="32c61b65-f2f8-4041-a5d5-3d5ef4182723" SEC_TYPE="ext2" TYPE="ext3"
/dev/sdb2: UUID="41c22818-fbad-4da6-8196-c816df0b7aa8" SEC_TYPE="ext2" TYPE="ext3"

How do I use UUID to update /etc/fstab file?

Simply use following syntax:

UUID={YOUR-UID} {/path/to/mount/point} {file-system-type} defaults,errors=remount-r

Open /etc/fstab:
$ sudo vi /etc/fstab
Append line as follows:
UUID=41c22818-fbad-4da6-8196-c816df0b7aa8 /disk2p2 ext3 defaults,errors=remount-ro 0 1

Save and close the file. To mount new partition immediately using /etc/fstab

2 de 6 31-07-2010 04:52
How To Use UUID To Mount Partitions / Volumes ... http://www.cyberciti.biz/faq/linux-finding-using-uuid...

type:
$ sudo mount -a

Further readings:
man pages mount, fstab, vol_id

Featured Articles:

20 Linux System Monitoring Tools Every SysAdmin Should Know


20 Linux Server Hardening Security Tips
My 10 UNIX Command Line Mistakes
The Novice Guide To Buying A Linux Laptop
10 Tools To Add Some Spice To Your UNIX Shell Scripts

Want to read Linux tips and tricks, but don't have time to check our blog
everyday? Subscribe to our daily email newsletter to make sure you don't miss
a single tip/tricks. Subscribe to our weekly newsletter here!

Email FAQ to a friend


Download PDF version
Printable version
Comment RSS feed
Last Updated: 09/27/08

{ 5 comments… read them below or add one }

1 root April 23, 2009

man tune2fs

Reply

2 Willie May 18, 2009

I have been trying to figure out what happen to my UUID’s on my server,


thanks a lot for the help. Now I can change everything to ext4 on my
laptop.

3 de 6 31-07-2010 04:52
How To Use UUID To Mount Partitions / Volumes ... http://www.cyberciti.biz/faq/linux-finding-using-uuid...

Reply

3 SS September 14, 2009

Thats a good description.


Thankyou

Reply

4 unixadmin007 March 22, 2010

I have a UBUNTU server, recently i cloned the disk using dd and kept the
second disk in box itself. yesterday i realized that because of UUID features
it generated same UUID to my /dev/sdb partitions and it looks like it is
using the mix of first disk and second disk.

Reply

5 Alex May 7, 2010

as of ubuntu 10.04 i found out that vol_id does not exist anymore
( https://bugs.launchpad.net/ubuntu/+source/unetbootin/+bug/376339 ) .

now “blkid” should be used instead.

Reply

Leave a Comment

Name *

E-mail *

Website

4 de 6 31-07-2010 04:52
How To Use UUID To Mount Partitions / Volumes ... http://www.cyberciti.biz/faq/linux-finding-using-uuid...

Notify me of followup comments via e-mail

Tagged as: /etc/fstab, data storage technologies, ext3 uuid, filesystem, iscsi, linux kernel, linux uuid,
osf, partitions, scsi disks, storage device, sudo command, Universally Unique Identifie, uuid, vi
command, vol_id command

Previous FAQ: Alarm clock: How To Set Timeout For A Shell Command

Next FAQ: How To Limit The Growth Of UNIX / Linux Log Files

Sign up for our daily email newsletter:

Search

5 de 6 31-07-2010 04:52
How To Use UUID To Mount Partitions / Volumes ... http://www.cyberciti.biz/faq/linux-finding-using-uuid...

Sponsored links

Save now with the best deals from CDW. Click here to save on desktops,
notebooks, LCDs and more. Shop now!

Related FAQs

HP-UX UNIX Mount CDROM ( CDFS ) Filesystem Command


Configure a system to automount a Samba share with /etc/fstab
Locate files on linux, FreeBSD and UNIX system
Linux Disable /var Access Time Updates ( noatime )
Linux Hard Disk Format Command

©2006-2010 nixCraft. All rights reserved | Privacy Policy | Terms of Service


Advertise | Questions or Comments | Sitemap

6 de 6 31-07-2010 04:52

You might also like