I had six Samsung HD204UI drives from a previous NAS that I wanted to use in a zpool (two vdevs each consisting of a
three-way mirror). The HD204UI drives are advanced format drives with 4k sectors, but they report a 512 byte sector size to the OS. This can be overcome in zfs by forcing 4k size in sd.conf
and using ashift=12
when creating the zpool.
Before creating a zpool the drives must be prepared so that zfs and disk sectors are aligned. The following approach is gleaned from the illumos wiki entry on the subject by George Wilson.
To find the device names of all disks use the format
command (use Ctrl-C
to exit):
1 2 3 4 5 6 7 8 9 |
|
To use 4K sectors the partition table must be changed to a GUID partition table (GPT). Use the mklabel gpt
command to change partition table (this will destroy all data on the disk):
1
|
|
To align sectors create a partition which starts at sector 256 (256 sectors of 512 bytes is 131072 bytes or 32 4K sectors, i.e. aligned). The size of the partition should be total number of disk sectors minus 16640 sectors (256 sectors for start + 16384 sectors for down-sizing to allow new disks of identical size to have slightly different geometry and still be used as replacement for the drive we are partitioning). 3907029168 sectors minus 16640 sectors equals 3907012528 sectors:
1
|
|
The disk is now ready to use in a zpool.