From owner-freebsd-fs@FreeBSD.ORG Tue Mar 12 10:25:40 2013 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 205BF58C for ; Tue, 12 Mar 2013 10:25:40 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au [211.29.132.183]) by mx1.freebsd.org (Postfix) with ESMTP id 90BE68FA for ; Tue, 12 Mar 2013 10:25:39 +0000 (UTC) Received: from c211-30-173-106.carlnfd1.nsw.optusnet.com.au (c211-30-173-106.carlnfd1.nsw.optusnet.com.au [211.30.173.106]) by mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id r2CAPPvi019168 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 12 Mar 2013 21:25:27 +1100 Date: Tue, 12 Mar 2013 21:25:25 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Cody Ritts Subject: Re: Aligning MBR for ZFS boot help In-Reply-To: <513E1208.5020804@caltel.com> Message-ID: <20130312203745.A1130@besplex.bde.org> References: <513C1629.50501@caltel.com> <513CD9AB.5080903@caltel.com> <513CE369.4030303@caltel.com> <1362951595.99445.2.camel@btw.pki2.com> <513E1208.5020804@caltel.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=bNdOu4CZ c=1 sm=1 a=u3bVZBOdoLwA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=cUKNXEIY390A:10 a=6I5d2MoRAAAA:8 a=d1Asgjw0WGCMbu39xngA:9 a=CjuIK1q_8ugA:10 a=3JYNrmlC3cAA:10 a=ApFyF_lCYB5S5Om7:21 a=2tyWdEw6j5jF6zq2:21 a=TEtd8y5WR3g2ypngnwZWYw==:117 Cc: freebsd-fs@freebsd.org X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Mar 2013 10:25:40 -0000 On Mon, 11 Mar 2013, Cody Ritts wrote: > Update -- > > fdisk WILL allow you to align without regards to drive geometry > > It can only be done in interactive mode: > http://lists.freebsd.org/pipermail/freebsd-geom/2011-May/004780.html It can be set in all modes. At least according to the man page: @ CONFIGURATION FILE @ When the -f option is given, a disk's slice table can be written using @ values from a configfile. The syntax of this file is very simple; each @ line is either a comment or a specification, as follows: @ @ # comment ... @ Lines beginning with a # are comments and are ignored. @ @ g spec1 spec2 spec3 @ Set the BIOS geometry used in slice calculations. There must be @ three values specified, with a letter preceding each number: @ @ cnum Set the number of cylinders to num. @ @ hnum Set the number of heads to num. @ @ snum Set the number of sectors/track to num. @ @ These specs can occur in any order, as the leading letter deter- @ mines which value is which; however, all three must be specified. @ @ This line must occur before any lines that specify slice informa- @ tion. @ @ It is an error if the following is not true: @ @ 1 <= number of cylinders @ 1 <= number of heads <= 256 Using 256 risks stepping on BIOS bugs or bugs in other OS's. The default for all large disks is 255. But this should only be used if you aren't trying to align things to a power of 2 boundary, since it is not a power of 2, so using it makes the calculations more complicated and/or requires skipping something like 8 full fake cylinders of size 63*255 sectors each to reach a fake cylinder starting on a 4K boundary. (This assumes a sector size of 512.) The old SCSI default should be used. IIRC, it is 32 sectors and 64 heads. 32 is the largest power of 2 less than the limit of 63, and 64 is a large though not maximal power of 2 less than the limit of 256. This makes the fake cylinder size 1 MB. @ 1 <= number of sectors/track < 64 @ @ The number of cylinders should be less than or equal to 1024, but Nah, the number of cylinders shouldn't be less than or equal to 1024, since if that is all it is then the maximum disk size with 512-byte sectors is 63*256*1024*512 = 7.87 GB = 8.46 disk maufacturers GB. You can't buy a new hard disk that small. However, fdisk only uses the number of cylinders for initializing defaults for partition sizes. It can be set to almost any garbage value if you don't use the defaults. @ this is not enforced, although a warning will be printed. Note Indeed, it still prints bogus warnings. @ that bootable FreeBSD slices (the ``/'' file system) must lie @ completely within the first 1024 cylinders; if this is not true, @ booting may fail. Non-bootable slices do not have this restric- @ tion. Note that this is not true, except it only says "may fail". Booting from (fake) cylinders above 1024 was implemented in the FreeBSD boot loader on 26 June 2000. @ @ Example (all of these are equivalent), for a disk with 1019 @ cylinders, 39 heads, and 63 sectors: @ @ g c1019 h39 s63 @ g h39 c1019 s63 @ g s63 h39 c1019 >> fdisk -i /dev/ada0 >> Do you want to change our idea of what BIOS thinks ? [n] Note that fdisk has no idea what the BIOS thinks. The numbers here are what FreeBSD thinks. FreeBSD used to try to determine what the BIOS thinks, but this was broken by GEOM. GEOM just uses whatever the disk says is its "firmware" geometry. But the ATA standard specifies that for disks larger than the magic 8.46 GB number mentioned above, that the fake geometry is always 63 sectors only 16 heads. Thus: - the default geometry in fdisk and presumably in gpart is wrong if the BIOS doesn't use it. Some BIOSes default to 240 heads. Some BIOSes allow you to choose between several fake geometries. Some BIOSes allow you to specify the precise geometry. - with only 16 heads, the 1024-cylinder limit is reached at a disk size of only 528 disk manufacturers GB, so fdisk's bogus warnings about this occur for disks less that 20 years old instead of only for disks less than 14 years old. Last time I looked, Linux fdisk[s] worked better on FreeBSD than FreeBSD fdisk, partly because they don't depend on special ioctls, so that they know that they don't know the BIOS geometry. Specifying the geometry is so routine that it is a command-line parameter in all Linux fdisks in FreeBSD ports (at least in old versions). Bruce