computers:freenas

FreeNAS

FreeNAS is one of those things where people aren't being jerks when they tell you to RTFM. The documentation is highly detailed, and lists almost everything you'll need to get up and running, or reference in need of a fix.

At the time of writing, the latest version is 11.2-U6

On top of the SMB setup, what a lot of users have found useful is this pair of guides from a user on the FreeNAS forums. This guide goes over basic setup, and also advances changes you can make when you introduce multiple groups or members into the mix.

When you buy your new hard drives to put into a ZFS array, you'll want to check the drives first for any defects before writing a metric ton of data to it. Here's a great writeup on how to accomplish this inside of FreeNAS

Use smartctl -a /dev/(name of disk drive) to list the SMART attributes for the drive in question. Use smartctl -t short /dev/(name of disk drive) to do a basic test.

https://forums.freenas.org/index.php?resources/replacing-a-failed-failing-disk.75 https://www.thomas-krenn.com/en/wiki/Analyzing_a_Faulty_Hard_Disk_using_Smartctl

After new drive is installed, before resilvering the drive, break in the drive with the following:

smartctl -t short
smartctl -t conveyance
smartctl -t long
badblocks -b 4096 -ws
smartctl -t long
smartctl -t conveyance will not work on the FreeNAS CLI. This will work in Windows however once you install smartctl via Chocolatey and Powershell

This will put the drive through its paces and if it survives, it should be in great shape for use. If it fails, RMA the drive if it is under warranty.

https://www.ixsystems.com/community/resources/hard-drive-burn-in-testing.92/

https://www.reddit.com/r/freenas/comments/928p15/migrate_pool_to_new_disks/

https://www.youtube.com/watch?v=UflFKgD4RiM I've had to do this twice over the years when current hard drive space was getting high.

Pre-Staging Steps

Run the hard drive burn-in steps above on your new drives. Once done, create a new drive pool. Why? When you create a drive pool, either you set up your pool to be redundant (mirrored), or set it for max capacity (striped). If you need to expand, your only option is to mirror, if you already have a mirrored array. If you are striped, you can mirror or stripe more. In my case, I set up for redundancy. This means when I need to expand, I have to create a new striped pool, then mirror new drives in.

Starting Migration

https://www.truenas.com/community/threads/howto-migrate-data-from-one-pool-to-a-bigger-pool.40519/

I've modified the steps below to reflect my experience on FreeNAS 11.2 U8

Steps

This assumes that you have both pools setup and connected to the same system, but the replication steps can be done between two systems and the disks moved after replication (this would apply in the instance where the primary machine doesn't have enough ports to handle the additional drives for the second pool).

Assumption is that “oldpool” is the primary dataset name. “newpool” is the name for the new pool prior to data migration.

The steps in a nutshell are replicate from oldpool to newpool, remove (or rename) oldpool, and then rename newpool to oldpool.

  1. The system dataset needs to be moved off of oldpool. Use the GUI to select a new location other than oldpool or newpool.
  2. Create a system config backup using the GUI. This will be needed later, because when you detach oldpool, you will lose your share, snapshot and replication settings.
  3. Use the GUI to create a snapshot of the dataset you want to move. If you want to move everything, select the root dataset. For flexibility in the future, I'd suggest checking the “recursive” option. Also, minimize data use of oldpool. You will want to pick a time where nothing is changing, then ensure you have a snapshot, and then wait for replication to finish. The amount of time this will take depends on how much storage and the speed of your machine. It took ~36 hours to move 20TB locally for me. [ alternatively, you can use the CLI to create the snapshot and then replicate manually. “zfs snapshot -r oldpool@hostname” and then “zfs send -R oldpool@hostname | zfs receive newpool”]
  4. Once replication is complete and you are satisfied that all data is on newpool it's time to detach both oldpool and newpool. Use the GUI to “detach volume” for oldpool and then repeat for newpool. When the confirmation window pops up DO NOT CHOOSE THE OPTION TO DESTROY.
  5. Using the CLI (or SSH) run the following to import and rename “zpool import oldpool olderpool” and then “zpool import newpool oldpool”. (for reference: zpool import [old-pool-name] [new-pool-name-name])
  6. Once the pools are renamed, export them at the CLI “zpool export olderpool” and “zpool export oldpool”
  7. Using the GUI, go to the storage tab and select the import volume tab and import oldpool. This step is what enables freenas to understand and control the pool.
  8. Once the pool is imported, you can either manually recreate your shares, or you can restore from the configuration backup we made in step 2.
  9. I would verify that everything is working to your liking before doing anything with olderpool. For safety, I'd leave it un-imported until you decide you need it or want to get rid of it. If you want to get rid of the data on the disks, I would import olderpool and then once it is in freenas, select the detach volume option for old-tank and this time select the destroy data option to blank out the drives. This is the point of no return, so know what you are doing before confirming.

This works with the official community release, or the TrueCharts container. Assuming you're using TrueNAS SCALE.

Install the Tailscale container inside Apps. For configuration, uncheck userspace (which allows full access to TrueNAS for the container, ie. it runs as root, allowing tasks like rsync to run), check Host Network (allows you to reference the tailscale IPs), and set an advertised route of the IP of the NAS (192.168.0.50/32. for example). You'll also need to set net.ipv4.ip_forward - 1, net.ipv4.conf.all.src_valid_mark - 1 in truenas sysctl under System - Advanced. Of course, provide your auth key from tailscale.

Sources:

  • computers/freenas.txt
  • Last modified: 2024/07/09 04:00
  • by jon