Install FreeBSD 9.1 on ZFS single bootable root drive

Boot off dvd then select Live at the first menu.

Login as root

gpart create -s gpt ada0 (if gpart says there’s already one do: destroy ada0 or gpart destroy -F ada0 if it says busy to destroy the existing. I’ve seen it say this on a drive that had windows on it originally)

gpart add -b 34 -s 64k -t freebsd-boot ada0

gpart add -s 4G -a 4k -t freebsd-swap -l swap0 ada0 (-l is a lowercase L) (adjust according to half RAM if 8GB or more, set for equal to RAM if between 1.5GB – & less than 8GB | Set for 2x RAM size if less than 1.5GB, for example if 1.5GB set for 1500M rather than 4G, if 1GB RAM set for 2G)

gpart add -a 4k -t freebsd-zfs -l disk0 ada0 (-l is a lowercase L)

gpart show (Shows configuration just created)

gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0 (1 is number one)

zpool create -o altroot=/mnt -o cachefile=/var/tmp/zpool.cache rpool /dev/gpt/disk0

If less than 4GB RAM the following will echo next: (safe to ignore)

ZFS NOTICE: Prefetch is disabled by default if less than 4GB of RAM is present; to enable, add “vfszfs.prefetch_disable=0″ to /boot/loader.conf.

zpool status (Shows rpool just created)

zfs create -o compression=on -o setuid=off rpool/tmp

chmod 1777 /mnt/tmp

zfs create rpool/usr

zfs create rpool/usr/home

cd /mnt

ln -s usr/home home

cd –

zfs create rpool/usr/local

zfs create -o compression=on -o exec=off -o setuid=off rpool/usr/src

zfs create rpool/var

zfs create -o exec=off -o setuid=off rpool/var/backups

zfs create -o compression=on -o exec=off -o setuid=off rpool/var/crash

zfs create -o exec=off -o setuid=off rpool/var/db

zfs create -o compression=on -o exec=on -o setuid=off rpool/var/db/pkg

zfs create -o exec=off -o setuid=off rpool/var/empty

zfs create -o compression=on -o exec=off -o setuid=off rpool/var/log

zfs create -o compression=on -o exec=off -o setuid=off rpool/var/mail

zfs create -o exec=off -o setuid=off rpool/var/run

zfs create -o compression=on -o setuid=off rpool/var/tmp

chmod 1777 /mnt/var/tmp

zfs create -o compression=on -o setuid=off rpool/usr/ports

zfs create -o exec=off -o setuid=off rpool/usr/ports/distfiles

zfs create -o exec=off -o setuid=off rpool/usr/ports/packages

zpool set bootfs=rpool rpool

mkdir -p /mnt/boot/zfs

cp -p /var/tmp/zpool.cache /mnt/boot/zfs/zpool.cache

sh

cd /usr/freebsd-dist

export DESTDIR=/mnt

for file in base.txz lib32.txz kernel.txz doc.txz ports.txz (I Don’t want Release Ports so exclude ports.txz) src.txz;

do (cat $file | tar –unlink -xpJf – -C ${DESTDIR:-/}); done

***THERE ARE TWO DASHES WHERE YOU SEE THE DASHunlink***

exit

echo ‘zfs_enable=”YES”‘ >> /mnt/etc/rc.conf

echo ‘zfs_load=”YES”‘ >> /mnt/boot/loader.conf

echo ‘vfs.root.mountfrom=”zfs:rpool”‘ >> /mnt/boot/loader.conf

ee /mnt/etc/fstab

# Device Mountpoint FStype Options Dump Pass

/dev/gpt/swap0 none swap sw 0 0

REBOOT!!! (REMOVE DISC)

Category(s): FreeBSD

Comments are closed.