Follow

Over-provisioning SSDs

Over-provisioning sets a percentage of the usable space on a hard drive to be locked away in the Host Protected Area (HPA) of the drive's firmware, ensuring that the disk never hits 100% capacity utilization, for performance and endurance reasons. Some SSDs, such as Intel's Data Center (DC) series drives, are factory over-provisioned, but many brands still require a manually defined HPA.

For Linux-centric systems, overprovisioning can be set using hdparm (SATA) or sg3utils (SAS). This is ideal for any system with Linux preinstalled, provided that the SSDs are attached to a SAS HBA or motherboard SATA controller.

 

Enabling HPA

First find the max sector count. In this example, the disk is labeled as /dev/sdb,

# hdparm -N /dev/sdb

/dev/sdb:
max sectors   = 312581808/312581808, HPA is disabled

These 312,581,808 sectors multiplied by 512 correspond to exactly 160,041,885,696 bytes, thus the normal net capacity of this SSD, precisely.

For SATA drives, hdparm -Np enables the host protected area. In doing this, the number of visible remaining sectors is specified after the –Np flag (without a space between). The --yes-i-know-what-i-am-doing flag and device name are required as additional parameters.

# hdparm -Np281323627 --yes-i-know-what-i-am-doing /dev/sdb
/dev/sdb:
setting max visible sectors to 281323627 (permanent)
max sectors   = 281323627/312581808, HPA is enabled

For SAS drives, sg_format enables the host protected area. Note that you will need to convert your decimal sector count to hexadecimal for sg_format to work. In this example, 281323627 sectors would convert to 10C4A86B.

# sg_format --resize --count=0x10C4A86B /dev/sdb

# sg_format --format --count=0x10C4A86B /dev/sdb

Both the --resize and --format commands are necessary to enforce the change.

 

Disabling HPA

Find the max sector count:

# hdparm -N /dev/sdb

/dev/sda:

max sectors = 1953523055/1953525168, HPA is enabled

 

Once you have the max sector count (in this example it's 1953525168), set the maximum visible sectors to the max sector count:

# hdparm -Np1953525168 --yes-i-know-what-i-am-doing /dev/sdb

/dev/sda:

setting max visible sectors to 1953525168 (permanent)

max sectors = 1953525168/1953525168, HPA is disabled

 

And the sg_format equivalent of the command would be as follows:

# sg_format --resize --count=0x74706DB0 /dev/sdb

# sg_format --format --count=0x74706DB0 /dev/sdb

 

Automatically preventing HPA disabling for affected Linux Systems:

Ubuntu in particular will usually ignore the HPA by default, but other distributions can be affected as well. Depending on whether libdata has been compiled into the kernel or exists as a module, ignore_hpa can be permanently disabled as follows.

 

For libdata in the kernel:

Supplement the libata.ignore_hpa=0 kernel flag in the boot loader configuration file


For libdata as a module:

bash -c 'echo options libata ignore_hpa=0 > /etc/modprobe.d/libata.conf' (as root or via sudo)

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk