first commit

This commit is contained in:
2026-10-01 10:42:36 +03:00
commit d242955f4e
4 changed files with 431 additions and 0 deletions
+60
View File
@@ -0,0 +1,60 @@
# 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
```bash
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:
```bash
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
```bash
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
```bash
./migrate.sh
```
Data lands under `/mnt/stor0/qnap/<nas-name>/<share-name>/`. Per-share rsync logs are written to
`/mnt/stor0/qnap/_logs/`.
## 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 |
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.