A collection of personal notes on the setup, configuration and maintenance of a home-office TrueNAS appliance.

🖥 Hardware

I dedicated a whole post on building the machine , in which you’ll get the detailed bill of material, cost breakdown and parts selection process.

Reset BMC password

If you have one of iXsystems’ TrueNAS server whose motherboard was produced by SuperMicro, there’s a way to reset the BMC password with that CLI to use as root :

📊 Reports

Disk Temperature

⚠️ Do not activate any aggressive power-management parameters on disks. This is the main reasons temperatures are not reported in graphs.

📦 Package Management

To prevent the administrator to mess up with TrueNAS install, FreeBSD’s package management has been locked down. Installing a package does not work:

root@truenas[/]# pkg install dmg2img
Updating local repository catalogue...
pkg: file:///usr/ports/packages/meta.txz: No such file or directory
repository local has no meta file, using default settings
pkg: file:///usr/ports/packages/packagesite.txz: No such file or directory
Unable to update repository local
Error updating repositories!

If you know what you’re doing and want to unlock package management, here is the fix:

1root@truenas[/]# sed -i .orig 's/enabled: yes/enabled: no/' /usr/local/etc/pkg/repos/local.conf
2root@truenas[/]# sed -i .orig 's/enabled: no/enabled: yes/' /usr/local/etc/pkg/repos/FreeBSD.conf

Now you’re ready to update the package index:

root@truenas[/]# pkg update
Updating FreeBSD repository catalogue...
Fetching meta.conf: 100%    163 B   0.2kB/s    00:01
Fetching packagesite.txz: 100%    6 MiB   6.7MB/s    00:01
Processing entries: 100%
FreeBSD repository update completed. 31953 packages processed.
All repositories are up to date.

And install your package:

 1root@truenas[/]# pkg install dmg2img
 2Updating FreeBSD repository catalogue...
 3FreeBSD repository is up to date.
 4All repositories are up to date.
 5New version of pkg detected; it needs to be installed first.
 6The following 1 package(s) will be affected (of 0 checked):
 7
 8Installed packages to be UPGRADED:
 9	pkg: 1.14.6 -> 1.15.10 [FreeBSD]
10
11Number of packages to be upgraded: 1
12
13The operation will free 31 MiB.
147 MiB to be downloaded.
15
16Proceed with this action? [y/N]: y
17[1/1] Fetching pkg-1.15.10.txz: 100%    7 MiB   6.9MB/s    00:01
18Checking integrity... done (0 conflicting)
19[1/1] Upgrading pkg from 1.14.6 to 1.15.10...
20[1/1] Extracting pkg-1.15.10: 100%
21Updating FreeBSD repository catalogue...
22FreeBSD repository is up to date.
23All repositories are up to date.
24The following 1 package(s) will be affected (of 0 checked):
25
26New packages to be INSTALLED:
27	dmg2img: 1.6.7 [FreeBSD]
28
29Number of packages to be installed: 1
30
3122 KiB to be downloaded.
32
33Proceed with this action? [y/N]: y
34[1/1] Fetching dmg2img-1.6.7.txz: 100%   22 KiB  22.5kB/s    00:01
35Checking integrity... done (0 conflicting)
36[1/1] Installing dmg2img-1.6.7...
37[1/1] Extracting dmg2img-1.6.7: 100%
38
39root@truenas[/]# dmg2img
40
41dmg2img v1.6.7 (c) vu1tur ([email protected])
42
43Usage: dmg2img [-l] [-p N] [-s] [-v] [-V] [-d] <input.dmg> [<output.img>]
44or     dmg2img [-l] [-p N] [-s] [-v] [-V] [-d] -i <input.dmg> -o <output.img>
45
46Options: -s (silent) -v (verbose) -V (extremely verbose) -d (debug)
47         -l (list partitions) -p N (extract only partition N)

💾 Storage

List all connected devices

nvd0 is the system’s NVMe SSD, ada0 a SATA HDD and da0 a USB external drive.

 1root@truenas[/mnt]# geom disk list
 2Geom name: nvd0
 3Providers:
 41. Name: nvd0
 5   Mediasize: 250059350016 (233G)
 6   Sectorsize: 512
 7   Mode: r1w1e2
 8   descr: WDC WDS250G2B0C
 9   rotationrate: 0
10   fwsectors: 0
11   fwheads: 0
12
13Geom name: ada0
14Providers:
151. Name: ada0
16   Mediasize: 6001175126016 (5.5T)
17   Sectorsize: 512
18   Stripesize: 4096
19   Stripeoffset: 0
20   Mode: r1w1e3
21   descr: TOSHIBA HDWN160
22   rotationrate: 7200
23   fwsectors: 63
24   fwheads: 16
25
26Geom name: da0
27Providers:
281. Name: da0
29   Mediasize: 320072933376 (298G)
30   Sectorsize: 512
31   Mode: r0w0e0
32   descr: ST332082 0ACE
33   rotationrate: unknown
34   fwsectors: 63
35   fwheads: 255

Mount an NTFS partition

1root@truenas[/mnt]# kldload fuse.ko
2root@truenas[/mnt]# mkdir usb-hdd
3root@truenas[/mnt]# ntfs-3g /dev/da0p2 /mnt/usb-hdd

Mount exFAT partition

 1root@truenas[/mnt]# gpart show ada4
 2=>        34  7814037101  ada4  GPT  (3.6T)
 3          34           6        - free -  (3.0K)
 4          40      409600     1  efi  (200M)
 5      409640        2008        - free -  (1.0M)
 6      411648  7813623808     2  ms-basic-data  (3.6T)
 7  7814035456        1679        - free -  (840K)
 8
 9root@truenas[/mnt]# mkdir hdd-4tb                                              
10
11root@truenas[/mnt]# kldload fusefs
12
13root@truenas[/mnt]# mount.exfat-fuse /dev/ada4p2 ./hdd-4tb                     

Delete a partition

 1root@truenas[/mnt]# gpart show da0
 2=>        34  7814037101  da0  GPT  (3.6T)
 3          34           6       - free -  (3.0K)
 4          40      409600    1  efi  (200M)
 5      409640  7813365344    2  apple-hfs  (3.6T)
 6  7813774984      262151       - free -  (128M)
 7
 8root@truenas[/mnt]# gpart delete -i 1 da0
 9da0p1 deleted
10
11root@truenas[/mnt]# gpart show da0
12=>        34  7814037101  da0  GPT  (3.6T)
13          34      409606       - free -  (200M)
14      409640  7813365344    2  apple-hfs  (3.6T)
15  7813774984      262151       - free -  (128M)

3-pass USB HDD wipe

 1root@truenas[/mnt]# bcwipe -v -me -t2 -b /dev/da0
 2Multithreading not supported.
 3Run ./configure with --enable-pthreads option, then rebuild BCWipe to enable multithreading.
 4Wiping scheme: US DoE, 3 pass(es)
 5Wipe /dev/da0 (y/[n]/a)?y
 6Wiping char device '/dev/da0'
 7Device '/dev/da0' opened in direct access mode
 8Device size 320072933376 bytes (312571224 kB), method 3
 9Wiping char device '/dev/da0' pass 1/3 [random] started
10wipe pass  1/3 :    212992/312571224 kB (  0%)   Rate: 21233 kB/s

ZFS

  • List all snaphots of the tank/my-data dataset:

    1$ zfs list -r -t snapshot tank/my-data
    
  • Rename all snapshot’s names prefixes from auto- to daily- , for the tank/my-data dataset and its children:

     1$ zfs list -r -t snapshot tank/my-data
     2NAME                                                       USED  AVAIL     REFER  MOUNTPOINT
     3tank/my-data@auto-2021-09-02_00-00                           0B      -      209G  -
     4tank/my-data@auto-2021-09-03_00-00                           0B      -      209G  -
     5tank/my-data@auto-2021-09-04_00-00                           0B      -      209G  -
     6(...)
     7$ zfs list -r -t snapshot -o name -H tank/my-data | awk '{$2 = $1; sub(/@auto\-/, "@daily-", $2); printf "%s\n%s\n", $1, $2;}' | tr '\n' '\0' | xargs -0 -n 2 -t zsh -c 'zfs rename "$0" "$1"'
     8zsh -c zfs rename "$0" "$1" tank/my-data@auto-2021-09-02_00-00 tank/my-data@daily-2021-09-02_00-00
     9zsh -c zfs rename "$0" "$1" tank/my-data@auto-2021-09-03_00-00 tank/my-data@daily-2021-09-03_00-00
    10zsh -c zfs rename "$0" "$1" tank/my-data@auto-2021-09-04_00-00 tank/my-data@daily-2021-09-04_00-00
    11(...)
    12$ zfs list -r -t snapshot tank/my-data
    13NAME                                                       USED  AVAIL     REFER  MOUNTPOINT
    14tank/my-data@daily-2021-09-02_00-00                          0B      -      209G  -
    15tank/my-data@daily-2021-09-03_00-00                          0B      -      209G  -
    16tank/my-data@daily-2021-09-04_00-00                          0B      -      209G  -
    17(...)
    

🐛 Issues

FreeNAS to TrueNAS migration

I wrote a long article on how to migrate an encrypted pool from FreeNAS to TrueNAS  .

Unreachable Network due to Multiple NICs

My machine was regularly disconnected from the network and couldn’t be cleanly rebooted. This started under FreeNAS 11.3-U4.1 and is still reproducible with a fresh TrueNAS 12.0 .

The issue lies somewhere in all connected interfaces being granted DHCP active service:

https://www.youtube.com/watch?v=vDMooVj-flM

The issue is being discussed on iXsystems’ JIRA  .

ValidateUpdate error on upgrade

Got the following error on upgrade?

PermissionError: [Errno 13] Permission denied: './ValidateUpdate'

The fix: temporary switch the System Dataset  to freenas-boot . Your default system dataset is probably set to your ZFS pool which might be unavailable for whatever reason. In my case, I was in the middle of a pool migration process  .