Table of Contents

QEMU

resize qcow2 size:

qemu-img resize /path/to/qcow2 20G
qemu-img resize /path/to/qcow2 +20G

grow guest partition size:

growpart /dev/vda X
# grow ext4
resize2fs /dev/vdaX
# grow btrfs
btrfs filesystem resize max /

Hyper-V

convert qcow2 image to vhdx:

qemu-img convert -p -f qcow2 -O vhdx /path/to/qcow2 /path/to/vhdx

WSL

general commands:

wsl --mount --vhd <VHD> --bare
wsl --unmount <VHD>
growpart /dev/sda 1
Resize-VHD –Path <VHD> –SizeBytes 30GB

shrink VHD:

optimize-vhd -Path .\ext4.vhdx -Mode full

to fix DISPLAY on Arch, create following systemd service:

https://superuser.com/questions/1617298/wsl-2-running-ubuntu-x-server-cant-open-display/1834709#1834709
cat > /etc/systemd/system/wslg.service <<EOF
[Unit]
Description=symlink /tmp/.X11-unix
After=systemd-tmpfiles-setup.service

[Service]
Type=oneshot
ExecStart=rmdir /tmp/.X11-unix
ExecStart=ln -s /mnt/wslg/.X11-unix /tmp/

[Install]
WantedBy=sysinit.target
EOF

enable this service:

systemctl enable wslg

Configs

systemd-networkd:

[Match]
Name=eth*

[Network]
DHCP=yes