9P Sharing files between host and guest


Recommended Posts

With both. With cifs sometimes shares wouldn't mount.  They always did by doing this. But with cifs it was more to wait for the network. I think with passthrough it times out if there's a delay waiting for a share to mount. For me this seems to work best by letting the vm boot then mounting shares and starting apps last.

Link to comment

Hi archedraft,

Any  reason to use the  /etc/rc.local ?

 

If you skip that, and  do

mount -a

after you have edit the fstab and created the mount directories in your VM, what do you see? are the share mounted ? thats the way I used it. no extra mount command in other files.

 

//Peter

 

With auto mount it will error during vm boot sometimes.  Sometimes it would get stuck during boot saying press m or s or something like that. But when you manually mount with rc.local it always works.

 

I used it as a precaution because of what dmacias had indicated in his original post. I figured I would start on the side of caution and see how the P9 passthrough works and if I have no issues I may try it without using rc.local and noauto. Although "if it ain't broke don't fix it" comes to mind.

 

So far it is working great without any issues.

Link to comment

Speed and I think it's more benefit than SMB

 

With editing fstab (like I did above) a few of my apps (sickbeard) loaded before the shares were mounted. To fix this I created a crontab task that delayed the startup of sickbeard for 10 seconds after boot. Does the 9P sharing mount the shares before the apps are loaded in rc.local?

The advantage is not using your virtual network especially for intensive operations like, par, rar, usnet and torrents.

 

I had a problem with sickrage and nzbget.  I renamed the init symlinks in /etc/rc2.d of my apps from 20 to 99 so they start last.  Then changed rc.local from 99 to 98. Check this page it explains the different rc.x runlevels. You'll have to check which level your vm runs or just change them all, rc0.d, rc1.d...rc6.d

http://www.linux.com/news/enterprise/systems-management/8116-an-introduction-to-services-runlevels-and-rcd-scripts

 

By doing this you could also make it so one app starts before the other.

 

dmacis, did you go through each rc0-6.d and find all your applications and set them to 99? or when you installed them did you set them up to 99? Currently I am still using a crontab and delaying my applications at boot by 10 seconds but from what I read online this is a dirty way of doing that.

Link to comment

I don't remember where I look or what command I ran to find my runlevel but it was 2. So I only changed rc2.d. There probably is a command switch to change that when you install the init defaults but I just manually did it. I just sftp to my vm and renamed the symlinks in rc2.d

Link to comment
  • 2 months later...

I noauto because sometimes it errors out at vm startup.  So I just put "mount /mnt" in /etc/rc.local  I run this in an apps vm and I had to modify rc.local to start before the apps so unraid user shares are mounted before any apps. Been working well for a couple weeks with everything located in /mnt on unraid available in my apps vm under the same /mnt. No network problems, rocket rides or cifs mounting needed like in xen.

 

Thought I'd chime in with a better way to work around this issue.  In your fstab, add _netdev to your options.  This will force the VirtFS mounting (even with auto) to wait until the network resources are available, which just so happens to solve the issue where sometimes the automounting would fail.  We do this with our OpenELEC unVM and it works perfect.

Link to comment

I noauto because sometimes it errors out at vm startup.  So I just put "mount /mnt" in /etc/rc.local  I run this in an apps vm and I had to modify rc.local to start before the apps so unraid user shares are mounted before any apps. Been working well for a couple weeks with everything located in /mnt on unraid available in my apps vm under the same /mnt. No network problems, rocket rides or cifs mounting needed like in xen.

 

Thought I'd chime in with a better way to work around this issue.  In your fstab, add _netdev to your options.  This will force the VirtFS mounting (even with auto) to wait until the network resources are available, which just so happens to solve the issue where sometimes the automounting would fail.  We do this with our OpenELEC unVM and it works perfect.

 

Would you mind posting the contents of your fstab?

Link to comment

I noauto because sometimes it errors out at vm startup.  So I just put "mount /mnt" in /etc/rc.local  I run this in an apps vm and I had to modify rc.local to start before the apps so unraid user shares are mounted before any apps. Been working well for a couple weeks with everything located in /mnt on unraid available in my apps vm under the same /mnt. No network problems, rocket rides or cifs mounting needed like in xen.

 

Thought I'd chime in with a better way to work around this issue.  In your fstab, add _netdev to your options.  This will force the VirtFS mounting (even with auto) to wait until the network resources are available, which just so happens to solve the issue where sometimes the automounting would fail.  We do this with our OpenELEC unVM and it works perfect.

Where was this info 3 months ago :)  When would that share be mounted in the boot process? Another problem I would see is that apps like sickbeard would be loaded before the drive mounted.  It was another reason for rc.local mount with S98 and apps with S99.  I've started and stopped the vm dozens of times and never had a failure this way. I'm willing to try out the auto mount again but before with default S20 for apps things wouldn't always work.

 

Link to comment

I noauto because sometimes it errors out at vm startup.  So I just put "mount /mnt" in /etc/rc.local  I run this in an apps vm and I had to modify rc.local to start before the apps so unraid user shares are mounted before any apps. Been working well for a couple weeks with everything located in /mnt on unraid available in my apps vm under the same /mnt. No network problems, rocket rides or cifs mounting needed like in xen.

 

Thought I'd chime in with a better way to work around this issue.  In your fstab, add _netdev to your options.  This will force the VirtFS mounting (even with auto) to wait until the network resources are available, which just so happens to solve the issue where sometimes the automounting would fail.  We do this with our OpenELEC unVM and it works perfect.

 

Would you mind posting the contents of your fstab?

 

This is actually in /etc/mtab because we don't need fstab for our OpenELEC VM:

 

storage /storage 9p rw,dirsync,relatime,trans=virtio,version=9p2000.L,posixacl,cache=loose 0 0

Link to comment

I noauto because sometimes it errors out at vm startup.  So I just put "mount /mnt" in /etc/rc.local  I run this in an apps vm and I had to modify rc.local to start before the apps so unraid user shares are mounted before any apps. Been working well for a couple weeks with everything located in /mnt on unraid available in my apps vm under the same /mnt. No network problems, rocket rides or cifs mounting needed like in xen.

 

Thought I'd chime in with a better way to work around this issue.  In your fstab, add _netdev to your options.  This will force the VirtFS mounting (even with auto) to wait until the network resources are available, which just so happens to solve the issue where sometimes the automounting would fail.  We do this with our OpenELEC unVM and it works perfect.

Where was this info 3 months ago :)  When would that share be mounted in the boot process? Another problem I would see is that apps like sickbeard would be loaded before the drive mounted.  It was another reason for rc.local mount with S98 and apps with S99.  I've started and stopped the vm dozens of times and never had a failure this way. I'm willing to try out the auto mount again but before with default S20 for apps things wouldn't always work.

 

Been hard at work on core NAS features and had to put the virtualization stuff on hold for a bit.  About to kick that up into high gear again.

Link to comment

I noauto because sometimes it errors out at vm startup.  So I just put "mount /mnt" in /etc/rc.local  I run this in an apps vm and I had to modify rc.local to start before the apps so unraid user shares are mounted before any apps. Been working well for a couple weeks with everything located in /mnt on unraid available in my apps vm under the same /mnt. No network problems, rocket rides or cifs mounting needed like in xen.

 

Thought I'd chime in with a better way to work around this issue.  In your fstab, add _netdev to your options.  This will force the VirtFS mounting (even with auto) to wait until the network resources are available, which just so happens to solve the issue where sometimes the automounting would fail.  We do this with our OpenELEC unVM and it works perfect.

 

Would you mind posting the contents of your fstab?

 

This is actually in /etc/mtab because we don't need fstab for our OpenELEC VM:

 

storage /storage 9p rw,dirsync,relatime,trans=virtio,version=9p2000.L,posixacl,cache=loose 0 0

 

Thanks! do you have anything in the "/etc/rc.local" file to mount this share or does it just automount?

Link to comment

I noauto because sometimes it errors out at vm startup.  So I just put "mount /mnt" in /etc/rc.local  I run this in an apps vm and I had to modify rc.local to start before the apps so unraid user shares are mounted before any apps. Been working well for a couple weeks with everything located in /mnt on unraid available in my apps vm under the same /mnt. No network problems, rocket rides or cifs mounting needed like in xen.

 

Thought I'd chime in with a better way to work around this issue.  In your fstab, add _netdev to your options.  This will force the VirtFS mounting (even with auto) to wait until the network resources are available, which just so happens to solve the issue where sometimes the automounting would fail.  We do this with our OpenELEC unVM and it works perfect.

 

Would you mind posting the contents of your fstab?

 

This is actually in /etc/mtab because we don't need fstab for our OpenELEC VM:

 

storage /storage 9p rw,dirsync,relatime,trans=virtio,version=9p2000.L,posixacl,cache=loose 0 0

 

Thanks! do you have anything in the "/etc/rc.local" file to mount this share or does it just automount?

Well OpenELEC is a little unique in how we do that as we have actually even further refined its design to eliminate using an image file and improved boot time by orders of magnitude. More on this soon...

Link to comment

For those of you who are using 9p can you guys take a look here:  http://lime-technology.com/forum/index.php?topic=36345.0

 

Something isn't jiving.  I have 9p working (at least as far as accessing local shares) but the speed sucks!

 

John

Try adding msize=262144 to your fstab line.  It doubled it for me to 30 MB/s.  I was copying a large file from downloads (my cache drive) in my vm to /tmp.

Link to comment

I'll do that but I thought the attraction of 9p was to get native speeds.  Not true?

 

EDIT:  I added msize=262144 but it made no difference.

I assume you rebooted your vm or umounted and mounted. Maybe those 9p errors mean something. I read something about 9p net and initrmfs and adding virtio modules.

 

For me I never even tested speed. 9p was about reliability.  Coming from xen and rocket rides and cifs mounting.

Link to comment

Yep...rebooted.  But quite honestly I get faster speeds for NFS and CIFS.  I know reliability is a major point but I want the speed!  :)

 

I posted in your other thread about this too.  You have something funky going on that's affected your performance.  As a short-term workaround, you could use NFS or SMB from your VM if you get better performance that way.  Longer-term, VirtFS will be better for you, but investigating the proper config and diagnosing a root cause is a little ways out for us right now.  There's lots of reading out there on how you can tweak VirtFS, but there's also a lot of outdated stuff you have to sift through first.

Link to comment
  • 2 weeks later...

I just had another thought (imagine that).  :)

 

I currently use 9p on each of my xbmc/openelec clients to access media on my server directly.  Can the same be done with a shared xbmc library (mysql/mariadb)?  Could I passthrough /mnt/cache/docker/mariadb to /storage/db on each of my clients and then change the advancedsettings.xml accordingly?  Would you tell it to connect to localhost:3306?  I can't imagine that this would work but what do I know.

 

EDIT:  Saw this on the xbmc wiki but would still like to hear opinions...

 

Even if the media is on the same computer as one of the XBMC instances, you MUST use a network share path. You cannot use a local file path with MySQL.

 

John

Link to comment

 

 

I just had another thought (imagine that).  :)

 

I currently use 9p on each of my xbmc/openelec clients to access media on my server directly.  Can the same be done with a shared xbmc library (mysql/mariadb)?  Could I passthrough /mnt/cache/docker/mariadb to /storage/db on each of my clients and then change the advancedsettings.xml accordingly?  Would you tell it to connect to localhost:3306?  I can't imagine that this would work but what do I know.

 

EDIT:  Saw this on the xbmc wiki but would still like to hear opinions...

 

Even if the media is on the same computer as one of the XBMC instances, you MUST use a network share path. You cannot use a local file path with MySQL.

 

John

 

It won't work .  Just a plain xbmc install uses a  sql lite database not mysql database.  So you'd have to run a mysql server on each client also.

Link to comment
  • 1 month later...

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.

 

 

  • Like 1
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.