Skip to content

Instantly share code, notes, and snippets.

@felixhummel
Created March 22, 2018 22:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felixhummel/b0ba885febc4010dd0614011806569bd to your computer and use it in GitHub Desktop.
Save felixhummel/b0ba885febc4010dd0614011806569bd to your computer and use it in GitHub Desktop.
list physical disks and their partitions
#!/bin/bash
set -euo pipefail
# major device number 7 is loop
# grep loop /proc/devices
#disks=$(lsblk --raw --noheadings -o type,name | grep ^disk | awk '{ print "/dev/"$2 }')
# weird though: "--exclude 252" (device-mapper) does not work...
lsblk -o MAJ:MIN,UUID,SIZE,LABEL,NAME,MOUNTPOINT,FSTYPE --exclude 7 | grep -v ^252
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment