more btrfs
This commit is contained in:
parent
8c4e37dbfa
commit
cda9073271
|
@ -56,41 +56,34 @@ for D in $DISK $DISK2 $DISK3; do
|
||||||
done
|
done
|
||||||
|
|
||||||
# take a look at the partitions
|
# take a look at the partitions
|
||||||
cat /proc/partitions
|
lsblk
|
||||||
|
|
||||||
# create the RAID-0, second partitions on all disks
|
# 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
|
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
|
# create the LUKS container and open it
|
||||||
cryptsetup luksFormat --sector-size 4096 --batch-mode --verify-passphrase /dev/md/system
|
cryptsetup luksFormat --sector-size 4096 --batch-mode --verify-passphrase /dev/md/system
|
||||||
cryptsetup luksOpen /dev/md/system crypt-system
|
cryptsetup luksOpen /dev/md/system crypt-system
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
# take a look at the partitions
|
||||||
|
lsblk
|
||||||
|
|
||||||
# create btrfs with volumes
|
# 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
|
sleep 5
|
||||||
|
|
||||||
# show the pool
|
# take a look at the partitions
|
||||||
zpool status
|
lsblk
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
# prepare install, tmpfs root
|
# prepare install, tmpfs root
|
||||||
mount -t tmpfs none /mnt
|
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 $DISK-part1 /mnt/boot
|
||||||
|
|
||||||
# mount volumes
|
# mount volumes
|
||||||
mount -t zfs zpool/data /mnt/data
|
mount -o subvol=data,noatime /mnt/data
|
||||||
mount -t zfs zpool/nix /mnt/nix
|
mount -o subvol=nix,noatime /mnt/nix
|
||||||
mount -t zfs zpool/tmp /mnt/tmp
|
mount -o subvol=tmp,noatime /mnt/tmp
|
||||||
|
|
||||||
# bind mount persistent stuff to data
|
# bind mount persistent stuff to data
|
||||||
mkdir -p /mnt/data/{home,root,nixos/$HOST}
|
mkdir -p /mnt/data/{root,nixos/$HOST}
|
||||||
mount --bind /mnt/data/home /mnt/home
|
|
||||||
mount --bind /mnt/data/root /mnt/root
|
mount --bind /mnt/data/root /mnt/root
|
||||||
mount --bind /mnt/data/nixos/$HOST /mnt/etc/nixos
|
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
|
# unmount all stuff and sync
|
||||||
|
|
||||||
umount -Rl /data /mnt
|
umount -Rl /data /mnt
|
||||||
zpool export -a
|
cryptsetup luksClose crypt-system
|
||||||
|
|
||||||
# shutdown once
|
# shutdown once
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue