📜 ⬆️ ⬇️

Host Protected Area or Where is my place?

Hello!
I always connect SATA-disks for live, the benefit the SATA standard allows it. And somehow it happened that I bought the hard drive, connected it to the home server, marked it up for the whole area, copied some files, and rebooted. However, after rebooting, 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 disk that is usually not visible to the operating system.
The motherboard that I have in my server, the Gigabyte GA-EP45-DS3 , has the dubious technology of saving a copy of the BIOS to a hard disk, to HPA. Although this function was disabled in BIOS, 512KB went to HPA from the disk, but the BIOS image itself was not copied to the hard disk.

How to work with HPA?


If you have a Gigabyte or Abit motherboard, your disks may have HPA enabled. To check this, run:
sudo hdparm -N /dev/sd[az] 

If HPA is turned off, the output will look 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 HPA before the next juggling of the hard drive power, you need to 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).
To turn off HPA permanently, just add p before the number of bytes:
 sudo hdparm -N p1465149168 /dev/sdX 

Hint


HPA can also be used for its own purposes, for example, to create an encrypted partition in a hidden area and connect it, temporarily disabling HPA on the hard drive. Such a section will not be visible as an “unpartitioned” area.

')

Source: https://habr.com/ru/post/179761/


All Articles