Date: Tue, 12 Mar 2013 21:25:25 +1100 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Cody Ritts <cr@caltel.com> Cc: freebsd-fs@freebsd.org Subject: Re: Aligning MBR for ZFS boot help Message-ID: <20130312203745.A1130@besplex.bde.org> In-Reply-To: <513E1208.5020804@caltel.com> References: <513C1629.50501@caltel.com> <alpine.BSF.2.00.1303101006490.5989@wonkity.com> <513CD9AB.5080903@caltel.com> <alpine.BSF.2.00.1303101326530.7218@wonkity.com> <513CE369.4030303@caltel.com> <alpine.BSF.2.00.1303101349540.7637@wonkity.com> <1362951595.99445.2.camel@btw.pki2.com> <alpine.BSF.2.00.1303101807550.8481@wonkity.com> <CABXB=RTt-j0SGxktWMfLcgLAEN6Vi%2Bf=psBuN0jQaJthk_3cbw@mail.gmail.com> <513E1208.5020804@caltel.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130312203745.A1130>