Virtualization: How do I share a cloud drive mounted inside the guest with the host? (x-post from Linux@lemmy.ml)
from GathererStuff@lemmy.ml to selfhosted@lemmy.world on 03 Nov 17:21
https://lemmy.ml/post/22102698

Hi everyone! I want to be able to access a folder inside the guest that corresponds to a cloud drive that is mounted inside the guest for security purposes. I have tried setting up a shared filesystem inside Virt-Manager (KVM) with virtiofs (following this tutorial: absprog.com/post/qemu-kvm-shared-folder) but as soon as I mount the folder in order for it to be accessible on the guest host the cloud drive gets unmounted. I guess a folder cannot have two mounts at the same time. Aliasing the folder using bind and then sharing the aliased folder with the host doesn’t work either. The aliased folder is simply empty on the host.

Does anyone have an idea regarding how I might accomplish this? Is KVM the right choice or would something like docker or podman better suited for this job? Thank you.

#selfhosted

threaded - newest

Appoxo@lemmy.dbzer0.com on 03 Nov 17:56 next collapse

Maybe NFS share the drive from guest to host?

GathererStuff@lemmy.ml on 03 Nov 19:46 next collapse

I can try but I might end up in the same situation as with virtiofs. The cloud drive will get unmounted and I will end up with an empty folder when I try to access it from the host.

wildbus8979@sh.itjust.works on 03 Nov 19:56 collapse

Absolutely not, NFS is a shared mount. Virtiofs is more complicated because it is emulating a block device.

GathererStuff@lemmy.ml on 03 Nov 20:06 collapse

Then I will try NFS and get back to you. Thanks :)

Atherel@lemmy.dbzer0.com on 04 Nov 07:19 next collapse

This, had the same idea for other purposes, sharing a folder from vm to host through network share is the easiest way. Every other solution looks more elegant on paper but has lots of pitfalls.

GathererStuff@lemmy.ml on 05 Nov 07:14 collapse

Every other solution looks more elegant on paper but has lots of pitfalls

A very sane and fair comment.

GathererStuff@lemmy.ml on 05 Nov 07:18 collapse

What would be the performance implications? Isn’t virtiofs theoretically faster?

Appoxo@lemmy.dbzer0.com on 05 Nov 11:12 collapse

Not an expert.
Assuming it’s internal I’d assume it’s probably as fast as the guest nic allows?

GathererStuff@lemmy.ml on 06 Nov 21:12 collapse

Fair. I will try NFS if anything else fails. Thanks :)

NeoNachtwaechter@lemmy.world on 03 Nov 18:00 next collapse

You say it is mounted. Then you can share it in all the same ways as you would share any other of the VM’s folders.

I am using SMB shares for that (but that is not always the best way ofc).

GathererStuff@lemmy.ml on 03 Nov 19:44 collapse

The cloud drive is mounted on the guest, yes, but once I mount it with virtiofs in order to share it with the host it gets unmounted and I end up with an empty folder. bind doesn’t work either.

DetachablePianist@lemmy.ml on 03 Nov 18:56 next collapse

Maybe see if ‘rclone mount’ solves the problem for ya. Rclone can often be a super handy swiss army knife for stuff like this.

GathererStuff@lemmy.ml on 03 Nov 19:49 collapse

The cloud binary is proprietary and it’s not supported by rclone unless I find out how the binary works but I doubt it uses something standardized like WebDAV underneath.

possiblylinux127@lemmy.zip on 06 Nov 05:03 collapse

You don’t

That is going to be painful and not beneficial

GathererStuff@lemmy.ml on 06 Nov 21:10 collapse

I strongly disagree why this would not be beneficial. Could you expand?

possiblylinux127@lemmy.zip on 06 Nov 23:10 collapse

You will need to mange the VM separately and the added hop (into the VM and then out again) will slow down performance and create another point of failure.

Why would running it in a VM benefit security? Couldn’t you just mount it with fuse?

GathererStuff@lemmy.ml on 08 Nov 15:20 collapse

Because the executable is proprietary (and a bit legacy I would say) and full of telemetry, undocumented and the cloud service has no CLI, WebDAV or rclone support. I do not want to run something like that on my personal computer and I do not know how to use bwrap properly and don’t want to risk it. I have since switched over to a podman container but I encounter the same problem, the folder is empty on the host (See my post here: lemmy.ml/post/22215540).