WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: qemu shared folder  (Read 38 times)

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 15848
qemu shared folder
« on: Today at 05:02:49 AM »
How to create a qemu host/guest shared folder.

For the moment at least, the tinycore kernel needs to recompiled with the following set in the kernel config:
Code: [Select]
CONFIG_NET_9P
CONFIG_NET_9P_VIRTIO=y
CONFIG_9P_FS=y
CONFIG_9P_FS_POSIX_ACL=y
CONFIG_PCI=y
CONFIG_VIRTIO_PCI=y

Note that the host will need 9p enabled.

Then, assuming you have first booted the TinyCorePure64 iso with qemu and used tce-install-GUI to install TinyCorePure to the guest hd (sda1), you will need to copy the new bzImage to the qemu image (vdisk.img).

Code: [Select]
sudo modprobe nbd max_part=8
sudo qemu-nbd --connect=/dev/nbd0 vdisk.img
sudo mount /dev/nbd0p1 /mnt/sdb1/shared

[copy new bzImage to /mnt/sda1/tce/boot and adjust extlinux config.

sudo umount /mnt/sdb1/shared
sudo qemu-nbd --disconnect /dev/nbd0

Now boot the modified qemu image:
Code: [Select]
qemu-system-x86_64 -enable-kvm -hda vdisk.img -m 2G -device virtio-gpu-gl -display gtk,gl=on -virtfs local,path=/mnt/sdb1/shared,mount_tag=shared,
security_model=none -boot d

..and in the qemu guest:
Code: [Select]
tce-load -i util-linux
sudo /usr/local/bin/mount -t 9p -o trans=virtio,version=9p2000.L shared /mnt/sda1/shared

Now any files copied to the host folder /mnt/sdb1/shared will appear in the guest folder /mnt/sda1/shared and vice versa.