Site Map - skip to main content

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes every weekday Monday through Friday.
This page was generated by The HPR Robot at

hpr2766 :: Disk enumeration on Linux

Klaatu reviews the various commands used to enumerate drives on Linux

<< First, < Previous, , Latest >>

Hosted by Klaatu on 2019-03-11 is flagged as Clean and is released under a CC-BY-SA license.
fdisk, dmesg, lsblk, udisks. 3.
The show is available on the Internet Archive at:

Listen in ogg, spx, or mp3 format. Play now:

Duration: 00:24:03


The old way:

$ ls /dev/sd*

Another old way:

$ fdisk --list

An old way to see what you just plugged in:

$ sudo dmesg | tail

Some new tricks:

$ lsblk
sda      8:0    0   2.7T  0 disk 
├─sda1   8:1    0  23.3G  0 part 
└─sda2   8:2    0   2.7T  0 part 
sdb      8:16   0   3.9G  0 disk 
sdc      8:32   0 111.8G  0 disk 
├─sdc1   8:33   0   100M  0 part /boot/efi
└─sdc2   8:34   0 111.7G  0 part /
sdd      8:48   0   1.8T  0 disk 
├─sdd1   8:49   0   120G  0 part /var
├─sdd2   8:50   0   120G  0 part /tmp
├─sdd3   8:51   0    60G  0 part /opt
└─sdd4   8:52   0   1.5T  0 part /home
sde      8:64   0 298.1G  0 disk 
├─sde1   8:65   0   500M  0 part 
├─sde2   8:66   0 296.8G  0 part 
└─sde3   8:67   0   826M  0 part 
sdf      8:80   0 931.5G  0 disk 
└─sdf1   8:81   0 931.5G  0 part 
sdg      8:96   1   7.5G  0 disk 
└─sdg1   8:97   1   7.5G  0 part 

User-friendly udisks:

$ udisks --monitor /dev
$ udisk --enumerate | sort
$ udisks --mount /dev/sdc1
Mounted /dev/sdc1 on /media/mythumbdrive
$ udisks --unmount /dev/sdc1


Subscribe to the comments RSS feed.

Comment #1 posted on 2019-03-12 18:51:48 by Joel D

The Letters C and F

Klaatu mentioned he wasn’t sure what the ‘f’ in ‘fdisk’ stood for. I had always been positive it stood for “format” because DOS had an fdisk command and that was pretty much its main use. However, I looked it up just now and turns out I was wrong, it stands for Fixed, as in Fixed Disk Setup Program.

He also seemed unsure of the reason why the main hard disk is usually C in Windows machines. PCs would originally boot off the floppy drive, which was always A, and for convenience, a second floppy drive was often added and it was always B. So the hard drives started with C. I don't think there's any technical reason A and B haven’t been reclaimed, but when I read `A:` or `B:` in a path, I still think “floppy disk”. At any rate, the whole scheme is sad and dumb!

Comment #2 posted on 2019-03-13 19:21:21 by Klaatu

Thanks for the info Joel

I guess I could have looked up fdisk. Thanks for overlooking my laziness.

Very enlightening about the C drive! I can respect extreme backward-compatibility, so I don't mind that they don't reclaim A or B. That said, the scheme is pretty stupid. I'm surprised it stuck around, but I guess once they'd made the decision, they just figured it was too late to change. It seems the more I learn about the historical Microsoft, the more I feel like it was started with no prior research, but then again maybe I'm biased because we live in such an open source world. After all, maybe back in the early 80s you couldn't just call up Bell Labs and ask if the way you're programming disk detection made sense or not.

Comment #3 posted on 2019-03-14 13:12:14 by Ahuka

Old drive letters

klaatu, remember that inertia is the most powerful force in the universe.

Leave Comment

Note to Verbose Commenters
If you can't fit everything you want to say in the comment below then you really should record a response show instead.

Note to Spammers
All comments are moderated. All links are checked by humans. We strip out all html. Feel free to record a show about yourself, or your industry, or any other topic we may find interesting. We also check shows for spam :).

Provide feedback
Your Name/Handle:
Anti Spam Question: What does the letter P in HPR stand for?
Are you a spammer?
What is the HOST_ID for the host of this show?
What does HPR mean to you?