Aligning MBR for ZFS boot help

Cody Ritts cr at caltel.com
Tue Mar 12 20:24:49 UTC 2013


On 3/12/13 3:25 AM, Bruce Evans 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:


In interactive mode, you can simply set the start and size of your 
partition be done with it and boot away.  If you then export that config 
file, and re-run it, you are back to being aligned to CHS.

I would imagine that adjusting your CHS ~correctly~ in the config file 
will allow you to to do it, but I have not found myself motivated to 
really learn about adjusting those values.  I will have to pick that up 
someday I suppose.

For informational purposes here is
1) partition w/ offset
2) show results
3) export/import config
4) show results with adjusted offset

> root@:/root # fdisk -i ada0
> Do you want to change our idea of what BIOS thinks ? [n]
> Do you want to change it? [n] y
> Supply a decimal value for "sysid (165=FreeBSD)" [165]
> Supply a decimal value for "start" [63] 4096
> Supply a decimal value for "size" [125045361] 125041328
> Correct this automatically? [n]
> Explicitly specify beg/end address ? [n]
> Are we happy with this entry? [n] y
> Do you want to change it? [n]
> Do you want to change it? [n]
> Do you want to change it? [n]
> Do you want to change the active partition? [n]
> Should we write new partition table? [n] y
>
> root@:/root # gpart show ada0
> =>       63  125045361  ada0  MBR  (59G)
>          63       4033        - free -  (2M)
>        4096  125041328     1  freebsd  [active]  (59G)
>
> root@:/root # fdisk -p ada0
> # /dev/ada0
> g c124053 h16 s63
> p 1 0xa5 4096 125041328
> a 1
>
> root@:/root # fdisk -p ada0 > command
>
> root@:/root # fdisk -f command ada0
> ******* Working on device /dev/ada0 *******
> fdisk: WARNING line 2: number of cylinders (124053) may be out-of-range
>     (must be within 1-1024 for normal BIOS operation, unless the entire disk
>     is dedicated to FreeBSD)
> fdisk: WARNING: adjusting start offset of partition 1
>     from 4096 to 4158, to fall on a head boundary
> fdisk: WARNING: adjusting size of partition 1 from 125041328 to 125041266
>     to end on a cylinder boundary
>
> root@:/root # fdisk -p ada0
> # /dev/ada0
> g c124053 h16 s63
> p 1 0xa5 4158 125041266
> a 1
>
> root@:/root # gpart show ada0
> =>       63  125045361  ada0  MBR  (59G)
>          63       4095        - free -  (2M)
>        4158  125041266     1  freebsd  [active]  (59G)

Thanks,

Cody


More information about the freebsd-fs mailing list