Over-provisioning SSDs

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)

    • Related Articles

    • Configuring Over-Provisioning for Intel SSDs

      The Over-Provisioning setting of an SSD can be modified by a user. It must be performed on an SSD that is in a completely clean state. This can be an SSD that is fresh out of the box that has never been used or by secure erasing the SSD. You can use ...
    • HDD models and serials

      Q: I have a failed hard drive, but I do not know the model and serial. How do I obtain this information? A: If the the component is still visible to your operating system and hard drive controller, you can utilize a number of graphical and command ...
    • How to Install SuperDoctor on Linux

      Download latest version of SuperDoctor from Supermicro's website: supermicro.com/products/nfo/SMS_SD5.cfm Unzip the archive after it has finished downloading. Locate the SuperDoctor5Installer[...].bin file and rename it to ...
    • Create Linux LiveCD from Windows using Rufus

      Download Rufus. Download a Linux ISO: Ubuntu: Direct Download: http://www.ubuntu.com/download/desktop Torrent, Net Install: http://www.ubuntu.com/download/alternative-downloads CentOS: Direct Download or Torrent: https://www.centos.org/download/ ...
    • Default credentials (Linux)

      Q: I just received a system with a pre-installed Linux operating system. What is the password for logging into the system? A: This will depend on the distribution we installed, as various distributions can carry different default access policies. The ...