2026-10-02 13:09:40 +03:00
2026-10-02 12:08:34 +03:00
2026-10-02 13:09:40 +03:00
2026-10-02 11:42:03 +03:00
2026-10-02 13:09:40 +03:00

QNAP → TrueNAS Migration

Copies all shares from one or more QNAP NAS devices into TrueNAS SCALE datasets. Run on the TrueNAS box as root — it pulls data from each QNAP (nothing to install on QNAP besides enabling the service you choose below).

1. Enable access on each QNAP

  • ssh (recommended, fastest, preserves permissions best): Control Panel → Telnet/SSH → enable SSH. Copy a TrueNAS SSH public key into the QNAP admin user's ~/.ssh/authorized_keys for passwordless auth.
  • smb: make sure the shares are accessible to an admin/user account over SMB.
  • nfs: Control Panel → Network & File Services → NFS service, and allow the TrueNAS host/IP in each share's NFS permissions.

2. Configure the NAS list

cp nas_list.conf.example nas_list.conf

Edit nas_list.conf — one line per QNAP, see comments in the file for the column format (name method host user auth shares). Mix methods freely (e.g. one QNAP over ssh, another over smb).

For ssh entries, generate the key pair(s) referenced in the auth column and install them on each QNAP:

chmod +x generate_ssh_keys.sh
./generate_ssh_keys.sh --copy      # creates missing keys, prompts once per QNAP to install them

Run it again without --copy any time to just (re)generate missing keys without touching the QNAP.

3. Dry run first

chmod +x migrate.sh
./migrate.sh --list-only          # just show discovered shares per NAS
./migrate.sh --dry-run            # simulate the full rsync, no files written

4. Run for real

./migrate.sh

Data lands under /mnt/stor0/qnap/<nas-name>/<share-name>/. Per-share rsync logs are written to /mnt/stor0/qnap/_logs/; script messages go to _logs/migrate.log while the dashboard is shown.

Progress dashboard

On a terminal, one block per QNAP is shown (also with --jobs N):

qnap1  share Photos 3/12  (copying)
   File  [##########--------------------]  34%  12.3MB/s
   Total [######------------------------]  21%  4.2GB / 20.0GB, 183 files
   > Photos/2023/IMG_0042.jpg
  • File is the file currently being copied; Total is the current share (sized by a dry-run scan before each share, so large shares pause briefly while "scanning").
  • Plain rsync output is used instead with --dry-run, --list-only, non-terminal output, or when an smb entry uses - (interactive password prompt).

Stopping

Ctrl+C (or kill) stops all rsync/ssh/smbclient processes, unmounts temporary CIFS/NFS mounts and closes SSH connections. The SSH method reuses one multiplexed connection per NAS, so a key passphrase is asked only once.

Options

Flag Description
--config FILE Use a different NAS list (default ./nas_list.conf)
--dest DIR Destination root (default /mnt/stor0/qnap)
--only NAME Only process one NAS entry by name
--jobs N Number of NAS devices to process in parallel (default 1)
--dry-run Pass --dry-run to rsync, no changes made
--list-only Only discover and print shares, don't transfer
--no-ui Disable the progress dashboard, use plain rsync output

QNAP system folders (@Recycle, .@__thumb, .system, snapshots, etc.) are skipped automatically. Re-running the script is safe/idempotent — rsync only copies new or changed files.

If the files were edited on Windows, strip CRLF line endings on TrueNAS before running: sed -i 's/\r$//' migrate.sh generate_ssh_keys.sh nas_list.conf

S
Description
No description provided
Readme
91 KiB
Languages
Shell 100%