QEMU Cookbook
Share memory
- Prepare the Host System:
You need to ensure the 9p kernel module is loaded:
sudo modprobe 9pnet_virtio
- Start the Arch Linux Live ISO with QEMU:
Use this command to start the Arch Linux live ISO while sharing a directory:
qemu-system-x86_64 \ -enable-kvm \ -m 2G \ -cdrom /path/to/archlinux.iso \ -fsdev local,id=fsdev0,path=/path/to/host/directory,security_model=none \ -device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=hostshare
Here:
- Replace
/path/to/archlinux.iso
with the path to the Arch Linux ISO on your host system.
- Replace
/path/to/host/directory
with the path to the directory on your host system that you want to share with the guest.
- Replace
- Mount the Shared Directory in the Arch Live Environment:
Once the Arch Linux live environment boots up:
- Ensure the 9p kernel module is loaded inside the live environment:
sudo modprobe 9pnet_virtio
- Create a mount point:
sudo mkdir /mnt/hostshare
- Mount the shared directory:
sudo mount -t 9p -o trans=virtio,version=9p2000.L hostshare /mnt/hostshare
- Ensure the 9p kernel module is loaded inside the live environment: