Skip to content

Instantly share code, notes, and snippets.

@mkropat
Created August 23, 2019 12:25
Show Gist options
  • Save mkropat/c6d55eff55aaaaa98bc0a2f98e1c558c to your computer and use it in GitHub Desktop.
Save mkropat/c6d55eff55aaaaa98bc0a2f98e1c558c to your computer and use it in GitHub Desktop.
#!/bin/sh
echo "| Name | Partition | Size (kB) | Path | Type |"
echo "|------|-----------|-----------|------|------|"
for d in /dev/block/bootdevice/by-name/*; do
name=$(basename -- "$d")
device=$(basename "$(readlink -- "$d")")
read -r _ fsmount fstype _ <<EOF
$(grep --fixed-strings "$d" /proc/mounts)
EOF
blocks=$(grep -E " $device$" /proc/partitions | awk '{ print $3 }')
size=$(( blocks / 2 ))
echo "| $name | $device | $size | $fsmount | $fstype |"
done
@azagramac
Copy link

Thanks ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment