Skip to content

Bare Metal Deployment

skyper edited this page Jun 16, 2023 · 16 revisions

These instructions are for administrators who like to provision a Segfault.net Server Centre (SSC) onto dedicated bare metal server.

This is how we deploy a SSC to a bare metal server.

Option A - SSD & NVME

  • 1x 256 GB /dev/sda (unused). Used for /sf/config and /sec
  • 1x 2 TB /dev/nvme0n1 (boot & root filesystem). Remaining used for swap.
  • 1x 2 TB /dev/nvme1n1 (unused). Used for segfault

Option B - SSD (raid1)

  • 2x 894.25 GB SSD

Setup A & B

Continue reading Preparing the SSC.

Option A

Boot into Rescue Mode

e2fsck -f /dev/nvme0n1p5
resize2fs /dev/nvme0n1p5 32G # (8388608 * 4k long => 67108864 * 512 blocks)
fdisk /dev/nvme0n1
# - d: delete partition 5
# - n: New partition. Same start and length +67108864. Do not remove signature (when asked)
# - w: save & exit
reboot

Create swap

fdisk /dev/nvme0n1
# - n: New partition 6
# - +512G
# - t -> 6 -> swap: Set type swap on new partition
# - w: write & exit
addswap /dev/nvme0n1p6

Create Filesystem for Segfault:

addsf /dev/nvme1n1
mount /sf

Create /sf/config (encrypted)

echo LUKSPASSWORD=$(head -c 1024 /dev/urandom | tr -dc '[:alpha:]' | head -c 22)
cryptsetup luksFormat /dev/sda
cryptsetup luksOpen /dev/sda sdaluks
fdisk /dev/mapper/sdaluks
# - n: New partition, +1G
# - n: New partition, all the remaining size
# - w: write & exit
partprobe
mkfs -t xfs /dev/mapper/sdaluks1
mkfs -t xfs /dev/mapper/sdaluks2
mkdir /sec
mount -o nofail,noatime /dev/mapper/sdaluks1 /sf/config
mount -o nofail,noatime /dev/mapper/sdaluks2 /sec

Option B

Assuming:

fdisk -l
/dev/sda1            2048    1050623    1048576  512M fd Linux raid autodetect
/dev/sda2         1050624   25626623   24576000 11.7G fd Linux raid autodetect
/dev/sdb1            2048    1050623    1048576  512M fd Linux raid autodetect
/dev/sdb2         1050624   25626623   24576000 11.7G fd Linux raid autodetect
fdisk /dev/sda
# n -> +1G   - new partition (for /sf/config)
# t -> fd    - type to 'Linux raid autodetect'
# n -> +128G - new partition (for swap1)
# t -> swap  - type to 'Linux Swap' 
# n          - all the remaining space
# t -> fd    - type to 'Linux raid autodetect'
# w - save & exit

repeat for fdisk /dev/sdb.

fdisk -l /dev/sda
/dev/sda1            2048    1050623    1048576  512M fd Linux raid autodetect
/dev/sda2         1050624   25626623   24576000 11.7G fd Linux raid autodetect
/dev/sda3        25626624  294062079  268435456  128G 82 Linux swap / Solaris
/dev/sda4       294062080 1875385007 1581322928  754G fd Linux raid autodetect
addswap /dev/sda3
addswap /dev/sdb3
swapon -a
mdadm --create /dev/md2 --level=mirror --raid-devices=2 /dev/sda4 /dev/sdb4
mdadm --detail --scan  --verbose /dev/md2 | head -n1 | tee -a /etc/mdadm/mdadm.conf
update-initramfs -u
fdisk /dev/md2
# - n: New partition, +8G (for /sf/config)
# - n: New partitoin, all the remaining size (for /sf)
addsf /dev/md2p2
echo LUKSPASSWORD=$(head -c 1024 /dev/urandom | tr -dc '[:alpha:]' | head -c 22)
cryptsetup luksFormat /dev/md2p1
cryptsetup luksOpen /dev/md2p1 sfluks
mkfs -t xfs /dev/mapper/sfluks
mount -o nofail,noatime /dev/mapper/sfluks /sf/config

Continue reading Installing the SSC.