How to do basic TrueNas configuration

Cover Image for How to do basic TrueNas configuration

How to do basic TrueNas configuration

How-to written and screenshots taken on 2021 October 69 min read

Introduction

What started as a project to run "some crypto applications" grew into something much bigger, but also more useful. I learned a tremendous amount about virtual machines, lxc containers and Proxmox. And although I'm just scratching the surface and I don't actually understand it, I know how to do some things. I'll write them down here, partly for myself, but also for you in hopes it will save one of us a lot of time and frustration.

Create a storage pool

You have TrueNas for storage, so the first thing you want to do is create a storage pool. This is a set off disks grouped together to store data. Obviously this is an oversimplification. Read this article for a more in depth introduction into how ZFS works.

  1. Open the TrueNas WebGUI and go to "Storage".

    add a storage pool

  2. Click "Add" and in the new window click "Create Pool".

    create pool

  3. Give the pool a name (pool1) and select the disks you planned to use for data storage. In this example I have 4 2TB disks that I combine in a single RAID-Z VDev. Keep in mind that this is not recommended (anymore) and you probably want to use (more disks) with RAID-Z2.

    pool manager

  4. Confirm that you want this pool to be created.

    pool manager confirm

  5. You now have a storage pool.

    storage pool

Configure S.M.A.R.T. checks and scrubs

Now that your storage pool is up, you have to keep track of the health of that pool and the underlying disks. This can be done by scheduling regular S.M.A.R.T. tests to check the health of your disks and schedule "scrubs" to check the health of your pool (data) and correct errors. Read more about the specifics in this thread on the TrueNas forums.

S.M.A.R.T. checks

  1. Go to "Tasks" -> "S.M.A.R.T. Tests" and click the "Add" button.

    SMART tests empty

  2. Check "All Disks", choose Type "SHORT" and give it a description, for example: Short SMART Test: Every 5th, 12th, 19th, and 26th of the month at 3:00 am.

    SMART tests short description

  3. Click on the schedule and choose "Custom". This will open a popup where you can enter a schedule. I followed the advice from the forums, see the description in previous step.

    SMART tests short schedule

  4. Click "Submit" to save the schedule.

    SMART tests short submit

  5. Click the "Add" button again.

    SMART tests short

  6. Check "All Disks", choose Type "LONG" and give it a description, for example: Long SMART Test: Every 8th and 22nd at 3:00 am.

    SMART tests long description

  7. Click on the schedule and choose "Custom". This will open a popup where you can enter a schedule. I followed the advice from the forums, see the description in previous step.

    SMART tests long schedule

  8. Click "Submit" to save the schedule.

    SMART tests long submit

  9. You have now added the S.M.A.R.T. health checks and will be notified by TrueNas is something is wrong. This will be configured in Configure reporting

    SMART tests

Scrubs

  1. Go to "Tasks" -> "Scrub Tasks". You will see TrueNas created a default task for the pool you created. Click on the "triple dots" icon and choose "Edit"

    Scrub tasks default

  2. Change the "Threshold days" to 10 and give the task a description, for example: SCRUBS: 1st and 15th of the month at 3:00am. Threshold is set to 10 days..

    Scrub tasks description

  3. Click on the schedule and choose "Custom". This will open a popup where you can enter a schedule. I followed the advice from the forums, see the description in previous step.

    Scrub tasks schedule

  4. Click "Submit" to save the schedule.

    Scrub tasks submit

  5. You have now configured (more) scrubs and will be notified by TrueNas is something is wrong. This will be configured in Configure reporting

    Scrub tasks

Configure users

If you want to enable samba (SMB) sharing, you have to create users (or allow anonymous sharing). For completeness and because it is safer, I will create a user that has access to the SMB shares from a Windows machine.

  1. Go to "Accounts" -> "Users" and click the "Add" button

    Users empty

  2. Add "Name", "Username" and "Password".

    User add name

  3. Scroll down and check "Microsoft Account".

    User Miscrosoft account

  4. Click "Submit" to save the user.

    Users

  5. Repeat for all users you want to create.

  6. Go to "Accounts" -> "Groups". TrueNas has created a group for each user you just created. This is not convenient when setting folder/file/share permissions. Add another group by clicking the "Add" button.

    Groups default

  7. Add a "Name" for the group. I chose samba-share-rw as it descibes the intention of the group: read-write permissions for samba-shares.

    Group add name

  8. Click "Submit" to save the group. In the overview screen click on the > icon and then on the "Members" button.

    Groups details

  9. Add the users you want to be members of the group and click save.

    Groups add members

Configure samba sharing

  1. Go to "Services" and enable "SMB". Don't forget to check "Start Automatically".

    Enable SMB service

  2. Click on the pencil icon and change the "NetBIOS Name" and "Workgroup".

    Enable SMB settings

  3. Go to "Storage" -> "Pools" and click on the triple dot icon behind your pool. Click "Add Dataset".

    Add dataset to pool

  4. Give the dataset a name and use the comments to explain what data the dataset contains.

    Add dataset to pool settings

  5. Press "Submit". The dataset is now created.

    Dataset created

  6. Go to "Sharing" -> "Windows Shares (SMB)" and click "Add".

    Samba shares empty

  7. Choose the dataset (folder) you just created and add a description.

    Add samba share

  8. After clicking submit TrueNas will ask if it should configure ACL. Choose to configure it.

    Add samba share ACL

  9. Click "Add ACL item". Choose Group and type the name of the group you created. I wanted read-write permissions so for "Permissions" I choose Modify.

    Add samba share ACL item

  10. Click save. The share is now visible in Windows. You might need to restart the TrueNas server/VM to get the right NetBIOS name to show.

    Samba share in Windows

Configure NFS sharing

If you want to share files with Linux machines, NFS might work better than SMB (check the sources at the bottom of this guide).

  1. Go to "Services" and enable "NFS". Don't forget to check "Start Automatically".

    Enable NFS service

  2. Click on the pencil icon and check "Enable NFSv4" and "NFSv3 ownership for NFSv4".

    Enable NFS settings

  3. Go to "Storage" -> "Pools" and click on the triple dot icon behind your pool. Click "Add Dataset".

    Add dataset to pool

  4. Give the dataset a name and use the comments to explain what data the dataset contains.

    Add dataset to pool settings

  5. Press "Submit". The dataset is now created.

    Dataset created

  6. Go to "Sharing" -> "Unix Shares (NFS)" and click "Add".

    NFS shares empty

  7. Choose the dataset (folder) you just created and add a description.

    Add NFS share

  8. Click "Advanced Options" and set permissions: Maproot User root, Maproot Group wheel. Because I'm making a Proxmox share I only allow the Proxmox host by IP address. Leave this blank if you don't want to restrict access.

    Add NFS share permissions

  9. Go to "Services" and restart "NFS" (disable -> enable).

  10. Now you can add the share (example shows Proxmox).

    NFS share mounted in Proxmox

Configure an iSCSI disk

This is something I needed to do very recently for a Storj VM and I don't fully understand it yet. So for now I suggest to look here: How to Create iSCSI Target on TrueNAS.

  1. I followed the first to the letter (ok, I changed the zvol and block share names to iscsi-pve1) to create an iSCSI target on TrueNas.
  2. Then in Proxmox I added this target as iSCSI storage.
  3. On top of that iSCSI storage link I created LVM storage.
  4. Now I could create a virtual hard disk and link it to the Storj guest.

There is probably a better, more direct approach, but I haven't learned about that yet. I tried running an Ubuntu VM in TrueNas, but starting this VM would result in the TrueNas guest to freeze. This might be a nesting problem, not sure though.

Configure reporting

If something is wrong with a TrueNas service or the disks, TrueNas can send you an email. This has to be configured obviously. If you don't want to use Gmail, but rather run your own relay, check How to run a an AWS SMTP relay on Proxmox.

  1. Go to "Accounts" -> "Users" and click the > icon behind the root user. Click "Edit".

    Add email address root user

  2. Add your email address.

    Add email address root user

  3. Go to "System" -> "Email" and add a working "From Email" address (for me the domain had to be verified in AWS SES). I'm running my own SMTP relay that I can send my system emails to. This relay will then use AWS SES to send them to my mailbox. If you want to use Gmail try this, but it seems Google is disabling app passwords needed to authenticate.

    Set email address and server

  4. Click "Send test mail". You should receive an email shortly.

    Test email