Dualboot and ZFS

Trond Endrestøl Trond.Endrestol at fagskolen.gjovik.no
Thu Jan 18 08:48:46 UTC 2018


On Thu, 18 Jan 2018 12:14+0700, Victor Sudakov wrote:

> Trond Endrestøl wrote:
> > [script]# sysctl vfs.zfs.min_auto_ashift=12
> > vfs.zfs.min_auto_ashift: 9 -> 12
> 
> Why do you change this?
> 
> "Min ashift used when creating new top-level vdevs", hmm. You probably
> know something I don't. 
> [dd]

If you know you will be using 4Kn (AF) drives now or in the near 
future, you might as well prepare ZFS. Otherwise leave ashift at 9.

> > !!! Write /boot/zfsboot as two separate pieces to /dev/ada0s3{,a} !!!
> > 
> > [script]# dd if=/boot/zfsboot of=/tmp/zfsboot1 count=1
> > 1+0 records in
> > 1+0 records out
> > 512 bytes transferred in 0.000383 secs (1337758 bytes/sec)
> > [script]# gpart bootcode -b /tmp/zfsboot1 /dev/ada0s3
> > bootcode written to ada0s3
> 
> Why do you need this trick with /tmp/zfsboot1 ? Why not
> 
> sysctl kern.geom.debugflags=0x10
> dd if=/boot/zfsboot of=/dev/ada0s3 count=1 
> 
> The example in zfsboot(8) is even weirder. They create a BSD label
> within an MBR slice, but never any partitions within. Why do they do
> it like that? Quoting the manual page:
> 
>          gpart create -s BSD ada0s1
>          gpart bootcode -b /boot/boot0 ada0
>          gpart set -a active -i 1 ada0
>          dd if=/boot/zfsboot of=/dev/ada0s1 count=1
>          dd if=/boot/zfsboot of=/dev/ada0s1 iseek=1 oseek=1024
> 
> > [script]# dd if=/boot/zfsboot of=/dev/ada0s3a skip=1 seek=1024
> > 128+0 records in
> > 128+0 records out
> > 65536 bytes transferred in 0.043591 secs (1503439 bytes/sec)
> 
> Should the "of=" target here be ada0s3a or just ada0s3 ?

I followed step 10 of 
https://wiki.freebsd.org/RootOnZFS/ZFSBootPartition.
I'm sure you can optimize away the drudgery.

The key is to place some of the bootcode in the boot block of the 
disklabel and the remainder in the boot block of the zpool.

-- 
Trond.


More information about the freebsd-questions mailing list