Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 05-18-2018, 04:46 AM   #1
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 773
Blog Entries: 3

Rep: Reputation: 368Reputation: 368Reputation: 368Reputation: 368
sudo blkid vs ls /dev/disk/by-uuid

I want to run a script to check for any duplicate UUID's (i.e. two disks that may have the sam UUID).
I want to run this via ansible and NOT elevate to root.

What benefit (if any) is there to use
sudo blkid
over a simple
ls /dev/disk/by-uuid/
as a regular user?

With best regards,
Old 05-18-2018, 09:11 AM   #2
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,466
Blog Entries: 15

Rep: Reputation: 1452Reputation: 1452Reputation: 1452Reputation: 1452Reputation: 1452Reputation: 1452Reputation: 1452Reputation: 1452Reputation: 1452Reputation: 1452
sudo blkid IS running blkid as root as that is the purpose of sudo.

ls /dev/disk/by-uuid:
Doesn't output as much information as blkid (even when the ls is run as root). blkid will tell you which device equates to the UUID whereas the ls only shows you the uuid. blkid will give information about LVM devices as well as disks among other things. The only time I've seen duplicate UUIDs is for LVM PVs.
Old 05-18-2018, 12:49 PM   #3
Senior Member
Registered: Aug 2009
Distribution: CentOS
Posts: 3,986

Rep: Reputation: 1755Reputation: 1755Reputation: 1755Reputation: 1755Reputation: 1755Reputation: 1755Reputation: 1755Reputation: 1755Reputation: 1755Reputation: 1755Reputation: 1755
The /dev/disk/by-uuid/ directory contains a symlink for each UUID pointing back to the associated device entry in /dev/. There is no possibility of showing duplicates since a given UUID can appear only once in the directory.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] dracut disk /dev/disk/by-uuid/blah missing when its not rustyz82 Linux - Software 7 12-20-2017 05:50 PM
Get UUID of a device (without using blkid.h) using low-level C language? Xeratul Programming 5 08-04-2017 08:29 AM
[SOLVED] /dev/disk/by-uuid/<uuid here> does not exist and initramfs shell Mitt Green Linux - Kernel 4 08-03-2015 11:56 AM
[SOLVED] How to mount by-uuid if the device won't show in /dev/disk/by-uuid untill after blkid /dev/sd* ? masmddr Linux - General 4 01-10-2011 07:38 PM
Volume has problems including no uuid in /dev/disk/by-uuid abejarano Linux - Hardware 3 12-31-2008 08:41 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:00 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration