It’s that time of the year, or decade, to upgrade the file server’s OS. Got myself a new SSD and tought that’d be an easy upgrade path. Here’s what I did.

  • Rebooted as device information can get stale.
  • gparted /dev/sdb, Device » Create partition » gpt
  • ~100 GB at the start, ext4, boot flag
  • 8 GB swap at the end
  • mount /dev/sdb1 /mnt/sdb/1
  • mkswap /dev/sdb2
# get basics in place
debootstrap --arch amd64 xenial /mnt/sdb/1/

# make a runnable environment
mount -o bind /dev /mnt/dev
mount -o bind /dev/pts /mnt/dev/pts
mount -t sysfs /sys /mnt/sys
mount -t proc /proc /mnt/proc
cp /proc/mounts /mnt/etc/mtab
cp /etc/resolv.conf /mnt/etc/resolv.conf

# chroot into it
LANG=en_US.UTF-8 chroot /mnt/

# configure locale
echo 'LC_ALL=en_US.UTF-8' >> /etc/default/locale
locale-gen en_US.UTF-8
update-locale LANG=en_US.UTF-8

cat > /etc/apt/sources.list << EOF
deb xenial main restricted universe multiverse
deb xenial-updates main restricted universe multiverse
deb xenial-backports main restricted universe multiverse
deb xenial-security main restricted universe multiverse
deb xenial partner

apt-get update && apt-get install apt vim openssl-server curl

# prep the user
useradd ceda
echo ceda:password | chpasswd
mkdir -p /home/ceda.ssh
curl > /home/ceda/.ssh/authorized_keys
chown ceda:ceda /home/ceda -R
chmod 755 /home/ceda
chmod 700 /home/ceda/.ssh
chmod 600 /home/ceda/.ssh/authorized_keys

for i in adm cdrom sudo dip plugdev ; do usermod -aG $i ceda ; done

# set hostname
hostnamectl set-hostname XYZ

# make the disk bootable
apt install linux-image-generic
apt install zfsutils-linux dmraid

# back out
exit # chroot
umount /mnt/dev/pts
umount /mnt/dev/
umount /mnt/proc/
umount /mnt/sys
umount /mnt/

First boot

  • fix networking
  • apt install ubuntu-server
  • normal wendt bootstrap (ansible)
  • update infrastructure/machines
  • git clone gitlab-utils (and run sync)


This work by Fredrik Wendt is licensed under CC by-sa.