UPDATE
FreeNAS moved to github, and I have happily followed them :) You can find my fork at https://github.com/bionoren/freenas (look for build instructions in README-EXTRA on branches I’ve ported), and ISOs and other helpful files at https://github.com/bionoren/freenas-extra. Please report any future problems on github issues.
Want to run Crashplan on your FreeNAS box? If you’re using the x64 builds, you can either download the 8.3.0-RELEASE-P1 iso right now and skip to Setup Crashplan, or grab some coffee and start at the very beginning…
Setup Virtual Machine
- Create a new virtual machine (I used virtual box)
- Give it 1gb of memory and a 20gb dynamically sized disk (note: 512mb of RAM is not enough – it won’t crash, but it will take forever)
- Edit the VM settings and set the hardware clock to UTC time
- Configure any other settings you like[1]
- boot from FreeBSD image (FreeBSD-8.3-RELEASE-amd64-dvd1.iso)
Install FreeBSD
- Download and mount the FreeBSD install disk FreeNAS is based on (as of this writing, FreeBSD-8.3-RELEASE-amd64-dvd1.iso)
- Run the installer
- Select your region
- From the main menu, choose “Standard” install
- From the disk utilization menu, select “Use Entire Disk” and continue
- Select “BootMGR” as your boot manager and continue
- From the partitioning menu, select “Auto Defaults”
- Install the “Kern-Developer” packages
- select appropriate doc language
- Answer “Yes” to installing the ports collection
- Select Exit option
- Select CD/DVD install source
- commit, and wait a little while (~5 minutes)
- For “Configure ethernet devices”, just select whatever the first option is. IPv6 is optional, DHCP is not.
- Type a hostname when prompted, then keep hitting tab until Ok is highlighted (don’t worry about the other fields).
- Answer no to are you a “network gateway”
- No to “inetd”
- Yes to “SSH login”
- No to “anonymous FTP access”
- No to NFS server
- No to NFS client
- You can customize console settings if you want, but there’s not much to do there
- Set your time zone. Your clock IS in UTC (remember, we set that as part of the VM settings), then find your time zone. This isn’t technically necessary – your machine will still build on Costa Rica time – but it’s kind of nice.
- No “PS/2, serial, or bus mouse”
- No to browsing the ports collection now
- No to adding more user accounts
- Set a root password
- No to “Visit the general configuration menu”
- Exit install
Setup install environment
- Login as root (this will drop you to a CSH shell). It’s not strictly necessary, but I will assume bash, so lets install it:
pkg_add -r bash
which bash
chsh -s [output of "which bash"] root
exit
- login as root
- Install packages:
pkg_add -r subversion
pkg_add -r cdrtools
- (optional)
pkg_add -r vim
pkg_add -r wget
rehash
cd /usr/local
svn co svn://svn.code.sf.net/p/freenas/code/tags tags
- go read a book (< hour)
cd tags/8.3.0-RELEASE-p1/
(or whichever version you’re installing today)wget http://www.bionoren.com/freenas-files.zip
unzip freenas-files.zip
patch -p0 -i freenas.diff
- Setup environment (Note: you need to do this every time the VM starts)
kldload linux.ko
export OVERRIDE_LINUX_BASE_PORT=f10
export OVERRIDE_LINUX_NONBASE_PORTS=f10
export FREEBSD_CVSUP_HOST=cvsup10.freebsd.org
Build
./build/do_build.sh
wait ~5 hours (you can abort if you notice when it gets to building\compressing image)
Notes:
- if the build dies in emulators_linux_base-f10, you probably forgot to kldload linux.ko
- if the build dies in sysutils_linux-procps, you probably forgot to set one of the OVERRIDE_ environment variables
- if packages don’t build, look in nanobsd/common and try things like this (around line 226):
SRC_BASE=/usr/src \
WRKDIRPREFIX=/usr/workdir -C /usr/ports/$port_path \
clean package BATCH=yes -DUSE_PACKAGE_DEPENDS \
- $* clean -DFORCE_PACKAGE -DFORCE_PKG_REGISTER"
+ $* clean -DFORCE_PACKAGE -DFORCE_PKG_REGISTER > buildlog.txt"
rm ${NANO_WORLDDIR}/etc/resolv.conf
rm -rf ${NANO_WORLDDIR}/usr/obj
rm -rf ${NANO_WORLDDIR}/usr/workdir
This will give you a file in /os-base/amd64/buildlog.txt with a log for the last package that tried to build. Well, a log for part of the effort, but you get the idea - ignore any warnings about prefetch being disabled
Build Java
- shutdown the virtual machine
- create a snapshot (in case something goes wrong)
- start the VM
- login as root
- Setup the environment again:
kldload linux.ko
export OVERRIDE_LINUX_BASE_PORT=f10
export OVERRIDE_LINUX_NONBASE_PORTS=f10
cd /usr/local/tags/8.3.0-RELEASE-p1/
cat FreeBSD/ports/java/linux-sun-jre17/distinfo
– make sure the jre file name in that output exactly matches the one you downloaded. Note that oracle tends to use *.gz instead of *.tar.gz. Just rename the file to *.tar.gz.cp jre* FreeBSD/ports/distfiles
cp jre* os-base/amd64/ports/distfiles/
patch -p0 -i freenas2.diff
./build/do_build.sh
(~40 minutes)- If the build dies installing java, you probably forgot to copy the jre* file somewhere, or you have the wrong jre file version
- if the build is aborted for any reason after java is built, you’ll need to shutdown and roll back to the pre-java snapshot before trying the build again
./build/create_iso.sh
(~8 min)scp os-base/amd64/FreeNAS-8.3.0-RELEASE-p1-x64.iso user@ip:/destination/dir/
- shutdown the virtual machine
Upgrade FreeNAS
Follow Freenas’ install/upgrade instructions to install/upgrade FreeNAS
Setup Crashplan
- Boot freenas
- open a shell from the web GUI, or use ssh
cd /mnt/somewhere/on/your/zfs
- download and unzip the FreeNAS files in somewhere/on/your/zfs[2]
cp -Rp /compat/linux /mnt/somewhere/on/your/zfs/
(Note: it’s /compat/linux, not /compat/linux/)- Download and extract crashplan for Linux
- copy the crashplan install folder to your NAS under /mnt/somewhere/on/your/zfs/linux/
- edit fstab to have the right path(s) for your crashplan archive directories and your linux folder at /mnt/somewhere/on/your/zfs/linux
bash /mnt/somewhere/on/your/zfs/setup.sh
(ignore error messages related to crashplan)cd /compat/linux
./bin/bash
cd CrashPlan-install
./install.sh
– use relative paths from /compat/linux/, not full NAS paths (i.e. /usr/local/, not /mnt/somewhere/on/your/zfs/linux/usr/local)- edit /compat/linux/usr/local/crashplan/bin/run.conf and modify two lines to end with this:
SRV_JAVA_OPTS="...
-Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.PollSelectorProvider"
GUI_JAVA_OPTS="...
-Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.PollSelectorProvider" /compat/linux/bin/bash /compat/linux/usr/local/crashplan/bin/CrashPlanEngine start
- Follow Crashplan’s instructions to connect to a headless client
- Enjoy! :)
Starting after a reboot
run bash /mnt/somewhere/on/your/zfs/setup.sh
to mount everything and start crashplan.
Eventually, I’ll put together a cron job to check if /compat/linux/ is mounted, and run setup.sh if it isn’t
Sources:
- http://kim.scarborough.chicago.il.us/do/nerd/tips/crashplan
- http://worrbase.com/2012/03/31/Crashplan.html
- http://forums.freenas.org/showthread.php?51-How-to-compile-FreeNAS-8
- Many, many random websites
[1]For reference and time comparison purposes, I gave my VM 8 processors (2Ghz Core i7) with a 95% execution cap and enabled PAE/NX support. I’m also on an SSD. Note: the VM will use 4 core pretty much the whole time, and all 8 only rarely. That may have something to do with hyper-threading though.
[2]You can delete all the files from the *.zip you downloaded except setup.sh and fstab.
18 Responses to FreeNAS + Crashplan