Featured image of post Note for ZFS Snapshot and Backup

Note for ZFS Snapshot and Backup

It's important to keep precious data properly backed up.

Create ZFS on backup external disk

Find the drive from /dev/disk/by-id/

1
2
3
4
> ls /dev/disk/by-id/
...
usb-Seagate_Expansion_HDD_00000000XXXXX-0:0
...

Create Backup zpool

1
zpool create seagate_backup_pool /dev/disk/by-id/usb-Seagate_Expansion_HDD_00000000XXXXX-0:0

Import Zpool in external drive

Command zpool import without any argument will show what’s available for import in current system.

After that, do zpool import seagate_backup_pool -f to actually import the backup pool.

Take Snapshot of current system

Check current snapshot

1
zfs list -t snapshot

Take snapshot for all dataset.

1
zfs snapshot -r tank@current

Send snapshot to backup pool

Backup as Dataset

1
zfs send -R tank@current | zfs recv seagate_backup_pool/pve-init-10-24-2024

Increment

1
zfs send -i -R tank@current | zfs recv seagate_backup_pool/pve-init-10-24-2024

Backup as single file

1
zfs send -R tank@current > tank.bak

Make USB external drive Sleep

Install hd-idle and execute:

To instantly test out:

1
hd-idle -t sdd

hdparm won’t work for usb external drive.

To check drive status:

1
2
hdparm -C /dev/sd[abc]
smartctl -i -n standby /dev/sda

To reguarly run hd-idle, use it’s own service.

vim /etc/default/hd-idle

Below opts will make hd-idle sleep device after 600s if no activity.

1
HD_IDLE_OPTS="-i 600 -l /var/log/hd-idle.log"
comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy