9P Sharing files between host and guest


Recommended Posts

Had a little tinker about with this as it seemed intriguing.

 

made a debian wheezy vm (have to select basic server utilities in tasksel)

 

 

modded user nobody to uid 99 in the vm and ran what apps i had as user nobody and group users, chown'ed the apps install folder and config output folders to nobody:users, and chmod 775

 

added dfltuid=99 and dfltgid =100 to the mount option in /etc/fstab and it worked like a charm with all my files written with the right ownership to suit unraid.

 

 

this was really helpful...

 

https://www.kernel.org/doc/Documentation/filesystems/9p.txt

Link to comment
  • 1 year later...

I just created a Ubunut VM and I'm trying to share files between the VM and unRAID

 

    <filesystem type='mount' accessmode='passthrough'>
      <source dir='/mnt/user/apps/'/>
      <target dir='apps'/>
      <alias name='fs0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
    </filesystem>

 

From the command line after reading this thread, I'm using 9p, and I'm mounting from the command line as such...

sudo mount -t 9p -o trans=virtio,version=9p2000.L,rw,dfltuid=99,dfltgid=100 apps /mnt

 

The command completes sucessfully, but, the directory is empty.  I have to be doing something wrong, but I can't see what.

 

Link to comment
  • 2 years later...
On 4/27/2016 at 1:15 AM, jonathanm said:

9p is not recommended, I'd use cifs. I think the speed is better with cifs.

Is there a short howto somewhere that shows how to best mount host (unraid) folders in an ubuntu VM. You all show .xml, but where is that xml and what is considered source or target in host (unraid/slackware) guest (vm/ubuntu) setup?

Link to comment
1 minute ago, fluisterben said:

Is there a short howto somewhere that shows how to best mount host (unraid) folders in an ubuntu VM. You all show .xml, but where is that xml and what is considered source or target in host (unraid/slackware) guest (vm/ubuntu) setup?

Since you quoted me from 3 years ago, but your quote doesn't relate to your question, I'm not sure exactly what you are asking.

 

You can connect to unraid exactly the same way whether it's a VM or a bare metal PC. Nothing to do with xml. I haven't recently tried 9p (which does use xml) but my thoughts on the subject still stand. Easier and faster to just use samba (cifs).

Link to comment
3 hours ago, jonathanm said:

Since you quoted me from 3 years ago, but your quote doesn't relate to your question, I'm not sure exactly what you are asking.

 

You can connect to unraid exactly the same way whether it's a VM or a bare metal PC. Nothing to do with xml. I haven't recently tried 9p (which does use xml) but my thoughts on the subject still stand. Easier and faster to just use samba (cifs).

Why CIFS ? NFS is way more efficient within a trusted system like this, is it not? Or is a file locking feature still missing for NFS ?

Link to comment
1 hour ago, fluisterben said:

Why CIFS ? NFS is way more efficient within a trusted system like this, is it not? Or is a file locking feature still missing for NFS ?

Samba is easier for me to manage across multiple platforms. NFS is probably better for a pure linux environment, but I have to support SMB for some windows clients, so it's more convenient to only keep up with one scheme.

Link to comment
  • 10 months later...

OK, pulling this thread back up, because I have issues again;

 

I run a debian VM with (among others) nextcloud and nginx on it.

It has this part in its xml;

 <filesystem type='mount' accessmode='passthrough'>
      <source dir='/mnt/user/nxt'/>
      <target dir='nxt'/>
      <alias name='fs0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </filesystem>

Now, the /nxt is working, from within the VM, but the permissions under it seem to be problematic. Even though I can set them just fine from within the VM, under /nxt, nextcloud still complains about "Home storage for user x not being writable" and it has issues within nextcloud sharing stuff. I've tried to find out why, but logs seem to be unclear as to why. Any ideas?

Link to comment
10 minutes ago, fluisterben said:

OK, pulling this thread back up, because I have issues again;

 

I run a debian VM with (among others) nextcloud and nginx on it.

It has this part in its xml;


 <filesystem type='mount' accessmode='passthrough'>
      <source dir='/mnt/user/nxt'/>
      <target dir='nxt'/>
      <alias name='fs0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </filesystem>

Now, the /nxt is working, from within the VM, but the permissions under it seem to be problematic. Even though I can set them just fine from within the VM, under /nxt, nextcloud still complains about "Home storage for user x not being writable" and it has issues within nextcloud sharing stuff. I've tried to find out why, but logs seem to be unclear as to why. Any ideas?

Probably the permissions on the host side then.

Link to comment
21 minutes ago, saarg said:

Probably the permissions on the host side then.

They are just a 'Share', so, in my case /mnt/user/nxt, which does not show any settings for permissions relating to access from a VM. It shows the Export to Yes, 'Secure' for SMB, which this isn't, so: Should I change permissions from shell then? I have really no idea about the inner workings of that passthrough share by unraid, it's not documented anywhere.

Link to comment
9 hours ago, fluisterben said:

They are just a 'Share', so, in my case /mnt/user/nxt, which does not show any settings for permissions relating to access from a VM. It shows the Export to Yes, 'Secure' for SMB, which this isn't, so: Should I change permissions from shell then? I have really no idea about the inner workings of that passthrough share by unraid, it's not documented anywhere.

If the share setting is secure, that might be the issue.

You have different layers of permissions, from the host to the VM, then the user running nextcloud. You have to make sure both the VM and the user running Nextcloud have write permissions.

 

Can you write being root in the VM?

Can you write being the user running nextcloud in the VM?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.