From 8b52b04c03a34b2fc53c11b8535aaefac0490370 Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Fri, 26 Nov 2021 23:24:44 +0700 Subject: Improve auto (and) scaling --- blog/butter.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'blog/butter.md') diff --git a/blog/butter.md b/blog/butter.md index b35e6d6..e15b0c4 100644 --- a/blog/butter.md +++ b/blog/butter.md @@ -182,6 +182,7 @@ today=$(date --iso-8601) btrfs subvolume snapshot -r /home /home/$today sync btrfs send /home/$today | btrfs receive /backup/home +sync ``` ### Repetition @@ -190,6 +191,7 @@ For next backups, I also mounted the drive and created a snapshot: ```sh cryptsetup luksOpen /dev/sdb backup +mkdir -p /backup mount -o noatime,compress-force=zstd:14 /dev/mapper/backup /backup today=$(date --iso-8601) btrfs subvolume snapshot -r /home /home/$today @@ -197,12 +199,19 @@ sync ``` Say the latest snapshot was on the `$previous` day, I only needed to send -the difference between the old and new backup. Afterwards, it is safe -to delete the local `$previous` snapshot to save some space. +the difference between the old and new backup. Afterwards, it is safe to delete the local `$previous` snapshot to save some space. ```sh btrfs send -p /home/$previous /home/$today | btrfs receive /backup/home btrfs subvolume delete /home/$previous +sync +``` + +Finally, unmount the drive and close the LUKS volume: + +```sh +umount /backup +cryptsetup luksClose backup ``` Is this more complicated than good ole `rsync`? Yes. Is it safer? Also yes, -- cgit 1.4.1