Host Protected Area or Where is my place?
Hello!
I always connect SATA disks to live, since the SATA standard allows this. And somehow it happened that I bought a hard drive, connected it to my home server, marked it in the entire area, copied some files, and rebooted. However, after a reboot, the OS did not mount the file system on this disk. What happened
HPA, or Host Protected Area, is an area of the hard drive that is usually not visible to the operating system.
The motherboard that is in my server, Gigabyte GA-EP45-DS3 , has the dubious technology of saving a copy of the BIOS to the hard drive in HPA. Despite the fact that this function was disabled in the BIOS, 512KB in the HPA "left" the disk, but the BIOS image itself was not copied to the hard drive.
If you have a Gigabyte or Abit motherboard, your drives may have HPA enabled. To verify this, do:
If HPA is off, the output will be something like this:
To turn off the HPA before the next twitching of the hard drive power, you must do the following:
Where 1465149168 is the number of bytes available to the user (can be taken from the output of the previous command).
And to turn off HPA permanently, just add p before the number of bytes:
HPA can be used for its own purposes, for example, to create an encrypted partition in a hidden area and mount it, temporarily disabling HPA on the hard drive. Such a section will not be visible as an “unallocated” area.
I always connect SATA disks to live, since the SATA standard allows this. And somehow it happened that I bought a hard drive, connected it to my home server, marked it in the entire area, copied some files, and rebooted. However, after a reboot, the OS did not mount the file system on this disk. What happened
What is HPA?
HPA, or Host Protected Area, is an area of the hard drive that is usually not visible to the operating system.
The motherboard that is in my server, Gigabyte GA-EP45-DS3 , has the dubious technology of saving a copy of the BIOS to the hard drive in HPA. Despite the fact that this function was disabled in the BIOS, 512KB in the HPA "left" the disk, but the BIOS image itself was not copied to the hard drive.
How to work with HPA?
If you have a Gigabyte or Abit motherboard, your drives may have HPA enabled. To verify this, do:
sudo hdparm -N /dev/sd[a-z]
If HPA is off, the output will be something like this:
/dev/sda:
max sectors = 1465149168/1465149168, HPA is disabled
/dev/sdb:
max sectors = 1953525168/1953525168, HPA is disabled
/dev/sdc:
max sectors = 2930277168/2930277168, HPA is disabled
/dev/sdd:
max sectors = 488397168/488397168, HPA is disabled
/dev/sde:
max sectors = 3907029168/3907029168, HPA is disabled
To turn off the HPA before the next twitching of the hard drive power, you must do the following:
sudo hdparm -N 1465149168 /dev/sdX
Where 1465149168 is the number of bytes available to the user (can be taken from the output of the previous command).
And to turn off HPA permanently, just add p before the number of bytes:
sudo hdparm -N p1465149168 /dev/sdX
Hint
HPA can be used for its own purposes, for example, to create an encrypted partition in a hidden area and mount it, temporarily disabling HPA on the hard drive. Such a section will not be visible as an “unallocated” area.