Home > bash > get the UUID of a partition

get the UUID of a partition

Problem
You want to figure out the UUID of a partition. For instance, you want to mount a partition upon boot and thus you want to add it to your /etc/fstab.

Solution

$ sudo blkid

The blkid program … can determine the type of content (e.g. filesystem or swap) that a block device holds, and also the attributes (tokens, NAME=value pairs) from the content metadata (e.g. LABEL or UUID fields).” (source: man)

Update (20150803)
As msx pointed out in the comments, you can also write “lsblk -f“, which doesn’t require sudo rights at all.

U

Advertisements
Categories: bash Tags: , , ,
  1. msx
    July 31, 2015 at 22:55

    On newer systems you can do # lsblk -f too :)

    • August 3, 2015 at 14:29

      Great! And it doesn’t require sudo.

  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: