Trouble with drive size detection - 31MB visible size on 1TB drive.

Alexander Motin mav at FreeBSD.org
Sat Dec 12 18:10:23 UTC 2009


KOT MATPOCKuH wrote:
> Hi all!
> 
> I have a problem with drive size detection.
> After any power cycle my HDD ST31000340NS detected by FreeBSD 7.2 as 31Mb drive.
> For example:
> Dec  9 20:33:12 green kernel: ad14: 31MB <Seagate ST31000340NS SN06>
> at ata7-master SATA300
> Dec  9 20:33:12 green kernel: GEOM: ad14: corrupt or invalid GPT detected.
> Dec  9 20:33:12 green kernel: GEOM: ad14: GPT rejected -- may not be
> recoverable.
> 
> # atacontrol cap ad14
> [skipped]
> cylinders             64
> heads                 16
> sectors/track         63
> lba supported         65134 sectors
> lba48 supported       65134 sectors
> 
> # smartctl -a /dev/ad14
> [skipped]
> User Capacity:    33,348,608 bytes
> 
> I'm tried to reinit/detach/attach drive via atacontrol, but have no result.
> But after reboot the system in linux and then back to FreeBSD, I have
> correct disk geometry:
> ad14: 953869MB <Seagate ST31000340NS SN06> at ata7-master SATA300
> 
> In linux's dmesg.out I found this messages:
> [    8.984053] ata6: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
> [    9.120175] ata6.00: HPA unlocked: 65134 -> 1953525168, native 1953525168
> [    9.120180] ata6.00: ATA-8: ST31000340NS, SN06, max UDMA/133
> [    9.120183] ata6.00: 1953525168 sectors, multi 16: LBA48 NCQ (depth 31/32)
> [    9.179789] ata6.00: configured for UDMA/133
> [    9.179851] scsi 5:0:0:0: Direct-Access     ATA      ST31000340NS
>   SN06 PQ: 0 ANSI: 5
> [    9.179960] sd 5:0:0:0: Attached scsi generic sg5 type 0
> [    9.179992] sd 5:0:0:0: [sdf] 1953525168 512-byte logical blocks: (1.00 TB/93
> 1 GiB)
> [    9.180041] sd 5:0:0:0: [sdf] Write Protect is off
> [    9.180044] sd 5:0:0:0: [sdf] Mode Sense: 00 3a 00 00
> [    9.180066] sd 5:0:0:0: [sdf] Write cache: enabled, read cache:
> enabled, doesn't support DPO or FUA
> 
> What is HPA? Why drive locks HPA? And... Can I unlock HPA from FreeBSD?

HPA means "Host Protected Area". It is a method for BIOS or some other
infrastructure to reserve some space on disk for own use. May be
previously this drive was inserted into some RAID, which protects data
on disk in that way.

I have doubt that unconditional HPA unlock during boot that seems Linux
does is a proper behavior for the OS. IMHO it breaks general idea of HPA.

To unlock drive permanently SET MAX ADDRESS ATA command should be used
(probably the same as Linux uses) with Volatile bit set, to make it not
restore on power cycle. I don't know how to send this command with
legacy ata(4), you need some external tool. With new CAM-based ATA
probably it can be send via `camcontrol cmd ...`.

-- 
Alexander Motin


More information about the freebsd-stable mailing list