ZFS on FreeBSD
ZFS on FreeBSD
by Craig Mayhew on Sun 10th Mar 2013 under General/Techie
For this test I will be running FreeBSD in a VirtualBox virtual machine. These instructions will work regardless of this.
Download the 64bit iso of FreeBSD. I am using version 9.1.
Install FreeBSD form the livecd. I decided to drop the games from the install.
I initially tried to get a bootable zfs partition going, but after several hours of failed attempts using this guide:
, I decided I would leave plenty of drive space spare when partitioning the disk. I set 64GBs up for the operating system and left the rest spare for the ZFS.
Note: I have used da0 for my drive as it is a SAS drive. If you are using SATA then you will need ada0.
# gpart add -t freebsd-zfs -l disk1 da0
So, assuming you have booted freebsd, you now need to create the zfs volume.
# kldload opensolaris
# kldload zfs
# zpool create -m /zfs disk1 da0p1
Enable dedupe using fletcher4, verify hashes when writing to disk and enable compression:
# zfs set dedupe=on disk1
# zfs set dedup=fletcher4,verify disk1
# zfs set compression=gzip disk1
We will want it to mount the volume every time the system boots
# echo 'zfs_enable="YES"' >> /etc/rc.conf
Great, now we need something like network file sharing for windows so I can use it in a windows environment and just dump backups to it. (Prepare for a lot of compiling and a long wait)
# cd /usr/ports/
# portsnap fetch
# portsnap extract
# portsnap update
# cd net/samba36/
# make install
You will be asked for a whole bunch of optional packages, just stick with the defaults as the menus appear.
You will be wanting Samba to available after reboot:
# echo 'samba_enable="YES"' >> /etc/rc.conf
I am sharing my /zfs directory and have setup my smb.conf like so:
# vi /usr/local/etc/smb.conf
In here goes your password:
# vi /usr/local/etc/samba/smbpasswd
Do not ever use a ZFS partition for SWAP, do not place any swap files within a ZFS filesystem. The reason for this is that ZFS requires a fair amount of RAM (some argue over 1GB for every 1TB of unique data on disk). If the data ZFS keeps in RAM falls into swap then your system will very quickly ground to a halt and slowly consume all it's RAM.
Back to home
© 2005-2020 Craig Mayhew