However, there are NO instructions ...
This is not entirely true, according to that product specification, this drive supports an ATA command called Set Sector Configuration Ext
, which could be used to change the logical sector size, without need of using any propitiatory programs from vendor, such as HUGO; see section Set Sector Configuration Ext (B2h)
page 287 for a details description of this command.
This offical information could be too technical for ordinary users, so I'm trying to explain specifically what steps you should do, and why; however the information provided here should be treated as a reference only, you must take full responsibility for any command you sent to your disk drive, and only take practice after you understood the intention of each step.
I successfully changed the logical sector size from 512 to 4096 for my HC530 14TB drive. Since only logical sector size is changed, and the physical sector size remains 4096 all the time, this operation won't affect existing data on the disk; however it is always recommended to backup any important data before trying any operation like this.
I performed the following steps in a FreeBSD system, anyone using a different operating system should study with an equivalent command/tool if a specific command isn't available on their system.
Make sure no programs are using the disk, and no file systems are mounted from the disk, before continuing.
Instead of setting the sector size from a passed in value directly, the Set Sector Configuration Ext
command sets the sector cofiguration from a predefined list called Sector Configuration Log
, which is stored on disk as a General Purpose Log
at address 0x27; each entry is called a Sector Configuration Descriptor
. See product documentation section 12.21.13 Sector Configuration log
page 217 for details on the log structures.
I used smartctl(8) to retrieve Sector Configuration Log
of my drive, shown as followings:
# smartctl --log gplog,0x2f /dev/ada8
smartctl 6.6 2017-11-05 r4594 [x86_64-unknown-freebsd10.4 FreeBSD 10.4-RELEASE-p14] (local build)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org
General Purpose Log 0x2f [Set Sector Configuration], Page 0-0 (of 1)
0000000: 80 00 00 02 00 10 00 00 00 00 00 00 00 00 00 00 |................|
0000010: 80 00 08 02 40 10 00 00 00 00 00 00 00 00 00 00 |....@...........|
0000020: 80 00 10 02 80 10 00 00 00 00 00 00 00 00 00 00 |................|
0000030: 80 03 00 10 00 02 00 00 00 00 00 00 00 00 00 00 |................|
0000040: 80 03 40 10 08 02 00 00 00 00 00 00 00 00 00 00 |..@.............|
0000050: 80 03 80 10 10 02 00 00 00 00 00 00 00 00 00 00 |................|
0000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
...
As specified in the documentation, each descriptor is 16 bytes long, and valid descriptor will having the bit 7 set, 6 valid descriptors can be found in the output above.
Next we need to find out which descriptor have a logical sector size of 4096; the Logical Sector Size Setting field
is at offset 4 of a descriptor and having size of 4; note that the integer data in the descriptors are in little-endian; we choose the first descriptor because it have the value 00 10
(0x1000 == 4096)
Using the Set Sector Configuration Ext
requires you passing the descriptor index, in this case 0, as the sector_count
parameter, as well as the descriptor check value of the descriptor as the feature
parameter.
The descriptor check value size is 2, and it is found at offset 2 of a descriptor; so the descriptor check value in current case is 00 02
.
The specification also requires you setting bit 6 of the device
parameter.
The command parameters will be as followings:
feature=0x0200
sector_count=0x0000
device=0x40
Other parameters are unused and should be set to 0.
I used camcontrol(8) command available on FreeBSD, to send this ATA command, using the following syntax:
comcontrol command <disk> [-v] -a "<command> <features> <lba_low> <lba_mid> <lba_high> <device> <lba_low_exp> <lba_mid_exp> <lba_high_exp> <features_exp> <sector_count> <sector_count_exp>" -r -
Where option -v
is optional here that enables verbose error messages in cause of command failure; -r -
specifics that command register values indicating drive output, should be printed to stdout after the command successfully sent.
Run it:
# camcontrol command ada8 -v -a "b2 00 00 00 00 40 00 00 00 02 00 00" -r -
50 00 00 00 00 00 00 00 00 00 00
Verify the logical sector size after the above command succeeded:
# smartctl --info /dev/ada8
smartctl 6.6 2017-11-05 r4594 [x86_64-unknown-freebsd10.4 FreeBSD 10.4-RELEASE-p14] (local build)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
...
User Capacity: 14,000,519,643,136 bytes [14.0 TB]
Sector Size: 4096 bytes logical/physical
Rotation Rate: 7200 rpm
Form Factor: 3.5 inches
...
You should now completely unplug the drive and plug it again, to update kernel's view the its logical sector size; because the host kernel will likely still remembering the drive as 512-byte sector logically, any further sector accesses will be invalid and may cause I/O hanging in the kernnel, until you re-plugging the drive. Ather that the kernel should be able to access its sectors using the native 4096-byte sector size without problem.