使用awk,column,fdisk,grep,sed检查分区是否进行了对齐

・1 分钟阅读

检查你的分区是否对齐

fdisk -l /dev/sda | grep -E sda[0-9]+ | sed s/*// | awk '{printf ("%s %f",$1,$2/512); if($2%512){ print"BAD" }else {print"Good"} }' | column -t
示例输出
/dev/sda1 4.000000 Good
/dev/sda2 404.000000 Good
/dev/sda3 160404.000000 Good
/dev/sda4 1520004.000000 Good
/dev/sda5 1520008.000000 Good
/dev/sda6 1521988.000000 Good
/dev/sda7 1643216.000000 Good
/dev/sda8 1659220.000000 Good
/dev/sda9 1787472.000000 Good
Hujiuxiang profile image