Posted: . At: 11:06 AM. This was 4 years ago. Post ID: 13965
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


A one-liner that will list only the mounted removable drives on your system.


This command will only list the mounted removable drives on your Linux system. The ones under /dev/sd*. This is very easy to use.

4.4 Mon Jan 13 jason@Yog-Sothoth 0: $ cat /etc/mtab | grep /dev/s[a-f]/*
/dev/sda2 /media/jason/Seagate\040Expansion\040Drive fuseblk rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096 0 0
/dev/sdb4 /media/jason/My\040Stuff fuseblk rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096 0 0

This is a good way to only list physical drives on Linux and see what is mounted. The wildcard [a-f]/* only shows the drives from /dev/sda to /dev/sdf. But it works very well indeed.

This is another way to just list the physical hard drives mounted on your machine.

4.4 Tue Jan 14 jason@Yog-Sothoth 0: $ ls -hula /sys/block/sd[a-f]*
lrwxrwxrwx 1 root root 0 Jan 14 09:19 /sys/block/sda -> ../devices/pci0000:00/0000:00:14.0/usb4/4-1/4-1:1.0/host0/target0:0:0/0:0:0:0/block/sda
lrwxrwxrwx 1 root root 0 Jan 14 09:19 /sys/block/sdb -> ../devices/pci0000:00/0000:00:1f.2/ata1/host1/target1:0:0/1:0:0:0/block/sdb
lrwxrwxrwx 1 root root 0 Jan 14 09:19 /sys/block/sdc -> ../devices/pci0000:00/0000:00:1f.2/ata3/host3/target3:0:0/3:0:0:0/block/sdc
lrwxrwxrwx 1 root root 0 Jan 14 09:19 /sys/block/sdd -> ../devices/pci0000:00/0000:00:1f.2/ata4/host4/target4:0:0/4:0:0:0/block/sdd
lrwxrwxrwx 1 root root 0 Jan 14 09:19 /sys/block/sde -> ../devices/pci0000:00/0000:00:1f.2/ata6/host6/target6:0:0/6:0:0:0/block/sde

Yet another way to list all physical hard disk drives in your Linux system.

4.4 Tue Jan 14 jason@Yog-Sothoth 0: $ lsblk | grep sd[a-z]
sda               8:0    0   2.7T  0 disk 
├─sda1            8:1    0   128M  0 part 
└─sda2            8:2    0   2.7T  0 part /media/jason/Seagate Expansion Drive
sdb               8:16   0 465.8G  0 disk 
├─sdb1            8:17   0 186.3G  0 part 
├─sdb2            8:18   0     1K  0 part 
├─sdb3            8:19   0  32.2G  0 part 
├─sdb4            8:20   0 218.6G  0 part /media/jason/My Stuff
├─sdb5            8:21   0   7.5G  0 part [SWAP]
└─sdb6            8:22   0  21.1G  0 part 
sdc               8:32   0 335.4G  0 disk 
├─sdc1            8:33   0 292.5G  0 part 
└─sdc2            8:34   0  42.9G  0 part 
sdd               8:48   0 223.6G  0 disk 
├─sdd1            8:49   0   128M  0 part 
└─sdd2            8:50   0 223.5G  0 part 
sde               8:64   0 931.5G  0 disk 
└─sde1            8:65   0 931.5G  0 part

This uses the same wildcard to only list drives that are actually physical hard disk drives.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.