Printing the current sector size of a device in Linux

In the past year, a number of disk drives started shipping with 4K sector sizes. To see if your disk drive is using 512-byte or 4K sectors, you can use the blktool utility to print the sector size of a device:

$ blktool /dev/sda sector-sz

You can also look at the hw_sector_size value for a given device in /sys, but who wants to do that when a sweet little utility like blktool exists. There are various other ways to do this, and you comments and suggestions are welcome. :)

This article was posted by Matty on 2011-04-19 14:19:00 -0400 EDT