From bc2809fd9fd0ce8bb933090d29f9bd825dfeb16a Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 27 Feb 2022 11:52:39 -0800 Subject: docs: add partition setup for the NAS --- docs/install.org | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/install.org b/docs/install.org index bad13a4..40ba5a8 100644 --- a/docs/install.org +++ b/docs/install.org @@ -77,6 +77,45 @@ Once the installation is completed: CUSTOMIZE_TIMESTAMP=$(date -u +%Y%m%dT%H%M%S) btrfs subvolume snapshot /mnt /mnt/.snapshots/$CUSTOMIZE_TIMESTAMP #+end_src +** Partitions for the NAS +Create the RAIDs: +#+begin_src sh +mdadm --create /dev/md/fast --level=mirror --raid-devices=2 /dev/sda /dev/sdb +mdadm --create /dev/md/slow --level=mirror --raid-devices=2 /dev/sdc /dev/sde +#+end_src + +Encrypt the RAIDs: +#+begin_src sh +cryptsetup --verify-passphrase -v luksFormat /dev/md/slow +cryptsetup --verify-passphrase -v luksFormat /dev/md/fast +#+end_src + +Then open them: +#+begin_src sh +cryptsetup open /dev/md/fast raid-fast +cryptsetup open /dev/md/slow raid-slow +#+end_src + +Create the filesystem: +#+begin_src sh +mkfs.btrfs /dev/mapper/raid-fast +mkfs.btrfs /dev/mapper/raid-slow +#+end_src + +Then we can mount them to generate the host configuration +#+begin_src sh +btrfs subvolume create /mnt/media +btrfs subvolume create /mnt/containers +umount /mnt + +mount -t btrfs /dev/mapper/raid-slow /mnt/ +btrfs subvolume create /mnt/backups +mkdir /mnt/data/{backups,containers,media} +mount -o subvol=media,compress=zstd,noatime,autodefrag /dev/mapper/raid-fast /mnt/data/media +mount -o subvol=media,compress=zstd,noatime,autodefrag /dev/mapper/raid-fast /mnt/data/media +mount -o subvol=containers,compress=zstd,noatime,autodefrag /dev/mapper/raid-fast /mnt/data/containers +mount -o subvol=backups,compress=zstd,noatime,autodefrag /dev/mapper/raid-slow /mnt/data/backups +#+end_src * Installing the system Let's add git and nixFlakes: #+begin_src sh @@ -88,13 +127,15 @@ nixos-generate-config --root /mnt mkdir /mnt/root git clone https://git.fcuny.net/fcuny/world.git /mnt/root/world mkdir /mnt/root/world/hosts/ -cp /mn/etc/nixos/hardware-configuration.nix /mnt/root/hosts/hosts// +cp /mnt/etc/nixos/hardware-configuration.nix /mnt/root/world/hosts// cp /mnt/root/world/hosts/aptos/default.nix /mnt/root/world/hosts// vim /mnt/root/world/hosts//default.nix +cd /mnt/root/world +git add hosts/tahoe +cd / nixos-install --root /mnt --flake /mnt/root/world# #+end_src - Create another snapshot #+begin_src sh CUSTOMIZE_TIMESTAMP=$(date -u +%Y%m%dT%H%M%S) -- cgit 1.4.1