Skip to main content

Backup to USB Drive

Introduction

For same applications it might be necessary to use an external drive without adding this drive to a ZPool. E.g. if you want to copy from or to an external device.

Setup / mounting

TrueNAS will not mount a drive automatically when plugged into an USB Port. This has to be done manually. In this example I will use an external drive from LaCie.

  1. Plug in the drive to any USB Port
  2. Figure out the name of the device. It can be seen in Storage --> Disks. It is usually the drive without pool.
  3. Enter lsblk -p | grep "disk\|part". It will show show the exact name of the partition you want to mount. Bildschirmfoto 2023-12-17 um 17.54.37.png
    In this case it is sdd2.
  4. Create a mountpoint
    sudo mkdir /mnt/LaCie
  5. Mount the device
    sudo mount /dev/sdd2 /mnt/LaCie

Create an rsync job

rsync -anv --delete  --log-file=/var/log/rsyncd.LaCie.log --exclude "._*" --exclude ".@*" /mnt/XPpool01/backup/qnap01/ /mnt/usb_drive

rsync -a --exclude-from='/exclude-file.txt' /src_directory/ /dst_directory/

 

Add to cronjob.

 

Open points

What happens after a reboot? Is the mount persistent or does it have to be added to fstab?