more btrfs

This commit is contained in:
Christoph Cullmann 2024-10-28 21:44:59 +01:00
parent 8c4e37dbfa
commit cda9073271
No known key found for this signature in database

View file

@ -56,41 +56,34 @@ for D in $DISK $DISK2 $DISK3; do
done
# take a look at the partitions
cat /proc/partitions
lsblk
# create the RAID-0, second partitions on all disks
mdadm --create /dev/md/system --level=0 --raid-devices=3 $DISK-part2 $DISK2-part2 $DISK3-part2
sleep 5
# take a look at the partitions
lsblk
# create the LUKS container and open it
cryptsetup luksFormat --sector-size 4096 --batch-mode --verify-passphrase /dev/md/system
cryptsetup luksOpen /dev/md/system crypt-system
sleep 5
# take a look at the partitions
lsblk
# create btrfs with volumes
mkfs.btrfs -f --features block-group-tree --label system /dev/mapper/crypt2
mkfs.btrfs -f --features block-group-tree --label system /dev/mapper/crypt-system
mount -t btrfs /dev/mapper/crypt-system /mnt
btrfs subvolume create /mnt/data
btrfs subvolume create /mnt/nix
btrfs subvolume create /mnt/tmp
umount /mnt
sleep 5
# show the pool
zpool status
sleep 5
# create all the volumes
zfs create -o mountpoint=legacy zpool/data
zfs create -o mountpoint=legacy zpool/nix
zfs create -o mountpoint=legacy zpool/tmp
# we want 64 KB recordsize
zfs set recordsize=64K zpool/data
zfs set recordsize=64K zpool/nix
zfs set recordsize=64K zpool/tmp
sleep 5
# show the pool
zpool status
sleep 5
# take a look at the partitions
lsblk
# prepare install, tmpfs root
mount -t tmpfs none /mnt
@ -102,13 +95,12 @@ mkdir -p /mnt/{data,nix,home,boot,root,etc/nixos,tmp}
mount $DISK-part1 /mnt/boot
# mount volumes
mount -t zfs zpool/data /mnt/data
mount -t zfs zpool/nix /mnt/nix
mount -t zfs zpool/tmp /mnt/tmp
mount -o subvol=data,noatime /mnt/data
mount -o subvol=nix,noatime /mnt/nix
mount -o subvol=tmp,noatime /mnt/tmp
# bind mount persistent stuff to data
mkdir -p /mnt/data/{home,root,nixos/$HOST}
mount --bind /mnt/data/home /mnt/home
mkdir -p /mnt/data/{root,nixos/$HOST}
mount --bind /mnt/data/root /mnt/root
mount --bind /mnt/data/nixos/$HOST /mnt/etc/nixos
@ -135,7 +127,7 @@ nixos-install --option experimental-features 'nix-command flakes' --no-root-pass
# unmount all stuff and sync
umount -Rl /data /mnt
zpool export -a
cryptsetup luksClose crypt-system
# shutdown once