refactor(setup): improve handling of partition prefix
This commit is contained in:
parent
969e644e74
commit
ccd0bc0a54
9 changed files with 75 additions and 75 deletions
|
@ -2,7 +2,7 @@
|
|||
# [[file:readme.org::data_setup][data_setup]]
|
||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::boilerplate][boilerplate]]][boilerplate]]
|
||||
DISK=$1
|
||||
PARTITION_PREFIX=$2
|
||||
PART=$DISK$2
|
||||
|
||||
sudo mkdir -p /mnt
|
||||
# boilerplate ends here
|
||||
|
@ -22,13 +22,13 @@ sudo parted $DISK -s -- mkpart primary btrfs 0% 100%
|
|||
|
||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::data_filesystems][data_filesystems]]][data_filesystems]]
|
||||
echo "LOG: Making data filesystems"
|
||||
echo "- Making btrfa filesystem on ${DISK}${PARTITION_PREFIX}1"
|
||||
sudo mkfs.btrfs "${DISK}${PARTITION_PREFIX}1" --csum xxhash -L "data" -f
|
||||
echo "- Making btrfa filesystem on ${PART}1"
|
||||
sudo mkfs.btrfs "${PART}1" --csum xxhash -L "data" -f
|
||||
# data_filesystems ends here
|
||||
|
||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::data_subvolumes][data_subvolumes]]][data_subvolumes]]
|
||||
echo "LOG: Making data subvolumes on ${DISK}${PARTITION_PREFIX}1"
|
||||
sudo mount "${DISK}${PARTITION_PREFIX}1" /mnt
|
||||
echo "LOG: Making data subvolumes on ${PART}1"
|
||||
sudo mount "${PART}1" /mnt
|
||||
sudo btrfs subvolume create /mnt/root
|
||||
sudo btrfs subvolume create /mnt/root/srv
|
||||
sudo btrfs subvolume create /mnt/root/srv/minecraft
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::mount][mount]]][mount]]
|
||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::boilerplate][boilerplate]]][boilerplate]]
|
||||
DISK=$1
|
||||
PARTITION_PREFIX=$2
|
||||
PART=$DISK$2
|
||||
|
||||
sudo mkdir -p /mnt
|
||||
# boilerplate ends here
|
||||
|
@ -21,9 +21,9 @@ sudo mount -t tmpfs root /mnt
|
|||
|
||||
echo "LOG: - Mounting persistent directories"
|
||||
sudo mkdir -p /mnt/persist /mnt/nix /mnt/boot
|
||||
sudo mount -o subvol=root,autodefrag,noatime "${DISK}${PARTITION_PREFIX}2" /mnt/persist
|
||||
sudo mount -o subvol=nix,autodefrag,noatime "${DISK}${PARTITION_PREFIX}2" /mnt/nix
|
||||
sudo mount -o subvol=boot,autodefrag,noatime "${DISK}${PARTITION_PREFIX}2" /mnt/boot
|
||||
sudo mount -o subvol=root,autodefrag,noatime "${PART}2" /mnt/persist
|
||||
sudo mount -o subvol=nix,autodefrag,noatime "${PART}2" /mnt/nix
|
||||
sudo mount -o subvol=boot,autodefrag,noatime "${PART}2" /mnt/boot
|
||||
|
||||
echo "LOG: - - Mounting persistent subdirectories"
|
||||
sudo mkdir -p /mnt/home
|
||||
|
@ -31,7 +31,7 @@ sudo mount --bind /mnt/persist/home /mnt/home
|
|||
|
||||
echo "LOG: - Mounting EFI System Partition"
|
||||
sudo mkdir -p /mnt/boot/efi
|
||||
sudo mount "${DISK}${PARTITION_PREFIX}1" /mnt/boot/efi
|
||||
sudo mount "${PART}1" /mnt/boot/efi
|
||||
# mounting ends here
|
||||
# mount ends here
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# [[file:readme.org::mount][mount]]
|
||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::boilerplate][boilerplate]]][boilerplate]]
|
||||
DISK=$1
|
||||
PARTITION_PREFIX=$2
|
||||
PART=$DISK$2
|
||||
|
||||
sudo mkdir -p /mnt
|
||||
# boilerplate ends here
|
||||
|
@ -20,9 +20,9 @@ sudo mount -t tmpfs root /mnt
|
|||
|
||||
echo "LOG: - Mounting persistent directories"
|
||||
sudo mkdir -p /mnt/persist /mnt/nix /mnt/boot
|
||||
sudo mount -o subvol=root,autodefrag,noatime "${DISK}${PARTITION_PREFIX}2" /mnt/persist
|
||||
sudo mount -o subvol=nix,autodefrag,noatime "${DISK}${PARTITION_PREFIX}2" /mnt/nix
|
||||
sudo mount -o subvol=boot,autodefrag,noatime "${DISK}${PARTITION_PREFIX}2" /mnt/boot
|
||||
sudo mount -o subvol=root,autodefrag,noatime "${PART}2" /mnt/persist
|
||||
sudo mount -o subvol=nix,autodefrag,noatime "${PART}2" /mnt/nix
|
||||
sudo mount -o subvol=boot,autodefrag,noatime "${PART}2" /mnt/boot
|
||||
|
||||
echo "LOG: - - Mounting persistent subdirectories"
|
||||
sudo mkdir -p /mnt/home
|
||||
|
@ -30,6 +30,6 @@ sudo mount --bind /mnt/persist/home /mnt/home
|
|||
|
||||
echo "LOG: - Mounting EFI System Partition"
|
||||
sudo mkdir -p /mnt/boot/efi
|
||||
sudo mount "${DISK}${PARTITION_PREFIX}1" /mnt/boot/efi
|
||||
sudo mount "${PART}1" /mnt/boot/efi
|
||||
# mounting ends here
|
||||
# mount ends here
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# [[file:readme.org::preparation][preparation]]
|
||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::boilerplate][boilerplate]]][boilerplate]]
|
||||
DISK=$1
|
||||
PARTITION_PREFIX=$2
|
||||
PART=$DISK$2
|
||||
|
||||
sudo mkdir -p /mnt
|
||||
# boilerplate ends here
|
||||
|
@ -20,17 +20,17 @@ sudo parted $DISK -s -- set 1 esp on
|
|||
|
||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::filesystems][filesystems]]][filesystems]]
|
||||
echo "LOG: Making filesystems"
|
||||
echo "- Making fat32 filesystem on ${DISK}${PARTITION_PREFIX}1"
|
||||
sudo mkfs.fat -F 32 -n boot "${DISK}${PARTITION_PREFIX}1"
|
||||
echo "- Making btrfs filesystem on ${DISK}${PARTITION_PREFIX}2"
|
||||
sudo mkfs.btrfs "${DISK}${PARTITION_PREFIX}2" -L "Infini-SERVER" -f
|
||||
echo "- Making swap space on ${DISK}${PARTITION_PREFIX}3"
|
||||
sudo mkswap -L swap "${DISK}${PARTITION_PREFIX}3"
|
||||
echo "- Making fat32 filesystem on ${PART}1"
|
||||
sudo mkfs.fat -F 32 -n boot "${PART}1"
|
||||
echo "- Making btrfs filesystem on ${PART}2"
|
||||
sudo mkfs.btrfs "${PART}2" -L "Infini-SERVER" -f
|
||||
echo "- Making swap space on ${PART}3"
|
||||
sudo mkswap -L swap "${PART}3"
|
||||
# filesystems ends here
|
||||
|
||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::subvolumes][subvolumes]]][subvolumes]]
|
||||
echo "LOG: Making subvolumes on ${DISK}${PARTITION_PREFIX}2"
|
||||
sudo mount "${DISK}${PARTITION_PREFIX}2" /mnt
|
||||
echo "LOG: Making subvolumes on ${PART}2"
|
||||
sudo mount "${PART}2" /mnt
|
||||
sudo btrfs subvolume create /mnt/root
|
||||
sudo btrfs subvolume create /mnt/root/home
|
||||
sudo mkdir -p /mnt/root/etc
|
||||
|
|
|
@ -74,7 +74,7 @@ Setup for my main server hosting computer, using an Nvidia GPU and the =server=
|
|||
#+NAME: boilerplate
|
||||
#+BEGIN_SRC bash
|
||||
DISK=$1
|
||||
PARTITION_PREFIX=$2
|
||||
PART=$DISK$2
|
||||
|
||||
sudo mkdir -p /mnt
|
||||
#+END_SRC
|
||||
|
@ -104,20 +104,20 @@ sudo parted $DISK -s -- set 1 esp on
|
|||
#+NAME: filesystems
|
||||
#+BEGIN_SRC bash
|
||||
echo "LOG: Making filesystems"
|
||||
echo "- Making fat32 filesystem on ${DISK}${PARTITION_PREFIX}1"
|
||||
sudo mkfs.fat -F 32 -n boot "${DISK}${PARTITION_PREFIX}1"
|
||||
echo "- Making btrfs filesystem on ${DISK}${PARTITION_PREFIX}2"
|
||||
sudo mkfs.btrfs "${DISK}${PARTITION_PREFIX}2" -L "Infini-SERVER" -f
|
||||
echo "- Making swap space on ${DISK}${PARTITION_PREFIX}3"
|
||||
sudo mkswap -L swap "${DISK}${PARTITION_PREFIX}3"
|
||||
echo "- Making fat32 filesystem on ${PART}1"
|
||||
sudo mkfs.fat -F 32 -n boot "${PART}1"
|
||||
echo "- Making btrfs filesystem on ${PART}2"
|
||||
sudo mkfs.btrfs "${PART}2" -L "Infini-SERVER" -f
|
||||
echo "- Making swap space on ${PART}3"
|
||||
sudo mkswap -L swap "${PART}3"
|
||||
#+END_SRC
|
||||
|
||||
** Making Subvolumes
|
||||
|
||||
#+NAME: subvolumes
|
||||
#+BEGIN_SRC bash
|
||||
echo "LOG: Making subvolumes on ${DISK}${PARTITION_PREFIX}2"
|
||||
sudo mount "${DISK}${PARTITION_PREFIX}2" /mnt
|
||||
echo "LOG: Making subvolumes on ${PART}2"
|
||||
sudo mount "${PART}2" /mnt
|
||||
sudo btrfs subvolume create /mnt/root
|
||||
sudo btrfs subvolume create /mnt/root/home
|
||||
sudo mkdir -p /mnt/root/etc
|
||||
|
@ -137,9 +137,9 @@ sudo mount -t tmpfs root /mnt
|
|||
|
||||
echo "LOG: - Mounting persistent directories"
|
||||
sudo mkdir -p /mnt/persist /mnt/nix /mnt/boot
|
||||
sudo mount -o subvol=root,autodefrag,noatime "${DISK}${PARTITION_PREFIX}2" /mnt/persist
|
||||
sudo mount -o subvol=nix,autodefrag,noatime "${DISK}${PARTITION_PREFIX}2" /mnt/nix
|
||||
sudo mount -o subvol=boot,autodefrag,noatime "${DISK}${PARTITION_PREFIX}2" /mnt/boot
|
||||
sudo mount -o subvol=root,autodefrag,noatime "${PART}2" /mnt/persist
|
||||
sudo mount -o subvol=nix,autodefrag,noatime "${PART}2" /mnt/nix
|
||||
sudo mount -o subvol=boot,autodefrag,noatime "${PART}2" /mnt/boot
|
||||
|
||||
echo "LOG: - - Mounting persistent subdirectories"
|
||||
sudo mkdir -p /mnt/home
|
||||
|
@ -147,7 +147,7 @@ sudo mount --bind /mnt/persist/home /mnt/home
|
|||
|
||||
echo "LOG: - Mounting EFI System Partition"
|
||||
sudo mkdir -p /mnt/boot/efi
|
||||
sudo mount "${DISK}${PARTITION_PREFIX}1" /mnt/boot/efi
|
||||
sudo mount "${PART}1" /mnt/boot/efi
|
||||
#+END_SRC
|
||||
|
||||
** Installing
|
||||
|
@ -195,16 +195,16 @@ sudo parted $DISK -s -- mkpart primary btrfs 0% 100%
|
|||
#+NAME: data_filesystems
|
||||
#+BEGIN_SRC bash
|
||||
echo "LOG: Making data filesystems"
|
||||
echo "- Making btrfa filesystem on ${DISK}${PARTITION_PREFIX}1"
|
||||
sudo mkfs.btrfs "${DISK}${PARTITION_PREFIX}1" --csum xxhash -L "data" -f
|
||||
echo "- Making btrfa filesystem on ${PART}1"
|
||||
sudo mkfs.btrfs "${PART}1" --csum xxhash -L "data" -f
|
||||
#+END_SRC
|
||||
|
||||
*** Making Subvolumes
|
||||
|
||||
#+NAME: data_subvolumes
|
||||
#+BEGIN_SRC bash
|
||||
echo "LOG: Making data subvolumes on ${DISK}${PARTITION_PREFIX}1"
|
||||
sudo mount "${DISK}${PARTITION_PREFIX}1" /mnt
|
||||
echo "LOG: Making data subvolumes on ${PART}1"
|
||||
sudo mount "${PART}1" /mnt
|
||||
sudo btrfs subvolume create /mnt/root
|
||||
sudo btrfs subvolume create /mnt/root/srv
|
||||
sudo btrfs subvolume create /mnt/root/srv/minecraft
|
||||
|
@ -227,6 +227,6 @@ sudo parted $DISK -s -- mkpart primary btrfs 0% 100%
|
|||
#+NAME: backup_filesystems
|
||||
#+BEGIN_SRC bash
|
||||
echo "LOG: Making backup filesystems"
|
||||
echo "- Making btrfa filesystem on ${DISK}${PARTITION_PREFIX}1"
|
||||
sudo mkfs.btrfs "${DISK}${PARTITION_PREFIX}1" --csum xxhash -L "backup"
|
||||
echo "- Making btrfa filesystem on ${PART}1"
|
||||
sudo mkfs.btrfs "${PART}1" --csum xxhash -L "backup"
|
||||
#+END_SRC
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue