Sector size 與 alignment

最後更新: 2017-11-21

目錄

  • Windows check sector size
  • Window check 4K Aligned
  • Check alignment size
  • Get FS(ext4) block size
  • LVM Check alignment
  • Partition Check alignment

 


Windows check sector size

 

# only works for drives with partitions, and NTFS partitions at that.

fsutil fsinfo ntfsinfo c:

Bytes Per Sector  :               4096
Bytes Per Physical Sector :       4096
Bytes Per Cluster :               4096
Bytes Per FileRecord Segment    : 4096

 


Window check 4K Aligned

 

1) Run -> diskpart

2) list disk

3) select disk 3

4) list partition

  磁碟分割  ###    類型              大小      位移
  -------------  ----------------  -------  -------
  磁碟分割  1      主要                49 GB  1024 KB

 * Offset can be divided by 4096

 


Check alignment size

 

cat /sys/block/sda/queue/physical_block_size

4096

cat /sys/block/sda/queue/logical_block_size

512

 


Get FS(ext4) block size

 

blockdev --getbsz /dev/mapper/cl-root

4096

 


LVM Check alignment

 

pvs -o +pe_start

  PV         VG   Fmt  Attr PSize   PFree   1st PE
  /dev/sda   st3t lvm2 a--    2.73t   1.73t   1.00m

* be sure to make the stripe size a multiple of 4 kB

 


Partition Check alignment

 

Tools: parted

CMD: align-check align-type n           # align-type must be ‘minimal’, ‘optimal’

i.e.

(parted) align-check optimal 3

3 aligned

OR

parted /dev/sdX

(parted) unit s
(parted) print

Number  Start  End        Size       File system  Name            Flags
 1      2048s  20969471s  20967424s               seafile-backup

 


/sys/block/sd*/queue/

 

hw_sector_size

minimum_io_size

This is the smallest preferred io size reported by the device.

logical_block_size

physical_block_size

 


align_partitions

 

https://datahunter.org/align_partitions

 

Creative Commons license icon Creative Commons license icon