dtrfs/README.md

42 lines
1.9 KiB
Markdown

<!--
SPDX-License-Identifier: Unlicense
-->
## OS template
You will need a working OS template to work with this project.
Easy solution create an OS template:
- start any archlinux machine (the arch installer also works)
- install `arch-install-scripts`
- run `pacstrap /mnt base openssh` to install base packages to /mnt
- run `ln -s /usr/lib/systemd/system/sshd.service /mnt/etc/systemd/system/multi-user.target.wants/sshd.service`
- run `fsarchiver savedir /tmp/os_template.fsa /mnt` to save your OS template
- download `/tmp/os_template.fsa` to your machine
- upload the `os_template.fsa` anywhere so that it can be downloaded with wget
Some notes on the above:
- base is the only package required to run a dtrfs VM; the kernel is not needed cause we are using SNP
- you will need sshd to operate the VM, so create the symlink to make it start with the OS
- fsarchiver is very good at preserving OS data
- fsarchiver saves the absolute path (which means you must use `/mnt` as this is hardcoded)
- the initrd will dump that template to the encrypted disk
- the same procedure can be used with any distribution, but we didn't test that yet
## initrd and linux
You will need an initrd and a kernel to run SNP VMs.
- start any archlinux machine
- clone this repo
- inspect your kernel version by running `file -sL /boot/vmlinuz-linux`.
- (optional) update the kernel version in `./creator_exports.sh`
- create the initrd by running `./create.sh`; this will save the initrd in the build folder
- grab your kernel from `/boot/vmlinuz-linux` and...
- ... upload kernel and initrd to your hypervizor
## module scanner
Optionally, you can use `./remote_create.sh` to upload this repo to remote node and build your initrd.
This will automatically scan the kernel modules running on the remote host, and package all modules in the initrd. This is ideal if your VM has a setup that is not cover by the modules hardcoded in this repo.