0

I know this is a question which has been asked many times before, and it should be simple. I think I'm close but I must be doing something wrong.

This is my first time using QEMU and I'm really struggling. I am using virt manager to host windows 7 and I'm trying to get files to and from MX Linux. First, I attempted to download something from github on the windows VM so it could recognise linux files (it might have been winfsp or something else, I don't have my search history).

Then I ran into my first road-block:

Windows only has internet explorer installed, and I can hardly view any pages, I was unable to download chrome, chromium, firefox or brave on the VM. I tried to load files in the VM using a USB stick, I didn't manage this either. I gave up on trying to download anything from the internet on the guest VM. I decided rather than passing linux files to windows, I'd try and pass windows files on linux to windows guest-

Then finally I was a bit sketchy but I created a NTFS then exFAT 8mb partition on my nvme drive using fdisk and then mkfs.ntsf then when that didn't work mkfs.exfat without success either. I don't quite understand what the 'tag name' (like "shared") means, does this become the drive name in the windows VM? My rough method was sudo mount -t virtiofs shared /dev/nvme0n1p4 then in virt manager I added a hardware > filesystem: I tried Driver = mount, mode I tried quite a few like squich and passthrough, for the source path I tried "/dev/nvme0n1p4" and I also tried "/media/1toneboy/352D-156E/test folder" and for target path I called it "shared"

But when I then went to start the virtual machine it said (sorry I'm not at home I don't have the exact wording) error: bad file type, superblock....permission denied

Is there anything I'm doing obviously wrong in passing an NTFS or exfat partition to the VM? Is there a more simple way to transfer file?

Thanks very much!

1 Answer 1

1

You're confusing two entirely different features.

then in virt manager I added a hardware > filesystem

This function is not for passing a partition to the VM. It is for passing a folder, or the contents of a partition. This works similar to network file sharing – the VM talks to the host using essentially a network protocol (an adaptation of the FUSE protocol) to access individual files, and is completely unaware of the actual filesystem being used underneath. In other words, the "share a filesystem" feature is similar to serving files over FTP or HTTP.

So the mount -t virtiofs would be done on the guest to access this shared folder through VirtioFS – that's where the 'tag' comes into play – whereas on the host you need to mount the partition using whatever filesystem it actually contains (e.g. -t exfat for an exFAT partition).

(To be clear though, since the guest only deals with files and folders, not with the raw filesystem, you don't need to use NTFS or exFAT for the VirtioFS method – you can share any folder from any filesystem, like "/home/1tone/shared" and there's no point in creating a dedicated partition for that.)

However, you can only use this method with guests that support VirtioFS (or the older 9p). Windows needs a third-party driver for VirtioFS. In theory it should have native 9p support (it uses that for WSL), but I'm not sure whether that's usable from the guest side.

So instead of all that, you likely want to pass the actual /dev/nvme0n1p4 to the VM – but you need to pass it as an additional 'disk' (block device), not as a 'filesystem'. In this case it does need to be NTFS or exFAT or something else understood by Windows, and in this case it must be unmounted from the host before starting the guest.

7
  • Thank you for the reply, I was way off then. Can you hold my hand a bit more- so if I add a SATA Disk in Virt manager, how do I then pass the unmounted /dev/nvme0n1p4 NTFS partition to the guest? Thanks so much! Commented Jan 16 at 10:57
  • Disk devices behave like 'raw' type images. You'll need to manually chmod the disk device so that your user account is allowed to access it, then attach it the same way you'd attach a disk image. (It would be easier to actually use an image though; create a large file to act as the 'raw' image, access it on the host using losetup or mount -o loop, later dismount from the host and attach to the VM like you normally would with a disk image... Also works with qcow2 formats, except with qemu-nbd instead of losetup.) Commented Jan 16 at 11:20
  • Hi again grawity, sorry about the slow reply. Two questions: what do you use to make a raw file image? Is dd just for the entire disc? Second and most important question- How do access the raw image from the GUEST? I can’t even see the SATA disk I created on virt manager. The source location has ”qcow2” in it. I’m not aware of that format. Thanks again! Commented Jan 17 at 12:37
  • I found an example of how to create an image on linux e.g. dd if=/dev/zero of=image.img iflag=fullblock bs=1M count=100 && sync But I still don't know how to mount this in the windows guest. Thanks Commented Jan 19 at 3:04
  • Okay, I also realised I needed to click the 'custom storage device' to point to the host image directory on creation in Virt manager. I also realised that I can see it in Windows VM under 'computer management' but it's not initialised. Now I need to figure out once I access it on the host, how to initalise it on Windows, because it's 'allocated'.... Commented Jan 19 at 3:28

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.