Page 1 of 1

[How-To] Data on ZFS (HDD/SSD Installs)

Posted: 08 Sep 2015 11:52
by JoseMR
Hello, this how-to is oriented for experienced users who are using HDD/SSD as installation media with data partition, and want to take advantages of ZFS such as snapshots, ideal for users running jails/chroot on the default install data partition.

All you have to do is install NAS4Free with the option #2 to perform a GPT installation instead of the default MBR method, then run 3 simple commands to format the data partition(p4) with ZFS.

First step, install NAS4Free with the option #2
Image

Second step, run the 3 commands shown below, where ada0 is my installation disk on this example.

Code: Select all

Delete disk partition 4
 # gpart delete -i 4 ada0

Re-create partition 4 as ZFS
 # gpart add -t freebsd-zfs ada0

Format partition 4 as ZFS with default mountpoint /mnt
 # zpool create -m /mnt/data data ada0p4
Sample output from vm test environment.

Code: Select all

nas4free: ~# gpart show
=>      34  16777149  ada0  GPT  (8.0G)
        34         6        - free -  (3.0K)
        40      1024     1  freebsd-boot  (512K)
      1064      7128        - free -  (3.5M)
      8192   1638400     2  freebsd-ufs  (800M)
   1646592   4194304     3  freebsd-swap  (2.0G)
   5840896  10936287     4  freebsd-zfs  (5.2G)
After reboot import the disks, and go to Disks|ZFS|Configuration and synchronize the pools, that's it.

Note: Under Disks|Management the installation disk will be displayed as a ZFS storage pool device, regardless of the 800M UFS partition.

Disclaimer: This instructions/guide is provided AS-IS and I'm not responsible for any data loss or damage caused by the instructions provided in this thread, proceed at your own risk.

Re: [How-To] Data on ZFS (HDD/SSD Installs)

Posted: 08 Sep 2015 12:07
by raulfg3
Thanks a lot JoseMR.

Muchas Gracias


I propose this by default on new install, like FreeNAS does.

Re: [How-To] Data on ZFS (HDD/SSD Installs)

Posted: 08 Sep 2015 19:51
by JoseMR
Hey raulfg3, +1 I would like to see options to Install on ZFS too, so we can take advantages of ZFS snapshots/mirroring on boot devices.

Saludos!

Re: [How-To] Data on ZFS (HDD/SSD Installs)

Posted: 04 Dec 2015 09:47
by JoseMR
For those users interested to perform this on MBR installs instead GPT here are the steps: (where ada0 is the disk on this example)

Code: Select all

# gpart destroy -F ada0s3
# gpart create -s bsd ada0s3
# gpart add -t freebsd-zfs ada0s3
# zpool create -m /mnt/data data ada0s3a
After that, go to Disks|ZFS|Configuration and import/synchronice the pool, then go to Disks|Management and puch clear config and import disks.

Note: Be aware that there's a 2TB size limitation with MBR and 4K AF drives with 512-byte emulation, except for native 4K (4Kn AF) drives, more information HERE.

Re: [How-To] Data on ZFS (HDD/SSD Installs)

Posted: 29 Dec 2016 12:03
by MikeMac
Very good idea, but I would rather mentioned potential problem with upgrades. nas4free developers time after time make size of the system partition larger and larger. Currently for 11.0 one is not 800М as per 1st post, but 1G

Code: Select all

nas4free ~/ root~$ gpart show da8
=>      63  15974337  da8  MBR  (7.6G)
        63   2120517    1  freebsd  [active]  (1.0G)
   2120580   4209030    2  freebsd  (2.0G)
   6329610   9639000    3  freebsd  (4.6G)
  15968610      5790       - free -  (2.8M)
So if you have made such setup just a few months ago, you are already in the problem.

If we will have such size grow in the future, it could produce problems with zfs partition (there is no way to make zfs pool smaller)

For providing a little room for possible future grow I suppose make slightly bigger SWAP partition on HDD, say, 4Gb. 2 add Gb is nothing for HDD. But in worst case user will have an future option to shrink SWAP and grow system partition. It is not so simple, but not a rocket science after all :)