Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

SOLVED How to setup FreeNAS on a (partitioned) single SSD with boot and jails.

seltz

Member
Joined
Dec 15, 2015
Messages
27
I have a fairly low-use machine, and wanted to run FreeNAS as a partition on an SSD to allow space for jails.

Motivations:
- iocage (i.e. jails) cannot run on freenas-boot. I believe iocage's own recommendations says it won't run on freebsd-boot partitions, and the FreeNAS GUI won't let you either.
- I don't want to have another usb drive or ssd drive dedicated for freebsd-boot, nor do I want to use the full ssd drive for just freebsd-boot. I realize this is not the normal recommendation (freenas's installer only lets you install on the whole disk) and carries some risk of failure. I consider my needs fairly minimal, and only have so many SATA/USB ports for storage devices.

Prior Work I based this on:
- Jeremy Lea's 'Installing FreeNAS on a Partition': https://forums.servethehome.com/ind...ing-FreeNAS-on-a-partition.27798/#post-271656
- A prior failed attempt of trying to do zfs send / recv to copy & boot freenas-boot instead of mirroring: https://www.ixsystems.com/community...pool-onto-a-usb-drive-and-boot-from-it.85839/

What you need if starting from scratch, ignoring your storage hard drives:
- USB drive A - flashed with downloaded freenas iso.
- USB drive B - to install freenas on to start with. I used a fairly small one 8gb, since the mirror can be larger.
- SSD drive C - that will be the final place for freenas-boot, swap, jails, etc.

Steps:
1. Install FreeNAS onto USB drive B as normal.
2. Boot FreeNAS from USB drive B.
3. From here, run the following commands (I'm just running these one-by-one)

#ssd drive - wipe contents (SSD is ada0)
gpart destroy -F /dev/ada0

#ssd drive - setup gpt partitioning scheme
gpart create -s gpt ada0

#ssd drive - setup boot partition
# and embed bootstrap code in
# partition scheme metadata
# note: i follow gpart's manpage advice on making the size 472
# so the swap partition will be aligned correctly.

gpart add -b 40 -s 472 -t freebsd-boot ada0
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0


#ssd drive - add swap partition at first available offset - will be ada0p2
gpart add -s 16g -t freebsd-swap -l swap0 ada0

#ssd drive - add boot partition - will be ada0p3
gpart add -s 16g -t freebsd-zfs -l root0 ada0

#ssd drive - add jail partition - will be ada0p4
gpart add -t freebsd-zfs -l jail0 ada0

#setup jail pool
zpool create jail /dev/ada0p4
umount /jail
zpool export jail


#setup boot as mirror from our usb drive (usb drive B is da0, da0p2 is the freenas-boot pool)
zpool attach freenas-boot /dev/da0p2 /dev/ada0p3

#wait for resilver! run 'zpool status' to check status
zpool offline freenas-boot /dev/da0p2
zpool detach freenas-boot /dev/da0p2


4. Reboot/remove usb drive B, and boot from SSD. You may need to import the 'jail' pool within the freenas GUI before setting up jails.
 

Patrick M. Hausen

Dedicated Sage
Joined
Nov 25, 2013
Messages
1,587
;)
 
Top