Często zadajemy sobie pytanie czy mamy prawidłowy „Allocation Unit Size” czyli rozmiar klastra systemu plików. Jest to szczególnie ważne gdy pracujemy z bazami danych. MS SQL Server wymaga klastra systemu plików o rozmiarze 64KB.

No dobrze ale jak to sprawdzić ?

Windows

Istnieje kilka metod ale chyba najprościej jest użyć np. w systemie Windows CMD.

fsutil fsinfo ntfsinfo C:<br>

W odpowiedzi dostaniemy:

NTFS Volume Serial Number :        0x7052eadb52eaa4d6
NTFS Version      :                3.1
LFS Version       :                2.0
Total Sectors     :                1 998 426 596  (952,9 GB)
Total Clusters    :                  249 803 324  (952,9 GB)
Free Clusters     :                  143 797 869  (548,5 GB)
Total Reserved Clusters :                968 682  (  3,7 GB)
Reserved For Storage Reserve :           951 317  (  3,6 GB)
Bytes Per Sector  :                512
Bytes Per Physical Sector :        4096
Bytes Per Cluster :                4096  (4 KB)

Można również użyć komend z PowerShell

Get-CimInstance Win32_Volume |  
      Where-Object { $_.DriveLetter } |
      Select-Object DriveLetter, Label, FileSystem, BlockSize |
      Format-Table

W odpowiedzi dostaniemy trochę bardziej zwartą informację:


DriveLetter Label FileSystem BlockSize
----------- ----- ---------- ---------
C:                NTFS            4096

Również możemy sprawdzić rozmiar klastra systemu plików przy pomocy komendy diskpart z CMD. Tutaj należy jednak uważać, ponieważ po koleji trzeba odpytywać jakie mamy dyski, przechodzić na nie itd.

Poniżej cały proces od uruchomienia diskpart, aż do zakończenia. Interesuje nas dysk H o nazwie wolumenu SQLVMDATA1.

C:\Windows\system32> diskpart

Microsoft DiskPart version 10.0.20348.1
Copyright (C) Microsoft Corporation.
On computer: PRD-SQL

DISKPART> select volume
There is no volume selected.

DISKPART> list volume

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     C   Windows      NTFS   Partition    126 GB  Healthy    Boot
  Volume 1         Recovery     NTFS   Partition    450 MB  Healthy    Hidden
  Volume 2                      FAT32  Partition     99 MB  Healthy    System
  Volume 3     D   Temporary S  NTFS   Partition     74 GB  Healthy    Pagefile
  Volume 4     H   SQLVMDATA1   NTFS   Partition   2046 GB  Healthy
  Volume 5     K   SQLVMLOG     NTFS   Partition    510 GB  Healthy
  Volume 6     I   SQLVMTEMPDB  NTFS   Partition    254 GB  Healthy
  Volume 7     M   BackupDR     NTFS   Partition   2047 GB  Healthy

DISKPART> select volume 4
Volume 4 is the selected volume.

DISKPART> filesystems
Current File System
  Type                 : NTFS
  Allocation Unit Size : 64K
  Flags : 00000000

File Systems Supported for Formatting
  Type                 : NTFS (Default)
  Allocation Unit Sizes: 4096, 8192, 16K, 32K, 64K (Default), 128K, 256K, 512K, 1024K, 2048K

  Type                 : REFS
  Allocation Unit Sizes: 4096 (Default), 64K

DISKPART> exit
Leaving DiskPart...
C:\Windows\system32>

Oczywiście w innych systemach operacyjnych też możemy sprawdzić:

Linux

Dla zamontowanego systemu plików (dowolnego):

stat -f -c 'Mount: %m  FS: %T  Block size: %s bytes' /mnt/dane<br>

Dla ext4:

tune2fs -l /dev/sdXN | grep -i 'Block size'

# albo

dumpe2fs -h /dev/sdXN | grep -i 'Block size'

macOS

diskutil info /Volumes/Nazwa | grep -i 'Allocation Block Size'


Dariusz Brejnak

Od prawie trzydziestu lat jest pasjonatem informatyki, a zwłaszcza dziedzin dotyczących baz danych, hurtowni danych oraz ogólnie rozumianej tematyki BI. Jego druga pasja to fotografia http://dariuszbrejnak.pl