1
0
mirror of https://github.com/tboerger/nixos-config synced 2024-11-26 07:43:45 +01:00

chore: more changes for the filesystems

This commit is contained in:
Thomas Boerger 2022-11-17 13:10:39 +01:00
parent 8548e2b5bc
commit fcb7775c04
No known key found for this signature in database
GPG Key ID: 09745AFF9D63C79B
7 changed files with 50 additions and 44 deletions

@ -66,8 +66,27 @@ use the `deploy #name` command, at least if it's executed from a NixOS desktop.
### Niflheim ### Niflheim
```console ```console
sudo loadkeys de apt install -y sudo
sudo nix-shell --packages nixUnstable
mkdir -p /etc/nix
echo "build-users-group =" > /etc/nix/nix.conf
curl -L https://nixos.org/nix/install | sh
. $HOME/.nix-profile/etc/profile.d/nix.sh
nix-env -f https://github.com/nix-community/nixos-generators/archive/master.tar.gz -i -v
cat <<EOF > /root/config.nix
{
services.openssh.enable = true;
users.users.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINaQYR0/Oj6k1H03kshz2J7rlGCaDSuaGPhhOs9FcZfn"
];
}
EOF
nixos-generate -o /root/result -f kexec-bundle -c /root/config.nix
/root/result
bash -c "$(curl -fsSL https://raw.githubusercontent.com/tboerger/nixos-config/master/scripts/niflheim-partitions)" bash -c "$(curl -fsSL https://raw.githubusercontent.com/tboerger/nixos-config/master/scripts/niflheim-partitions)"

@ -23,6 +23,8 @@ while true; do
done done
echo "----> Remove previous VGs" echo "----> Remove previous VGs"
vgchange -an
for VG in $(vgs --noheadings 2>/dev/null | sed -e 's/^[[:space:]]*//' | cut -d" " -f 1); do for VG in $(vgs --noheadings 2>/dev/null | sed -e 's/^[[:space:]]*//' | cut -d" " -f 1); do
vgremove -y ${VG} 2>/dev/null vgremove -y ${VG} 2>/dev/null
done done
@ -33,18 +35,10 @@ for PV in $(pvs --noheadings 2>/dev/null | sed -e 's/^[[:space:]]*//' | cut -d"
done done
echo "----> Remove previous MDs" echo "----> Remove previous MDs"
if [[ -d /dev/md ]]; then mdadm --stop --scan || true
for MD in /dev/md/*; do
mdadm --stop $MD
done
fi
echo "----> Remove previous MDs" echo 'AUTO -all
if [[ -d /dev/md ]]; then ARRAY <ignore> UUID=00000000:00000000:00000000:00000000' > /etc/mdadm/mdadm.conf
for MD in /dev/md/*; do
mdadm --stop $MD
done
fi
echo "----> Drop existing partitions" echo "----> Drop existing partitions"
for DISK in pci-0000:00:14.1-ata-1 pci-0000:00:11.0-ata-1.0 pci-0000:00:11.0-ata-2.0 pci-0000:00:11.0-ata-3.0 pci-0000:00:11.0-ata-4.0; do for DISK in pci-0000:00:14.1-ata-1 pci-0000:00:11.0-ata-1.0 pci-0000:00:11.0-ata-2.0 pci-0000:00:11.0-ata-3.0 pci-0000:00:11.0-ata-4.0; do
@ -98,7 +92,9 @@ echo "-----> Reload partition table"
partprobe partprobe
echo "-----> Create raid0 volume" echo "-----> Create raid0 volume"
echo yes | mdadm --create /dev/md0 --level=10 --raid-devices=4 /dev/disk/by-partlabel/tank1 /dev/disk/by-partlabel/tank2 /dev/disk/by-partlabel/tank3 /dev/disk/by-partlabel/tank4 echo yes | mdadm --create /dev/md0 --level=10 --raid-devices=4 --homehost=asgard --name=md0 /dev/disk/by-partlabel/tank1 /dev/disk/by-partlabel/tank2 /dev/disk/by-partlabel/tank3 /dev/disk/by-partlabel/tank4
wipefs -a /dev/md0
echo 0 > /proc/sys/dev/raid/speed_limit_max
echo "-----> Wait for raids" echo "-----> Wait for raids"
sleep 3 sleep 3

@ -23,6 +23,8 @@ while true; do
done done
echo "----> Remove previous VGs" echo "----> Remove previous VGs"
vgchange -an
for VG in $(vgs --noheadings 2>/dev/null | sed -e 's/^[[:space:]]*//' | cut -d" " -f 1); do for VG in $(vgs --noheadings 2>/dev/null | sed -e 's/^[[:space:]]*//' | cut -d" " -f 1); do
vgremove -y ${VG} 2>/dev/null vgremove -y ${VG} 2>/dev/null
done done
@ -33,18 +35,10 @@ for PV in $(pvs --noheadings 2>/dev/null | sed -e 's/^[[:space:]]*//' | cut -d"
done done
echo "----> Remove previous MDs" echo "----> Remove previous MDs"
if [[ -d /dev/md ]]; then mdadm --stop --scan || true
for MD in /dev/md/*; do
mdadm --stop $MD
done
fi
echo "----> Remove previous MDs" echo 'AUTO -all
if [[ -d /dev/md ]]; then ARRAY <ignore> UUID=00000000:00000000:00000000:00000000' > /etc/mdadm/mdadm.conf
for MD in /dev/md/*; do
mdadm --stop $MD
done
fi
echo "----> Drop existing partitions" echo "----> Drop existing partitions"
for DISK in pci-0000:00:1f.2-ata-1.0; do for DISK in pci-0000:00:1f.2-ata-1.0; do

@ -23,6 +23,8 @@ while true; do
done done
echo "----> Remove previous VGs" echo "----> Remove previous VGs"
vgchange -an
for VG in $(vgs --noheadings 2>/dev/null | sed -e 's/^[[:space:]]*//' | cut -d" " -f 1); do for VG in $(vgs --noheadings 2>/dev/null | sed -e 's/^[[:space:]]*//' | cut -d" " -f 1); do
vgremove -y ${VG} 2>/dev/null vgremove -y ${VG} 2>/dev/null
done done
@ -33,11 +35,10 @@ for PV in $(pvs --noheadings 2>/dev/null | sed -e 's/^[[:space:]]*//' | cut -d"
done done
echo "----> Remove previous MDs" echo "----> Remove previous MDs"
if [[ -d /dev/md ]]; then mdadm --stop --scan || true
for MD in /dev/md/*; do
mdadm --stop $MD echo 'AUTO -all
done ARRAY <ignore> UUID=00000000:00000000:00000000:00000000' > /etc/mdadm/mdadm.conf
fi
echo "----> Drop existing partitions" echo "----> Drop existing partitions"
for DISK in pci-0000:00:1f.2-ata-3.0 pci-0000:00:1f.2-ata-4.0 pci-0000:00:1f.2-ata-5.0 pci-0000:00:1f.2-ata-6.0; do for DISK in pci-0000:00:1f.2-ata-3.0 pci-0000:00:1f.2-ata-4.0 pci-0000:00:1f.2-ata-5.0 pci-0000:00:1f.2-ata-6.0; do
@ -93,7 +94,9 @@ echo "-----> Reload partition table"
partprobe partprobe
echo "-----> Create raid0 volume" echo "-----> Create raid0 volume"
echo yes | mdadm --create /dev/md0 --level=10 --raid-devices=4 /dev/disk/by-partlabel/tank1 /dev/disk/by-partlabel/tank2 /dev/disk/by-partlabel/tank3 /dev/disk/by-partlabel/tank4 echo yes | mdadm --create /dev/md0 --level=10 --raid-devices=4 --homehost=niflheim --name=md0 /dev/disk/by-partlabel/tank1 /dev/disk/by-partlabel/tank2 /dev/disk/by-partlabel/tank3 /dev/disk/by-partlabel/tank4
wipefs -a /dev/md0
echo 0 > /proc/sys/dev/raid/speed_limit_max
echo "-----> Wait for raids" echo "-----> Wait for raids"
sleep 3 sleep 3

@ -23,6 +23,8 @@ while true; do
done done
echo "----> Remove previous VGs" echo "----> Remove previous VGs"
vgchange -an
for VG in $(vgs --noheadings 2>/dev/null | sed -e 's/^[[:space:]]*//' | cut -d" " -f 1); do for VG in $(vgs --noheadings 2>/dev/null | sed -e 's/^[[:space:]]*//' | cut -d" " -f 1); do
vgremove -y ${VG} 2>/dev/null vgremove -y ${VG} 2>/dev/null
done done
@ -33,18 +35,10 @@ for PV in $(pvs --noheadings 2>/dev/null | sed -e 's/^[[:space:]]*//' | cut -d"
done done
echo "----> Remove previous MDs" echo "----> Remove previous MDs"
if [[ -d /dev/md ]]; then mdadm --stop --scan || true
for MD in /dev/md/*; do
mdadm --stop $MD
done
fi
echo "----> Remove previous MDs" echo 'AUTO -all
if [[ -d /dev/md ]]; then ARRAY <ignore> UUID=00000000:00000000:00000000:00000000' > /etc/mdadm/mdadm.conf
for MD in /dev/md/*; do
mdadm --stop $MD
done
fi
echo "----> Drop existing partitions" echo "----> Drop existing partitions"
for DISK in pci-0000:00:1f.2-ata-1.0 pci-0000:00:1f.2-ata-2.0; do for DISK in pci-0000:00:1f.2-ata-1.0 pci-0000:00:1f.2-ata-2.0; do

@ -30,7 +30,7 @@
}; };
fileSystems."/boot" = { fileSystems."/boot" = {
device = "/dev/disk/by-label/boot1"; device = "/dev/disk/by-label/boot";
fsType = "ext4"; fsType = "ext4";
options = [ options = [
"noatime" "noatime"

@ -30,7 +30,7 @@
}; };
fileSystems."/boot" = { fileSystems."/boot" = {
device = "/dev/disk/by-label/boot1"; device = "/dev/disk/by-label/boot";
fsType = "ext4"; fsType = "ext4";
options = [ options = [
"noatime" "noatime"