Added bdmap

master
BrainwreckedTech 5 years ago
parent ea4521cde1
commit da824eac17

@ -4,6 +4,9 @@ Scripts for disks
**PLEASE NOTE:** These scripts should be considered experimental. **PLEASE NOTE:** These scripts should be considered experimental.
Test on non-production or backed-up data first. Test on non-production or backed-up data first.
bdmap
: Block Device Map: Maps /dev devices to sata/usb/etc. devices
ckalign ckalign
: Check if a given sector number is aligned on a 4k boundary : Check if a given sector number is aligned on a 4k boundary

11
bdmap

@ -0,0 +1,11 @@
#!/bin/sh
MKSED=false
OUTPUT="$(ls -l --color=never /sys/block | grep -v virtual | grep devices | cut -d\ -f9- | sed 's/\.\.\/devices\/pci//g;s/[0-9]\{4\}:[0-9]\{2\}[0-9:.a-f]*//g;s/\/\/\/*//g;s/->/=/g' | cut -d/ -f1)"
case "${1}" in
--sed) sed "$(echo ""${OUTPUT}"" | sed 's/ = / (/g;s/\(sd.\)/s\/\1 \\{7\\}\/\1/g;s/ s\//)\/g;s\//g'))/g" /dev/stdin ;;
*) echo "${OUTPUT}" ;;
esac
Loading…
Cancel
Save