about summary refs log tree commit diff
path: root/content/posts
diff options
context:
space:
mode:
Diffstat (limited to 'content/posts')
-rw-r--r--content/posts/2023-09-02-setup-external-backup.md120
-rw-r--r--content/posts/_index.md9
2 files changed, 123 insertions, 6 deletions
diff --git a/content/posts/2023-09-02-setup-external-backup.md b/content/posts/2023-09-02-setup-external-backup.md
new file mode 100644
index 0000000..6a94158
--- /dev/null
+++ b/content/posts/2023-09-02-setup-external-backup.md
@@ -0,0 +1,120 @@
+---
+title: "Setup backup on external disk"
+date: 2023-09-02
+draft: true
+lang: en
+categories: [ blog ]
+tags: []
+translationKey: "2023-09-02-setup-external-backup"
+---
+
+## Backstory
+
+A few weeks ago (not today), I fucked up:
+During irregular disk cleanup, I accidentally removed the config folder!
+
+Fortunately, I "backed up" the config with git, didn't I? 😌
+
+Well yes, but actually no! 🥲 I did commit, but I didn't push.
+The latest pushed config had been 9 months before this incident.
+
+On top of that, many programs generate unreadable configs, which I prefer not
+to put into version control, or put sensitive information or large data into
+`.config`, which shouldn't be pushed into a remote repository on a server I
+don't own.  For example, nheko puts authentication info there, and after this
+incident I lost the session with several messages---well, matrix's irregularly
+regular decryption failure could be expanded into a post on its own, so let's
+not digress.
+
+And then there are more things to back up than just configs, say, my photos and
+music.  I mirror them between my devices with [syncthing], providing
+redundancy, but [syncthing is not backup][syncthing-failure],
+and neither is [RAID][raid-not-backup]
+
+[syncthing]: https://syncthing.net/
+[syncthing-failure]: https://forum.syncthing.net/t/syncthing-deleted-all-files-on-every-device/20518
+[raid-not-backup]: https://www.raidisnotabackup.com/
+
+I should back them up, or I might one day be doomed to repeat the mistake.
+
+## Preparation
+
+Despite the bitterness from the partial data loss, I kinda didn't have the
+spoon to do what I must, so I've been delaying it hitherto.
+
+### Hardware
+
+One of the reason I was cleaning up the disk in the first place was that it's
+start to be filled up, so I bought a large hard drive to store more data and
+backup.  Doesn't seem too safe, I know: if the hard drive gets lost or broken,
+I'll lose both the main data and the backup, but with a limited budget and
+space, that's good enough for now.
+
+I got a Seagate One Touch 2 TB[^0] HDD.  It seems to come with builtin backup
+software, which doesn't support Linux of course, and I likely wouldn't use it
+even if it did.  A USB hub is also needed, as my laptop has a limited number of
+USB ports.
+
+### Formatting
+
+Coming with the hard drive are several files, such as an `.exe` program to
+initialize the backup, I suppose.  I don't need these, and the disk can be
+formatted ~~right away~~ after I do full-disk encryption on that.
+
+No partitioning is needed: while I do seek [vegan alternative][margarine], I
+intended to use [btrfs][btrfs-kernel] as the file system, which can create
+subvolumes, which can act as separate mounted partitions.  I will just reformat
+the existing partition to btrfs.
+
+```sh
+mkfs.btrfs -L margarine /dev/sdb1
+```
+
+[margarine]: https://outerheaven.club/notice/AZ8wYpKOyp2p329V5M
+[btrfs-kernel]: https://www.kernel.org/doc/html/latest/filesystems/btrfs.html
+
+I intend to have three subvolumes, one for big data (not Big Dataâ„¢) such as
+movies or music, one for more personal data and another for backup:
+
+```sh
+mount /dev/sdb1 /mnt
+btrfs subvolume /mnt/data/hoard
+btrfs subvolume /mnt/data/perso
+btrfs subvolume /mnt/backup
+```
+
+Finally, I need to declare those in the nix hardware configuration file.
+
+
+```nix
+{
+  (...)
+  fileSystems = {
+    "/" = {
+      (...)
+    };
+    "/data/hoard" = {
+      device = "/dev/disk/by-uuid/[subvolume uuid]";
+      fsType = "btrfs";
+      options = [ "subvol=data/hoard" "compress-force=zstd" "noatime" ];
+    };
+    "/data/perso" = {
+      device = "/dev/disk/by-uuid/[subvolume uuid]";
+      fsType = "btrfs";
+      options = [ "subvol=data/perso" "compress-force=zstd" "noatime" ];
+    };
+    "/backup" = {
+      device = "/dev/disk/by-uuid/[subvolume uuid]";
+      fsType = "btrfs";
+      options = [ "subvol=backup" "compress-force=zstd" ];
+    };
+  };
+  (...)
+}
+```
+
+## Setting up
+
+[^0]: That means 1.81 [TiB] and I feel cheated sometimes.
+
+[TiB]: https://en.wikipedia.org/wiki/Byte#Multiple-byte_units.
diff --git a/content/posts/_index.md b/content/posts/_index.md
index 54dd49c..7a11ae0 100644
--- a/content/posts/_index.md
+++ b/content/posts/_index.md
@@ -1,11 +1,8 @@
 ---
-title: Posts
+title: Blog
 lang: en
 translationKey: posts
+categories: [blog]
 ---
 
-Here are some attempts of mine to draw webcomics, or I should say random
-scribbles :)
-
-Transcript of each comic can be found by appending 'transcript.txt' to the
-comic URL.
+Here are my blog posts!