Skip to content

Instantly share code, notes, and snippets.

@Vitawt-The-Duke
Last active April 5, 2024 11:09
Show Gist options
  • Save Vitawt-The-Duke/3bcf5eab48dfa4d8ca4866cd7be9826e to your computer and use it in GitHub Desktop.
Save Vitawt-The-Duke/3bcf5eab48dfa4d8ca4866cd7be9826e to your computer and use it in GitHub Desktop.
Ubuntu Root on ZFS at OVH dedicated server

Step 1. Starting the Rescue System - Linux 64bit

boot your system in resque mode from OVH console

Step 2. Connect to Rescue System vis SSH and clean FS

before qemu run and install wipe all FS on target disks

wipefs -af /dev/nvme*

Step 3. Download ubuntu desktop image (native zfs support)

 wget https://releases.ubuntu.com/22.04.2/ubuntu-22.04.2-desktop-amd64.iso
 lsblk
 printf "change vnc password\n%s\n" MYPASSWORD | qemu-system-x86_64 -enable-kvm -m 10240 -hda /dev/nvme0n1 -hdb /dev/nvme1n1 -cdrom ubuntu-22.04.2-desktop-amd64.iso -boot d -vnc :0,password -monitor stdio
 

MYPASSWORD is a password for VNC connection

Step 4. Connect via VNC to your server port 5900, and complete OS installation

Use serverip:0 and your password
During install setup Ubuntu with zfs entrie disk to the first of your nvme (in qemu it will show as sda) ater succeed installation shutdown host and stop qemu in your resque console then start qemu and set parameter to boot from already installed system in VNC (/dev/nvme0n1)

printf "change vnc password\n%s\n" MYPASSWORD | qemu-system-x86_64 -enable-kvm -m 10240 -hda /dev/nvme0n1 -hdb /dev/nvme1n1 -vnc :0,password -monitor stdio

Qemu will boot to installed Ubuntu.

Install openssh server and enable it:

sudo apt install openssh-server -y
sudo systemctl enable --now ssh
sudo halt

Than exit qemu on rescue console and change system boot to hard drive from OVH console

Step 5. Create FS on second drive and zfs pools

Login to your machine using ssh Check current pools

zpool list -v

Check that /dev/nvme1n1 is clear

lsblk

Copy partition table from nvme0n1 to nvme1n1

sfdisk -d /dev/nvme0n1 | cut -d, -f 1-3 | sfdisk /dev/nvme1n1

check pool mounted partitions with ID's

blkid | grep PARTU | grep p5

label should be like LABEL="rpool"

blkid | grep PARTU | grep p4

and LABEL="bpool"

Add mirroring partitions for rpool and pbool devices

zpool attach bpool 142fa0ca-ec40-3242-8fbf-16dc3ab0ec6c(/dev/desk/by-id we want to add) 7e4b6644-1a53-da4f-bb2a-f2b626f996ff(/dev/desk/by-id we adding)

And make the simillar rpool Then chack if all as we need

zpool list -v

Step 6. Delete Desktop stuff

cd ~
rm -rf {Documents/,Downloads/,Music/,Pictures/,Public/,Templates/,Videos/}
sudo apt purge -y ubuntu-desktop nautilus nautilus-* gnome-power-manager gnome-screensaver gnome-termina* gnome-pane* gnome-applet* gnome-bluetooth gnome-desktop* gnome-sessio* gnome-user* gnome-shell-common zeitgeist-core libzeitgeist* gnome-control-center gnome-screenshot
sudo apt autoremove -y
sudo apt autoclean -y
  • enjoy your zfs ubuntu server :)
@p10tyr
Copy link

p10tyr commented Apr 5, 2024

-bash: qemu-system-x86_64: command not found
then install
apt-get install qemu-system

for pools grep p5 and p4 does not work if using rust disks instead of nvme just grep PARTU

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment