Saturday, July 28, 2012

Finding Sector Size of a Disk

Sector size of a disk could be found out with the blockdev command in linux
  blockdev -V
  blockdev --report [devices]
  blockdev [-v|-q] commands devices
Available commands:
        --getsz (get size in 512-byte sectors)
        --setro (set read-only)
        --setrw (set read-write)
        --getro (get read-only)
        --getss (get sectorsize)
        --getbsz        (get blocksize)
        --setbsz BLOCKSIZE      (set blocksize)
        --getsize       (get 32-bit sector count)
        --getsize64     (get size in bytes)
        --setra READAHEAD       (set readahead)
        --getra (get readahead)
        --flushbufs     (flush buffers)
        --rereadpt      (reread partition table)
        --rmpart PARTNO (disable partition)
        --rmparts       (disable all partitions)
To get the sector size use getss option with the device
/sbin/blockdev --getss /dev/sdd1
Many options could be combined together as well such as finding out block size as well as the sector size
/sbin/blockdev --getss --getbsz /dev/sdd1
Knowing the sector size may be useful when dealing with new features of ASM.

In windows sector size could be found out with
wmic DISKDRIVE get bytespersector, caption
BytesPerSector  Caption
512             TOSHIBA MK1216GSY