Snubbi Firstly, Backup Station
does not save to an external hard drive, iirc. However, you can manually perform the task or use a script to automate it.
Secondly, it's recommended to format your external hard drive with ZFS as it aligns well with GhostBSD’s underlying architecture. Here's some basic guidance.
Steps to format your external hard drive with ZFS
Warning: Formatting will erase all data on the external drive.
- Plug in your external hard drive and ensure it's recognized by the system.
- Identify the Device: sudo geom disk list
Assume the device is da0
.
- Create a ZFS Pool: sudo zpool create backup_pool /dev/da0
- Enable Compression (Optional): sudo zfs set compression=lz4 backup_pool
Steps to create ZFS snapshots
Transfer Snapshots to External Drive
Initial Full Backup: sudo zfs send zpool/home@backup_YYYYMMDD | sudo zfs receive backup_pool/home_backup
Incremental Backups. Create a New Snapshot: sudo zfs snapshot zpool/home@backup_YYYYMMDD_next
Send Incremental Changes: sudo zfs send -i zpool/home@backup_YYYYMMDD zpool/home@backup_YYYYMMDD_next | sudo zfs receive backup_pool/home_backup
Automate the Backup Process (Optional)
Create a Backup Script. Save the following script as /usr/local/bin/zfs_backup.sh
:
#!/bin/sh
SOURCE="tank/home"
BACKUP="backup_pool/home_backup"
DATE=$(date +%Y%m%d)
SNAPSHOT="${SOURCE}@backup_${DATE}"
zfs snapshot "$SNAPSHOT"
PREV=$(zfs list -t snapshot -o name -S creation | grep "^${SOURCE}@" | head -n2 | tail -n1)
if [ -z "$PREV" ]; then
zfs send "$SNAPSHOT" | zfs receive "$BACKUP"
else
zfs send -i "$PREV" "$SNAPSHOT" | zfs receive "$BACKUP"
fi
Make the Script Executable: sudo chmod +x /usr/local/bin/zfs_backup.sh
Schedule with Cron. Set the script to run daily at 1 AM: sudo crontab -e
Add the following line:
0 1 * * * /usr/local/bin/zfs_backup.sh
Manage Backups
To verify backup pool and ensure your backups are correctly received, run:
zpool status backup_pool
zfs list backup_pool/home_backup
Prune Old Snapshots
To remove snapshots older than 30 days:
for SNAP in $(zfs list -t snapshot -o name -S creation | grep "zpool/home@backup_" | tail -n +31); do
sudo zfs destroy "$SNAP"
done
Safely Unmount the External Drive
Export the ZFS Pool: sudo zpool export backup_pool
Additional Tips
- Regular Backups: Automate backups to ensure consistency and reduce manual effort.
- Monitor Pool Health: Periodically check the status with: zpool status