adjust fstab and mount device param

This commit is contained in:
iceBear67
2026-06-15 17:40:12 +08:00
parent 37d68dfcab
commit 71f46fb430
6 changed files with 17 additions and 19 deletions

View File

@@ -0,0 +1,5 @@
todo:
1. specify id for vm disks
2. figure out if we need direct=on on --disk options
3. test on my homelab?

View File

@@ -1,14 +0,0 @@
[Unit]
Description=VirtioFS daemon
[Service]
Type=simple
ExecStart=/usr/libexec/virtiofsd \
--socket-path=/run//virtiofs.sock \
--shared-dir=/srv/vm1-data
Restart=always
RestartSec=1
[Install]
WantedBy=multi-user.target

View File

@@ -2,7 +2,7 @@ SHELL := /bin/sh
# --- configurable ---------------------------------------------------- # --- configurable ----------------------------------------------------
IMAGE_NAME = alpine-vm IMAGE_NAME = alpine-vm
IMAGE_SIZE ?= 2G IMAGE_SIZE ?= 1G
IMAGE_FORMAT = raw IMAGE_FORMAT = raw
ALPINE_BRANCH ?= latest-stable ALPINE_BRANCH ?= latest-stable
KERNEL_FLAVOR ?= virt KERNEL_FLAVOR ?= virt

View File

@@ -32,10 +32,16 @@ rc-update add net.eth0 default
rc-update add acpid default rc-update add acpid default
rc-update add docker default rc-update add docker default
rc-update add cronie default rc-update add cronie default
rc-update add mount boot
step 'Clean up APK cache' step 'Clean up APK cache and documents'
rm -rf /var/cache/apk/* || true rm -rf /var/cache/apk/* || true
rm -rf \
/usr/share/man \
/usr/share/doc \
/usr/share/info
step 'Setup git user' step 'Setup git user'
git config --user.email bearnet+keeper@sab.ee git config --user.email bearnet+keeper@sab.ee
git config --user.name "B.B.K.K.B.K.K" git config --user.name "B.B.K.K.B.K.K"

View File

@@ -1,5 +1,4 @@
# /etc/fstab: static file system information # /etc/fstab: static file system information
# #
# <file system> <mount point> <type> <options> <dump> <pass> # <file system> <mount point> <type> <options> <dump> <pass>
/dev/root / ext4 rw,noatime 0 1 /dev/vdb /data ext4 rw,noatime 0 1
data /data virtiofs rw,noatime,_netdev 0 0

View File

@@ -2,7 +2,9 @@
set -euo pipefail set -euo pipefail
/usr/bin/cloud-hypervisor \ /usr/bin/cloud-hypervisor \
--kernel /boot/vmlinuz-virt --initramfs /boot/initramfs-virt --disk path=/image/vm.raw \ --kernel /boot/vmlinuz-virt --initramfs /boot/initramfs-virt \
--disk path=/image/vm.raw,image_type=raw \
--disk path=/image/data.raw,direct=on\
--cmdline "root=/dev/vda rootfstype=ext4 modules=ext4a rw console=hvc0" \ --cmdline "root=/dev/vda rootfstype=ext4 modules=ext4a rw console=hvc0" \
--cpus boot=${CPU_COUNT:-4} \ --cpus boot=${CPU_COUNT:-4} \
--memory size=${MEMORY:-4G},shared=on \ --memory size=${MEMORY:-4G},shared=on \