Everybody has that one friend who comes along, dropping his USB HardDrive and want to have some stuff copied from your NAS. Here is a quick tip on how to copy large amount of data.
TrueNAS SCALE is based on Debian, NTFS support comes from the Linux kernel and ntfs-3g, so we can start straight out of the box.
Mount the USB Drive
truenas[~]$ dmesg -w
[6759341.448376] scsi 2:0:0:0: Direct-Access Intenso External USB 3.0 1405 PQ: 0 ANSI: 6
[6759341.451605] sd 2:0:0:0: Attached scsi generic sg2 type 0
[6759341.468713] sd 2:0:0:0: [sdc] 1953506646 4096-byte logical blocks: (8.00 TB/7.28 TiB)
[6759341.468961] sd 2:0:0:0: [sdc] Write Protect is off
[6759341.468976] sd 2:0:0:0: [sdc] Mode Sense: 53 00 00 08
[6759341.469373] sd 2:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[6759341.519100] sd 2:0:0:0: [sdc] Preferred minimum I/O size 4096 bytes
[6759341.519116] sd 2:0:0:0: [sdc] Optimal transfer size 33550336 bytes
[6759341.555046] sdc: sdc1
[6759341.555191] sd 2:0:0:0: [sdc] Attached SCSI disk
truenas[~]$ lsblk -f /dev/sdc
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sdc
└─sdc1 ntfs BACKUP 4806286D06285E66
truenas_admin@truenas[~]$ sudo mkdir -p /mnt/usb_ntfs
truenas_admin@truenas[~]$ sudo mount -t ntfs3 -o rw,uid=0,gid=0,umask=022 /dev/sdc1 /mnt/usb_ntfs
truenas_admin@truenas[~]$ ll /mnt/usb_ntfs
total 13
drwxrwxrwx 1 root 4096 Feb 19 16:33 ./
drwxr-xr-x 9 root 9 Feb 19 18:26 ../
drwxr-xr-x 1 root 0 Feb 19 16:33 'System Volume Information'/Create a Terminal Session for the copy job and run rsync to start the copy
Screen is not installed on TrueNas, instead use tmux it keeps the job running after you disconnect, and you can reattach to monitor.
1) Start a persistent session
tmux new -s copyusb
2) Run your rsync inside tmux
Example (with a log file so you can review progress later):
sudo rsync -rltDv --info=progress2 \
--no-perms --no-owner --no-group --no-acls --no-xattrs \
--exclude='System Volume Information/' --exclude='$RECYCLE.BIN/' \
"/mnt/WD16TB/MyData/" "/mnt/usb_ntfs/"\
|& tee -a /home/truenas_admin/rsync_usb_copy.log
3) Detach (leave it running) and close SSH
Press:
Ctrl-bthend
Now you can close the terminal; the copy continues.
4) Reconnect later and monitor
SSH back in and:
tmux attach -t copyusb
To see existing sessions:
tmux ls
To exit tmux when it’s done (ends session):
exit
Monitoring without attaching (quick checks)
Progress log:
tail -f /home/truenas_admin/rsync_usb_copy.log
See if rsync is still running:
ps aux | grep [r]sync