Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Hardware
User Name
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?


  Search this Thread
Old 04-29-2009, 12:38 PM   #1
ninja master
Registered: May 2008
Distribution: funtoo/gentoo amd64 xwrt
Posts: 412

Rep: Reputation: 31
show all unmounted disk labels?

how does one show all unmounted disk labels. say i have a disk, and im guessing that its /dev/sda2. how can i take away this guessing.
Old 04-29-2009, 05:48 PM   #2
Registered: May 2001
Posts: 29,361
Blog Entries: 55

Rep: Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547
Looking at /dev/disk/by-label/ (or use 'disktype') will show you all disklabels, to see which ones are unmounted check against /proc:
for DISKLABEL in `find /dev/disk/by-label/ -type l`; do RES=`readlink -f $DISKLABEL`;
 grep -q "^$RES" /proc/mounts ||echo "$RES (${DISKLABEL//*\//})"
Old 04-29-2009, 06:01 PM   #3
LQ Newbie
Registered: Apr 2009
Location: St. Louis, MO
Distribution: Ubuntu of any kind :)
Posts: 17

Rep: Reputation: 1
unSpawn has a great solution. I am not very good with code however, so usually I run (as root):

fdisk -l
And I receive lots of cool info about the model numbers, partitions, and space on the drive. This usually helps identify them because sometimes I'll plug in a USB drive but it will get mounted as /dev/sda (which is usually sata or scsi).

Hope this simple command helps!
Old 02-05-2014, 06:04 AM   #4
LQ Newbie
Registered: Nov 2011
Location: QLD, Australia
Distribution: Puppy Linux
Posts: 25

Rep: Reputation: Disabled
blkid -c /dev/null
will show all mounted and unmounted disk labels, along with UUID, filesystem, and device.

Some of the other suggestions are of no use to me unfortunately.
Some distros of Linux don't have the /dev/disk/by-label/ directory (mine doesn't) so that can't be used.
fdisk -l doesn't show labels (at least it doesn't on mine).
There are various tools that let you ask a drive what its label is (e2label, mlabel, ntfslabel, etc.) but they generally require that you know which device it is, which is often difficult in the case of USB drives. Also, they require you to know what format the drive is in.
gparted will display the label, but it is a slow and cumbersome solution and doesn't lend itself to automation.


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
Show useful names/labels in Konqueror media:/ arizonagroovejet Linux - Desktop 3 08-18-2008 06:26 PM
(disk device) was not cleanly unmounted, check forced. How long? mpbro Linux - Newbie 10 06-16-2008 06:12 PM
How Do You Edit Disk Labels? Ceran Linux - Software 8 07-29-2007 07:11 PM
Unmounted disk spins up Libra Linux - General 2 01-14-2007 01:32 PM
unmounted hard disk volume/CD ROM: permission denied tuluks Linux - General 7 12-18-2006 03:17 AM > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 09:49 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