fdisk -l で最初に新しいディスクのパーティションを確認。今のところパーティションはない。
# fdisk -l /dev/sdz Disk /dev/sdz: 3000.6 GB, 3000592982016 bytes 255 heads, 63 sectors/track, 364801 cylinders, total 5860533168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x00000000 Disk /dev/sdz doesn't contain a valid partition table
parted でパーティションを作成、fdisk -l で確認。
# parted /dev/sdz GNU Parted 2.3 Using /dev/sdz Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) mklabel gpt (parted) unit s (parted) mkpart primary ext3 2048s -1s Warning: You requested a partition from 2048s to 5860533167s. The closest location we can manage is 2048s to 5860533134s. Is this still acceptable to you? Yes/No? Yes (parted) align-check optimal 1 1 aligned (parted) print Model: ATA WDC WD30EZRX-00D (scsi) Disk /dev/sdz: 5860533168s Sector size (logical/physical): 512B/4096B Partition Table: gpt Number Start End Size File system Name Flags 1 2048s 5860533134s 5860531087s primary (parted) quit Information: You may need to update /etc/fstab. # fdisk -l /dev/sdz WARNING: GPT (GUID Partition Table) detected on '/dev/sdz'! The util fdisk doesn't support GPT. Use GNU Parted. Disk /dev/sdz: 3000.6 GB, 3000592982016 bytes 255 heads, 63 sectors/track, 364801 cylinders, total 5860533168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/sdz1 1 4294967295 2147483647+ ee GPT Partition 1 does not start on physical sector boundary.
mkfs で ext4 フォーマット。その際 reserved block count を 0 にするためにオプション -m 0 を使用。結果は以下。3TBのディスクフォーマットで4.5日程度かかるがこれはmkfs に -c オプションを2回渡すことで破壊的読み書きテストを行っているため。
# time mkfs -t ext4 -m 0 -c -c /dev/sdz1
mke2fs 1.42.5 (29-Jul-2012)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
183148544 inodes, 732566385 blocks
0 blocks (0.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
22357 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544
Testing with pattern 0xaa: done
Reading and comparing: done
Testing with pattern 0x55: done
Reading and comparing: done
Testing with pattern 0xff: done
Reading and comparing: done
Testing with pattern 0x00: done
Reading and comparing: done
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
real 6395m49.439s
user 663m8.803s
sys 478m38.259s
作成したパーティションの詳細な結果を見るには dumpe2fs -h を使う。ext4 の新機能として "huge_file uninit_bg dir_nlink extra_isize" が追加されていることが分かる。
# dumpe2fs -h /dev/sdz1 dumpe2fs 1.42.5 (29-Jul-2012) Filesystem volume name: <none> Last mounted on: <not available> Filesystem UUID: ********-****-****-****-************ Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 183148544 Block count: 732566385 Reserved block count: 0 Free blocks: 721019563 Free inodes: 183148533 First block: 0 Block size: 4096 Fragment size: 4096 Reserved GDT blocks: 849 Blocks per group: 32768 Fragments per group: 32768 Inodes per group: 8192 Inode blocks per group: 512 Flex block group size: 16 Filesystem created: ************************ Last mount time: n/a Last write time: ************************ Mount count: 0 Maximum mount count: -1 Last checked: ************************ Check interval: 0 (<none>) Lifetime writes: 137 MB Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 256 Required extra isize: 28 Desired extra isize: 28 Journal inode: 8 Default directory hash: half_md4 Directory Hash Seed: ********-****-****-****-************ Journal backup: inode blocks Journal features: journal_incompat_revoke Journal size: 128M Journal length: 32768 Journal sequence: ********** Journal start: 0
# hdparm -i /dev/sdz
/dev/sdz:
Model=WDC WD30EZRX-00D8PB0, FwRev=80.00A80, SerialNo=***************
Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq }
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=0
BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=16
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=5860533168
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes: pio0 pio3 pio4
DMA modes: mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5 udma6
AdvancedPM=no WriteCache=enabled
Drive conforms to: Unspecified: ATA/ATAPI-1,2,3,4,5,6,7
* signifies the current active mode
# hdparm -Tt /dev/sdz
/dev/sdz:
Timing cached reads: 320 MB in 2.00 seconds = 159.93 MB/sec
Timing buffered disk reads: 168 MB in 3.00 seconds = 55.95 MB/sec
最後に自動マウントの設定と、マウントポイントの作成、オーナーの変更、確認。
# cat <<EOT >> /etc/fstab UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX /path/to/mount/point ext4 defaults 0 1 EOT # mount /path/to/mount/point # chown ******:****** /path/to/mount/point # df -haT /dev/sdz1 Filesystem Type Size Used Avail Use% Mounted on /dev/sdz1 ext4 2.7T 201M 2.7T 1% /path/to/mount/point
以下は 4TB の HDD について同じ処理を行った結果。
# parted /dev/sdz GNU Parted 2.3 Using /dev/sdz Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) mklabel gpt (parted) unit s (parted) mkpart primary ext4 2048s -1s Warning: You requested a partition from 2048s to 7814037167s. The closest location we can manage is 2048s to 7814037134s. Is this still acceptable to you? Yes/No? Yes (parted) align-check optimal 1 1 aligned (parted) print Model: ATA WDC WD40EZRX-00S (scsi) Disk /dev/sdz: 7814037168s Sector size (logical/physical): 512B/4096B Partition Table: gpt Number Start End Size File system Name Flags 1 2048s 7814037134s 7814035087s primary (parted) quit Information: You may need to update /etc/fstab. # fdisk -l /dev/sdz WARNING: GPT (GUID Partition Table) detected on '/dev/sdz'! The util fdisk doesn't support GPT. Use GNU Parted. Disk /dev/sdz: 4000.8 GB, 4000787030016 bytes 255 heads, 63 sectors/track, 486401 cylinders, total 7814037168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/sdz1 1 4294967295 2147483647+ ee GPT Partition 1 does not start on physical sector boundary.
そして時間のかかる mkfs。1回Testing with patternとReading and comparingが走るのにそれぞれ18時間と19時間程度かかる。これが4回走るので(18+19)*4=148時間程度かかる見込み。timeで計測した実際の時間は145時間でおよそ6日かかったことになる。
# time mkfs -t ext4 -m 0 -c -c /dev/sdz1
mke2fs 1.42.5 (29-Jul-2012)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
244195328 inodes, 976754385 blocks
0 blocks (0.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
29809 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544
Testing with pattern 0xaa: done
Reading and comparing: done
Testing with pattern 0x55: done
Reading and comparing: done
Testing with pattern 0xff: done
Reading and comparing: done
Testing with pattern 0x00: done
Reading and comparing: done
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
real 8708m22.778s
user 1087m26.046s
sys 485m23.320s
# echo $?
0
mkfs 中の vmstat の結果が以下。
$ vmstat 300 (snip) procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu---- r b swpd free buff cache si so bi bo in cs us sy id wa 1 1 0 121468 91048 3303356 0 0 2 58423 732 987 70 20 0 10 1 1 0 115816 90012 3334652 0 0 5 58891 709 1041 49 18 0 33 1 1 0 143880 79868 3295104 0 0 73 58851 723 1063 49 18 0 33 1 1 0 114500 74248 3350636 0 0 3 58599 736 984 70 20 0 10 1 1 0 118932 67380 3358068 0 0 2 59290 683 999 48 16 0 37 0 1 0 117016 63260 3336560 0 0 5 58941 721 1015 55 18 0 28 1 1 0 119700 62052 3363232 0 0 4 58721 737 1005 66 20 0 15 1 1 0 117296 60032 3363784 0 0 3 59211 669 985 49 17 0 34 1 1 0 120072 59808 3363756 0 0 43948 17247 731 946 75 21 0 5 2 1 0 121908 59696 3364456 0 0 62359 584 717 975 62 18 0 19 1 1 0 118120 59588 3363604 0 0 62298 596 756 959 76 21 0 4 1 1 0 115036 58860 3366628 0 0 62315 606 717 984 60 18 0 22 1 1 0 121344 57752 3365624 0 0 62197 666 758 963 75 21 0 4 0 1 0 113384 57300 3346352 0 0 62182 653 741 983 65 20 0 16 2 1 0 115436 56176 3367688 0 0 61978 738 760 989 68 21 0 11 1 1 0 118448 55504 3367652 0 0 61925 720 768 970 75 22 0 4 1 0 0 115756 53660 3370220 0 0 61412 896 751 1031 57 19 0 24 1 1 0 119312 50964 3372976 0 0 61665 875 771 977 74 23 0 3 (snip)
結構負荷の高いマシンでやるとフォーマット時間が伸びた
原因追求のためにHDDの接続もとも確認しておこう。/dev/sdz の接続先 (00:07.0) を確認して、lspci で確認。玄人志向の SATA4P-PCI 使ってるので、チップセット的 (SiI 3114) には対応取れてるから多分おk。
$ /sbin/udevadm info --query=all --name=/dev/sdz
P: /devices/pci0000:00/0000:00:07.0/host4/target4:0:0/4:0:0:0/block/sdz
N: sdz
S: disk/by-id/ata-WDC_WD30EZRX-XXXXXXXXXXXXXXXXXXXXXXX
S: disk/by-id/scsi-SATA_WDC_WD30EZRX-XXXXXXXXXXXXXXXXXX
S: disk/by-id/wwn-XXXXXXXXXXXXXXXXXX
S: disk/by-path/pci-0000:00:07.0-scsi-0:0:0:0
E: DEVLINKS=/dev/disk/by-id/ata-WDC_WD30EZRX-XXXXXXXXXXXXXXXXXXXXXXX /dev/disk/by-id/scsi-SATA_WDC_WD30EZRX-XXXXXXXXXXXXXXXXXX /dev/disk/by-id/wwn-XXXXXXXXXXXXXXXXXX /dev/disk/by-path/pci-0000:00:07.0-scsi-0:0:0:0
E: DEVNAME=/dev/sdz
E: DEVPATH=/devices/pci0000:00/0000:00:07.0/host4/target4:0:0/4:0:0:0/block/sdz
E: DEVTYPE=disk
E: ID_ATA=1
E: ID_ATA_DOWNLOAD_MICROCODE=1
E: ID_ATA_FEATURE_SET_HPA=1
E: ID_ATA_FEATURE_SET_HPA_ENABLED=1
E: ID_ATA_FEATURE_SET_PM=1
E: ID_ATA_FEATURE_SET_PM_ENABLED=1
E: ID_ATA_FEATURE_SET_PUIS=1
E: ID_ATA_FEATURE_SET_PUIS_ENABLED=0
E: ID_ATA_FEATURE_SET_SECURITY=1
E: ID_ATA_FEATURE_SET_SECURITY_ENABLED=0
E: ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=450
E: ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=450
E: ID_ATA_FEATURE_SET_SMART=1
E: ID_ATA_FEATURE_SET_SMART_ENABLED=1
E: ID_ATA_ROTATION_RATE_RPM=5400
E: ID_ATA_SATA=1
E: ID_ATA_SATA_SIGNAL_RATE_GEN1=1
E: ID_ATA_SATA_SIGNAL_RATE_GEN2=1
E: ID_ATA_WRITE_CACHE=1
E: ID_ATA_WRITE_CACHE_ENABLED=1
E: ID_BUS=ata
E: ID_MODEL=WDC_WD30EZRX-XXXXXXX
E: ID_MODEL_ENC=WDC\x20WD30EZRX-XXXXXXX\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
E: ID_PART_TABLE_TYPE=gpt
E: ID_PATH=pci-0000:00:07.0-scsi-0:0:0:0
E: ID_PATH_TAG=pci-0000_00_07_0-scsi-0_0_0_0
E: ID_REVISION=80.00A08
E: ID_SCSI_COMPAT=SATA_WDC_WD30EZRX-XXXXXXXXXXXXXXXXXX
E: ID_SERIAL=WDC_WD30EZRX-XXXXXXXXXXXXXXXXXXXXXXX
E: ID_SERIAL_SHORT=WD-XXXXXXXXXXXX
E: ID_TYPE=disk
E: ID_WWN=XXXXXXXXXXXXXXXXXX
E: ID_WWN_WITH_EXTENSION=XXXXXXXXXXXXXXXXXX
E: MAJOR=8
E: MINOR=48
E: SUBSYSTEM=block
E: UDEV_LOG=3
E: USEC_INITIALIZED=15412564
# ls -la /sys/block/sdz
lrwxrwxrwx 1 root root 0 Apr 22 11:54 /sys/block/sdz -> ../devices/pci0000:00/0000:00:07.0/host4/target4:0:0/4:0:0:0/block/sdz
# lspci -vv -s 00:07.0
00:07.0 SATA controller: Silicon Image, Inc. SiI 3114 [SATALink/SATARaid] Serial ATA Controller (rev 02) (prog-if 00 [Vendor specific])
Subsystem: Silicon Image, Inc. SiI 3114 SATALink Controller
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 32, Cache Line Size: 32 bytes
Interrupt: pin A routed to IRQ 17
Region 0: I/O ports at c400 [size=8]
Region 1: I/O ports at b000 [size=4]
Region 2: I/O ports at b400 [size=8]
Region 3: I/O ports at b800 [size=4]
Region 4: I/O ports at bc00 [size=16]
Region 5: Memory at fd118000 (32-bit, non-prefetchable) [size=1K]
[virtual] Expansion ROM at fa200000 [disabled] [size=512K]
Capabilities: [60] Power Management version 2
Flags: PMEClk- DSI+ D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=2 PME-
Kernel driver in use: sata_sil
フォーマットしたhddの速度
# hdparm -i /dev/sdz
/dev/sdz:
Model=WDC WD30EZRX-00D8PB0, FwRev=80.00A80, SerialNo=XXXXXXXXXXXXXXX
Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq }
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=0
BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=16
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=5860533168
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes: pio0 pio3 pio4
DMA modes: mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5 udma6
AdvancedPM=no WriteCache=enabled
Drive conforms to: Unspecified: ATA/ATAPI-1,2,3,4,5,6,7
* signifies the current active mode
# hdparm -Tt /dev/sdz
/dev/sdz:
Timing cached reads: 46 MB in 2.00 seconds = 22.97 MB/sec
Timing buffered disk reads: 48 MB in 3.07 seconds = 15.61 MB/sec
以下はフォーマット手順の記録
# fdisk -l /dev/sdz
WARNING: GPT (GUID Partition Table) detected on '/dev/sdz'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/sdz: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders, total 5860533168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sdz1 1 4294967295 2147483647+ ee GPT
Partition 1 does not start on physical sector boundary.
# parted /dev/sdz
GNU Parted 2.3
Using /dev/sdz
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt
Warning: The existing disk label on /dev/sdz will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? Yes
(parted) unit s
(parted) mkpart primary ext3 2048s -1s
Warning: You requested a partition from 2048s to 5860533167s.
The closest location we can manage is 2048s to 5860533134s.
Is this still acceptable to you?
Yes/No? Yes
(parted) align-check optimal 1
1 aligned
(parted) print
Model: ATA WDC WD30EZRX-00D (scsi)
Disk /dev/sdz: 5860533168s
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Number Start End Size File system Name Flags
1 2048s 5860533134s 5860531087s ext4 primary
(parted) quit
Information: You may need to update /etc/fstab.
# fdisk -l /dev/sdz
WARNING: GPT (GUID Partition Table) detected on '/dev/sdz'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/sdz: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders, total 5860533168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sdz1 1 4294967295 2147483647+ ee GPT
Partition 1 does not start on physical sector boundary.
# time mkfs -t ext4 -m 0 -c -c /dev/sdz1
mke2fs 1.42.5 (29-Jul-2012)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
183148544 inodes, 732566385 blocks
0 blocks (0.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
22357 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544
Testing with pattern 0xaa: done
Reading and comparing: done
Testing with pattern 0x55: done
Reading and comparing: done
Testing with pattern 0xff: done
Reading and comparing: done
Testing with pattern 0x00: done
Reading and comparing: done
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
real 9187m23.294s
user 781m54.012s
sys 495m25.982s
# tune2fs -l /dev/sdz1
tune2fs 1.42.5 (29-Jul-2012)
Filesystem volume name: <none>
Last mounted on: <not available>
Filesystem UUID: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Filesystem flags: signed_directory_hash
Default mount options: user_xattr acl
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 183148544
Block count: 732566385
Reserved block count: 0
Free blocks: 721019563
Free inodes: 183148533
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 849
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 8192
Inode blocks per group: 512
Flex block group size: 16
Filesystem created: XXXXXXXXXXXXXXXXXXXXXXXX
Last mount time: n/a
Last write time: XXXXXXXXXXXXXXXXXXXXXXXX
Mount count: 0
Maximum mount count: -1
Last checked: XXXXXXXXXXXXXXXXXXXXXXXX
Check interval: 0 (<none>)
Lifetime writes: 137 MB
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 256
Required extra isize: 28
Desired extra isize: 28
Journal inode: 8
Default directory hash: half_md4
Directory Hash Seed: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Journal backup: inode blocks