GagA// 0n D nEt

It is currently Sun May 20, 2018 3:40 pm

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Ubuntu: Using UUID to mount partitions under Ubuntu Linux
PostPosted: Sat Jan 31, 2009 4:41 am 
Offline

Joined: Wed Jul 18, 2007 1:14 am
Posts: 181
Many of you might have observed the concept of mounting a partition or volume under Ubuntu linux with UUID in the /etc/fstab.

UUID is Universally Unique Identifier is an identifier standard used in software construction. The idea if to identify the information related to a device without having the ability to be centrally connected.

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.

The ext2/ext3 partitions under linux do use the UUID to identify paritions.

How to locate the UUID?

In order to find the UUID for a certain parition, say /dev/sda1, you need to use vol_id command.

The following can form an example for the command:
Quote:
[email protected]:~# vol_id /dev/sda1

Output:
Code:
ID_FS_USAGE=filesystem
ID_FS_TYPE=ext3
ID_FS_VERSION=1.0
ID_FS_UUID=c64023e8-98e9-4a3c-9cd0-3535439254b6
ID_FS_UUID_ENC=c64023e8-98e9-4a3c-9cd0-3535439254b6
ID_FS_LABEL=
ID_FS_LABEL_ENC=
ID_FS_LABEL_SAFE=

You can also filter this command to just get the UUID, so the command can be used something given below:
Quote:
[email protected]:~# vol_id --uuid /dev/sda1

Output:
Code:
c64023e8-98e9-4a3c-9cd0-3535439254b6

List all UUIDs on the machine
You can list all the UUIDs on the machine using the blkid command. The following is an example for the same:
Quote:

Output:
Code:
/dev/sda1: UUID="c64023e8-98e9-4a3c-9cd0-3535439254b6" TYPE="ext3"
/dev/sda2: TYPE="swap" UUID="e885f423-679f-4ad2-be33-8d3e6d4dab95"
/dev/sda3: UUID="8091942a-5d81-421e-a3e9-ba25f36ff93d" TYPE="ext3"
/dev/sda4: UUID="4CD8E21AD8E20256" TYPE="ntfs"

Using UUID via fstab
The following is the syntax that can be used to mount a partition using UUID:
Code:
UUID=[UUID#]           [MOUNT POINT]               FILESYSTEM-TYPE    MOUNT-OPTIONS DUMP-Priority       SCAN-Priority

So in order to mount the above partition on /home using UUID via the /etc/fstab, edit the /etc/fstab file and add the following line to it:
Code:
UUID=c64023e8-98e9-4a3c-9cd0-3535439254b6    /home               ext3    relatime,errors=remount-ro 0       1

Save and exit of the file.
To mount the new partitions listed in the /etc/fstab, use the following command:
Quote:
[email protected]:~# mount -a


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group