If you prefer to mount your disk partition using UUID
(or for any other reason), you can set the UUID
by using the tune2fs
command.
You can use any unique string as the argument for the -U
parameter, or you can use `uuid`
, given that you have uuid
package installed.
shakir@anduril:~$ sudo tune2fs /dev/hdb1 -U `uuid`
You’ll need to have root
permission for this to work.
If you have the following fstab
entry and want to mount the partition using the UUID
instead of device name, you just need to add UUID=
followed by you partition’s UUID
in your fstab
and you’re done.
/dev/sda4 /home ext4 defaults 0 2
The following is an example of same entry, using UUID
.
UUID=860e4946-19a2-40ee-837a-4eca537b0ec1 /home ext4 defaults 0 2
There are a few ways to get disk partition UUID (Universally Unique Identifier) in Linux, but some requires installation of additional software or packages.
The following 2 method would normally work on any Linux system.