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

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703

Bonoboy

Cadet
Joined
Jul 13, 2018
Messages
9
Excellent article. Thank you for the step by step guide.

Had a similar scenario, with the addition of a second SSD. Was setting up mirrored boot with two 250 GB SSD and wanted to use unused portion for jail. Followed all steps from seltz upto step '#ssd drive - add jail partition - will be ada0p4' for both SSD. Then created a mirrored pool with two partitions for jail. This is for TrueNAS. Note that, needed to use boot-pool for turenas vs freenas-boot for freenas.

All steps are listed below. Copying seltz's (thanks seltz) steps for completeness.

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

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

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

#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 add -b 40 -s 472 -t freebsd-boot ada1

gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1

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

#ssd drive - add boot partition - will be ada0p3, ada1p3 (I had allocated 32g, probably not needed)
gpart add -s 16g -t freebsd-zfs -l root0 ada0
gpart add -s 16g -t freebsd-zfs -l root0 ada1

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

Steps below are bit different from post above (colored text):

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

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


#wait for resilver! run 'zpool status' to check status

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

Thanks.
Awesome. Tested it with VirtualBox and working as expected. Had some problems with finding the right device names.
This was something i didn't understand completely. But trial and error helped. :)
So now heading over to the PC. Many thanks for this. Much appreciated.
 

Bonoboy

Cadet
Joined
Jul 13, 2018
Messages
9
Many thanks for this solution. It's awesome.
One question though.
Is it possible to do the parts the starter of this topic made. And later attach a second SSD and mirror it, so boot and all the rest from SSD1 is mirrored to SSD2? Perhaps via GUI.
 
Top