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

2009-12-15 Thread KOT MATPOCKuH
2009/12/12 Alexander Motin m...@freebsd.org:
 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.
Who knows this some external tool? :)
As I know hdparm is not ported to *BSD.

 With new CAM-based ATA
 probably it can be send via `camcontrol cmd ...`.
On this machine I'm using FreeBSD 7.x and have no ahci(4) support :(

I solved the problem by running hdparm -N p1953525168 sdf from linux
livecd, but this is not the fbsd way...

-- 
MATPOCKuH
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org


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

2009-12-15 Thread Jeremy Chadwick
On Tue, Dec 15, 2009 at 09:44:22PM +0300, KOT MATPOCKuH wrote:
 2009/12/12 Alexander Motin m...@freebsd.org:
  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.
 Who knows this some external tool? :)
 As I know hdparm is not ported to *BSD.
 
  With new CAM-based ATA
  probably it can be send via `camcontrol cmd ...`.
 On this machine I'm using FreeBSD 7.x and have no ahci(4) support :(
 
 I solved the problem by running hdparm -N p1953525168 sdf from linux
 livecd, but this is not the fbsd way...

Hmm... interesting.  A couple nights ago I ended up writing some
userland code that expands atacontrol(8) to support display of some
SMART statistics (e.g. atacontrol smart ad10)[1].

So what's this got to do with the above?

ata(4) layer offers an ioctl (IOCATAREQUEST) which literally allows you
to shove raw ATA commands at the disk itself.  This means implementing
the equivalent, i.e. atacontrol cmd, is possible.  Though like with
camcontrol, the implications are risky.

If folks are interested, I could try working on such, though honestly
the argv[] parser in atacontrol(8) needs to be re-written (IMHO).

What I'm saying: folks using straight ata(4) or ataahci(4) would use
atacontrol cmd while folks using ahci(4) would use camcontrol cmd.

Please let me/list know if either of these things are of interest.

[1]: It's hardly done and needs a *lot* of work, but I'll eventually
get it into a state where it could be committed and people could hack on
it/improve it.  It's no where near as defined as smartmontools (re: disk
vendor/model one-offs for attribute parsing and so on), but I figured
FreeBSD users might want something out-of-the-box which might give them
stats which are most commonly focused on (sector reallocation, drive
temperature, high spin-up times, CRC errors, etc.).  I guess you could
say I'm a bit proud of myself given that I was able to figure out how to
accomplish it by looking at some smartmontools source (messy, let me
tell you...) and ata(4) bits (since the ioctls aren't documented).

[2]: Yes, I'm still working on writing that doc that explains how to
read SMART data.  Going to have to end up doing it for work as well...
oh the joys.  :-)

-- 
| Jeremy Chadwick   j...@parodius.com |
| Parodius Networking   http://www.parodius.com/ |
| UNIX Systems Administrator  Mountain View, CA, USA |
| Making life hard for others since 1977.  PGP: 4BD6C0CB |
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org


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

2009-12-12 Thread KOT MATPOCKuH
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?

-- 
MATPOCKuH
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org


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

2009-12-12 Thread Kurt Jaeger
Hi!

 What is HPA? Why drive locks HPA? And... Can I unlock HPA from FreeBSD?

http://en.wikipedia.org/wiki/Host_protected_area

http://matt.simerson.net/2009/07/22/hpa-host-protected-area

-- 
p...@opsec.eu+49 171 310137211 years to go !
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org


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

2009-12-12 Thread Alexander Motin
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
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org