If you are installing on an New drive, you will need to create the MBR geometry first:
Fixit# gpart create -s mbr ad0
This example already has two slices defined on the drive.
Fixit# gpart show ad0
=> 63 625142385 ad0 MBR (289G)
63 209712447 1 !7 (100G)
209712510 417690 2 !136 (204M)
210130200 415012248 - free - (198G)
Create a third slice using the size parameter. You may omit the size to use the remainder of the disk. Then create a BSD partition table on the new slice.
Fixit# gpart add -s 198G -t freebsd ad0 ad0s3 added Fixit# gpart create -s BSD ad0s3 ad0s3 created
And examine the result:
Fixit# gpart show ad0
=> 63 625142385 ad0 MBR (289G)
63 209712447 1 !7 (100G)
209712510 417690 2 !136 (204M)
210130200 415012248 3 freebsd (198G)
Sizes and offsets are specified in sectors (1 sector is typically 512 bytes) but can also be specified in MB or GB by adding a 'M' or 'G' suffix.
Some BIOSes might require setting a Slice active. Here we set partition 1 (the Windows Partiton) as the active partition.
Fixit# gpart set -a active -i 1 ad0
Fixit# gpart show ad0s3
=> 0 415012248 ad0s3 BSD (198G)
0 415012248 ad0s3 - free - (198G)
Fixit# gpart add -s 1G -t freebsd-ufs ad0s3 ad0s3a added
Fixit# gpart show ad0s3
=> 0 415012248 ad0s3 BSD (198G)
0 2097152 1 freebsd-ufs (1G)
2097152 412915096 - free - (197G)
Fixit# gpart add -s 4G -t freebsd-swap ad0s3 ad0s3b added
Fixit# gpart show ad0s3
=> 0 415012248 ad0s3 BSD (198G)
0 2097152 1 freebsd-ufs (1.0G)
2097152 8380827 2 freebsd-swap (4.0G)
10477979 404534269 - free - (193G)
Fixit# gpart add -t freebsd-zfs ad0s3 ad0s3a added
Fixit# gpart show ad0s3
=> 0 415012248 ad0s3 BSD (198G)
0 2097152 1 freebsd-ufs (1.0G)
2097152 8380827 2 freebsd-swap (4.0G)
10477979 404534269 4 freebsd-zfs (193G)
Fixit# gpart bootcode -b /mnt2/boot/boot0 ad0 bootcode written to ad0
It's ok if you get an “unknown class” message here, but it you get “failed to install” or the like, you'll need to try again after making sure that nothing is mounted from /dev/ad0.
Fixit# gpart bootcode -b /mnt2/boot/boot ad0s3 bootcode written to ad0s3
This may fail with an “operation not permitted” error message, since the kernel likes to protect critical parts of the disk. If this happens for you, run:
Fixit# sysctl kern.geom.debugflags=0x10
Fixit# kldload /mnt2/boot/kernel/opensolaris.ko Fixit# kldload /mnt2/boot/kernel/zfs.ko
Fixit# mkdir /boot/zfs Fixit# zpool create zroot /dev/ad0s3d Fixit# zpool set bootfs=zroot zroot
zroot is the name of the ZFS Pool, it could be anything (i.e. tank, data, …)
Fixit# mkdir /zroot/bootdir Fixit# newfs /dev/ad0s3a Fixit# mount /dev/ad0s3a /zroot/bootdir
The fletcher4 algorithm should be more robust than the fletcher2 algorithm.
Fixit# zfs set checksum=fletcher4 zroot
Fixit# zfs create -o compression=on -o exec=on -o setuid=off zroot/tmp Fixit# chmod 1777 /zroot/tmp
Fixit# zfs create zroot/usr Fixit# zfs create zroot/usr/home Fixit# cd /zroot ; ln -s /usr/home home
Fixit# zfs create -o compression=lzjb -o setuid=off zroot/usr/ports Fixit# zfs create -o compression=off -o exec=off -o setuid=off zroot/usr/ports/distfiles Fixit# zfs create -o compression=off -o exec=off -o setuid=off zroot/usr/ports/packages
If you use nullfs or nfs to mount /usr/ports to different locations/servers, you will also need to nullfs/nfs mount /usr/ports/distfiles and/or /usr/ports/packages.
Fixit# zfs create -o compression=lzjb -o exec=off -o setuid=off zroot/usr/src
Fixit# zfs create zroot/var Fixit# zfs create -o compression=lzjb -o exec=off -o setuid=off zroot/var/crash Fixit# zfs create -o exec=off -o setuid=off zroot/var/db Fixit# zfs create -o compression=lzjb -o exec=on -o setuid=off zroot/var/db/pkg Fixit# zfs create -o exec=off -o setuid=off zroot/var/empty Fixit# zfs create -o compression=lzjb -o exec=off -o setuid=off zroot/var/log Fixit# zfs create -o compression=gzip -o exec=off -o setuid=off zroot/var/mail Fixit# zfs create -o exec=off -o setuid=off zroot/var/run Fixit# zfs create -o compression=lzjb -o exec=on -o setuid=off zroot/var/tmp Fixit# chmod 1777 /zroot/var/tmp
Fixit# cd /dist/8.0-* Fixit# export DESTDIR=/zroot Fixit# for dir in base catpages dict doc games info lib32 manpages ports; \ do (cd $dir ; ./install.sh) ; done Fixit# cd src ; ./install.sh all Fixit# cd ../kernels ; ./install.sh generic Fixit# cd /zroot/boot ; cp -Rlp GENERIC/* /zroot/boot/kernel/
Fixit# zfs set readonly=on zroot/var/empty
Fixit# chroot /zroot
Fixit# echo 'zfs_enable="YES"' > /etc/rc.conf Fixit# echo 'hostname="beastie.mydomain.local"' >> /etc/rc.conf Fixit# echo 'ifconfig_re0="DHCP"' >> /etc/rc.conf
Replace re0 with the name of the Network interface for the new system
Fixit# echo 'zfs_load="YES"' > /boot/loader.conf Fixit# echo 'vfs.root.mountfrom="zfs:zroot"' >> /boot/loader.conf
Fixit# passwd
Fixit# tzsetup
Fixit# cd /etc/mail Fixit# make aliases
Fixit# umount /dev Fixit# exit
Fixit# cp /boot/zfs/zpool.cache /zroot/boot/zfs/zpool.cache
Fixit# cd /zroot Fixit# mv boot bootdir/ Fixit# ln -s bootdir/boot /zroot/boot Fixit# chflags -h sunlink /zroot/boot
Fixit# mkdir /zroot/etc Fixit# cat << EOF > /zroot/etc/fstab # Device Mountpoint FStype Options Dump Pass# /dev/ad0s3a /bootdir ufs rw 0 0 /dev/ad0s3b none swap sw 0 0 EOF
Fixit# export LD_LIBRARY_PATH=/mnt2/lib
Fixit# umount /zroot/bootdir Fixit# zfs unmount -a
Fixit# zfs set mountpoint=legacy zroot Fixit# zfs set mountpoint=/tmp zroot/tmp Fixit# zfs set mountpoint=/usr zroot/usr Fixit# zfs set mountpoint=/var zroot/var