From owner-freebsd-stable@FreeBSD.ORG Sat Dec 12 18:10:23 2009 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0AEE106566C for ; Sat, 12 Dec 2009 18:10:23 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-fx0-f228.google.com (mail-fx0-f228.google.com [209.85.220.228]) by mx1.freebsd.org (Postfix) with ESMTP id 310338FC12 for ; Sat, 12 Dec 2009 18:10:22 +0000 (UTC) Received: by fxm28 with SMTP id 28so305265fxm.13 for ; Sat, 12 Dec 2009 10:10:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=2qBaihgv6DUl5oH8dXAVE+Db+HxuPCk0YS5Lp2Fz2wI=; b=vFXJJ91Hr5c32z2oewOT4P8pD7xwXPWXR2klgDp6o14KmpSgVBHRjEKcNAmYCeOHA5 9qrqvSJsBKXT5JEx01r7fetGqh78Tza0RcZmRojXfi5QnZj2wdwBerr4hq5We/BUP9mq s9XolbtHQrYnGsYXEKown5yTXdqnfHfn5CTjE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=SC+2mdRt8jSEavys8FpnQ8gzGFjHDqDlFfaKGCt75lO5R/1bE+wq6Qm/xMDWK4WhA5 uOfCgb1b9Z0Q9YBYhUl/I2/+AgJeUxVtZgmHv8lOIG8uyVZ9Xy/QPuDqakVlDTUlawHF JYM/9x+fyWGkL0MCRUQRmcox4cD3/9V2zOB5I= Received: by 10.223.5.25 with SMTP id 25mr3224429fat.38.1260641422102; Sat, 12 Dec 2009 10:10:22 -0800 (PST) Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id 13sm1033553fxm.13.2009.12.12.10.10.21 (version=SSLv3 cipher=RC4-MD5); Sat, 12 Dec 2009 10:10:21 -0800 (PST) Sender: Alexander Motin Message-ID: <4B23DC8B.8020807@FreeBSD.org> Date: Sat, 12 Dec 2009 20:10:19 +0200 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20091212) MIME-Version: 1.0 To: KOT MATPOCKuH References: <1260638581.00193503.1260625202@10.7.7.3> In-Reply-To: <1260638581.00193503.1260625202@10.7.7.3> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-stable@freebsd.org Subject: Re: Trouble with drive size detection - 31MB visible size on 1TB drive. X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Dec 2009 18:10:23 -0000 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 > 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 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