Last active
October 23, 2021 01:13
-
-
Save alsunseri/1bb76b6ec0f62be9242585b33847ea6c to your computer and use it in GitHub Desktop.
get block size of linux drive partition or disk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# blockdev is in the util-linux package and the binary is in /sbin usually | |
# util-linux: /sbin/blockdev | |
# Display an error message if the partition (input) is not | |
# Exit the shell script with a status of 1 using exit 1 command. | |
[ $# -eq 0 ] && { echo "Usage: $0 partion"; exit 1; } | |
PARTITION=$1 | |
/sbin/blockdev --getbsz $PARTITION | |
# | |
# thanks to SURENDRA ANNE: | |
# https://www.linuxnix.com/find-block-size-linux/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment