Unraid VM shares?


Recommended Posts

So I created a new Ubuntu Server 18.04 VM and noticed I had the option to set up an unRAID share and mount tag in the settings.

 

image.png.2657f346fac3cc1e95be76b2ca2ced4e.png

 

So I put in the following values. Booted into my VM, obviously the mounts weren't visible. So I did some googling and edited my fstab to what I could find:

UbuntuServer /home/daylend/UbuntuServer 9p trans=virtio,version=9p2000.L,_netdev,noauto,nobootwait,rw 0 0

 

Rebooted the server. Nothing appeared. Read that you had to edit some xml files but I also read that's inside the .img file now so it's not changeable? I assume that's what the unRAID share and unRAID mount tag values are for in the web UI now. I also looked through the wiki for more information on unRAID share and unRAID mount tag settings but couldn't find much.

 

How do I get this working?

 

Thanks!

  • Like 1
Link to comment

Did you make a directory inside your VM called /home/daylend/UbuntuServer and then reboot or mount -a to reload fstab?

 

I did the following:

512466644_9PSettings.png.72faeb08b80078882d237a8f711f7114.png

 

Then I created the Directory "/unraid" not that the exact path matters could have used "/mnt/unraid" for instance and used that below instead of /unraid.

 

Then I added the following to fstab and rebooted:

unraid        /unraid            9p         trans=virtio,version=9p2000.L,_netdev,rw 0 0

 

And I got my user shares from my unRAID server listed when I "ls /unraid"

 

Hope this helps.

 

Edited by BobPhoenix
  • Like 3
  • Thanks 8
  • Upvote 4
Link to comment

So I went through everything you said, making sure it was all set up correctly... Everything looked good. But it still wasn't working.

 

I noticed your fstab didn't have the lines "noauto,nobootwait", so I removed those, and rebooted.

Now it works like a charm!

 

Thanks for the help! ?

Link to comment
  • 5 months later...
  • 2 weeks later...
  • 2 months later...
On 10/24/2018 at 5:18 PM, TristBella said:

Every time I use this feature, the network no longer works. I am using Unraid 6.4.1 with an Ubuntu 18 VM.

It just changes your NIC to a new name. Mine changed from enp1s0 to enp3s0.

Just run "ifconfig -a" to see the new name and then modify /etc/netplan/01-netcfg.yaml accordingly.

Link to comment
  • 2 months later...
On 10/24/2018 at 5:18 PM, TristBella said:

Every time I use this feature, the network no longer works. I am using Unraid 6.4.1 with an Ubuntu 18 VM.

This is slightly offtopic, but I had the problem related to the steps advocated here, and couldn't easily undo everything since you cant undefine mounted tags and /etc/netplan/01-netcfg.yaml did not exists, plus I can't copy/paste via VNC.

If you don't want to reinstall everything, and don't want the useless tag dangling in there/potentially blocking your network, do the following:

  1. Shutdown and rename your original machine
  2. Create a new machine with the name of the original machine (This will use the right Primary vDisk if you set it to auto)
  3. Check if your new Primary vDisk-Location is equal to the original one.
  4. Copy the Network MAC from the original machine to the new machine (I'm not sure if this is strictly required, but this way I didn't need to reconfigure DHCP)
  5. Run the new machine, delete the original machine (DO NOT DELETE THE DISK)

 

Link to comment
On 11/7/2018 at 1:20 AM, FoxxMD said:

Having the same problem

Actually, what happens is that setting that mount changes the bus number in the XML of the VM, making your network fail.

Change it back to what it was initially and your network will be back again. So, if you go to your VMs, click on the icon to Stop it, Edit it and upper right corner shows the XML view button. See here for an example:

 

Link to comment
  • 6 months later...
  • 1 month later...

sorry to drag this topic up again. I succesfully followed the steps outlined in this post for my ubuntu 16.04 VM and it works like a charm. Well when i say works, i can successfully mount the unraid shares and read them. However i cant seem to get any of my scripts to write to shares ? Any ideas ?

 

Link to comment
  • 1 month later...
  • 4 weeks later...
On 5/14/2018 at 8:09 PM, BobPhoenix said:

Did you make a directory inside your VM called /home/daylend/UbuntuServer and then reboot or mount -a to reload fstab?

 

I did the following:

512466644_9PSettings.png.72faeb08b80078882d237a8f711f7114.png

 

Then I created the Directory "/unraid" not that the exact path matters could have used "/mnt/unraid" for instance and used that below instead of /unraid.

 

Then I added the following to fstab and rebooted:

unraid        /unraid            9p         trans=virtio,version=9p2000.L,_netdev,rw 0 0

 

And I got my user shares from my unRAID server listed when I "ls /unraid"

 

Hope this helps.

 

Hey man, thanks for this; it worked for a new Arch VM I'm setting up right now, worked perfectly for RW

 

To clarify, what's posted by BobPhoenix is to add the following in your fstab:

 

`tag    /mountpoint    9p  trans=virtio,version=9p2000.L,_netdev,rw 0 0`

 

you may also make sure that you have the following:

/etc/mkinitcpio.conf

MODULES=(virtio virtio_blk virtio_pci virtio_net)

Edited by AboveUnrefined
Link to comment
  • 4 weeks later...
16 hours ago, TristanP said:

Has anyone else noticed that if you create a second VM share the "Updating" button stays grayed out and never updates the VM config? The first share works fine but the second one just sits and hangs...

That bug is academic because you should not be using 9p (which is required to mount the "share" inside the VM template) due to the terrible performance.

Link to comment
  • 3 weeks later...

I signed up for a forum account solely to comment and add that following BobPhoenix comment for the fstab worked fantastically!  Was trying to figure out for days how to get it done on Windows, gave up cause the tag wasn't an option and moving on to Debian/Ubuntu.  

 

Thanks!

Link to comment
  • 3 months later...
1 hour ago, twiikker said:

Tried this today and finally got it working but was so disapointed with performance. I can get 3x faster speeds over SMB share than 9p.

You were warned.

On 2/10/2020 at 6:20 AM, testdasi said:

That bug is academic because you should not be using 9p (which is required to mount the "share" inside the VM template) due to the terrible performance.

 

Link to comment
  • 1 month later...

Thanks for the help in this post, works fantastically. TL;DR of original, here's a step by step guide for creating a mount on VM creation (as of unraid 6.8.3).

  1. In the "Unraid Share" section, select the unraid folder that you want to make mountable. This can be an individual share or a parent directory of the share for multiple. e.g `/mnt/user`
  2. In the "Unraid Mount tag" section, enter a tag name, this can be anything and will be passed to the VM. e.g `myMountTag`
  3. Complete VM setup, power on and install your VM OS or normal. The following steps require root/sudo user.
  4. Make a backup copy of fstab in case you mess up your configuration `sudo cp /etc/fstab /etc/fstab.orig` 
  5. Create a target mount directory where you want to mount your share e.g. `sudo mkdir /path/to/myMountedDir`
  6. Edit `/etc/fstab` config by adding the following line to the end of the file, (change tag & path to your needs)
  7. `myMountTag    /path/to/myMountedDir    9p    trans=virtio,version=9p2000.L,_netdev,rw    0    0`
  8. Save fstab file and run `sudo mount -a` to check your mount works (there should be no output for on success)
  9. You should now have a mounted share in your VM

Futher detail

For anyone new to unraid, looking for an explanation as to what the fstab values are, here is an explanation

<device>: myMountTag
<mount point>: /path/to/myMountedDir  
<file system type>: 9P (The protocol that QEMU uses for a VirtFS)
<options>: 
    trans=virtio,version=9p2000.L (our transport for this share will be over virtio, and we specify the 9P version (2000.L) because the default for QEMU is 2000.U. "L" has better support for ACLs, file locking and more efficient directory listing, deletion edge cases etc)
    _netdev (tells the system that this mount relies on the network, and to delay the mount until a network is enabled)
    rw (mount as read/write)
<dump>: 0 (disables backup via the dump command)
<pass num>: 0 (disable any error checking)

 

Cheers!

  • Like 2
  • Thanks 10
Link to comment
  • 2 weeks later...
On 6/10/2020 at 8:40 AM, jonathanm said:

You were warned.

 

Since using 9p sounds like a bad idea, I'm playing around with mounting unraid shares as SMB shares or NFS shares in an Ubuntu VM. Having permissions issues but I'll keep trying.

 

What is likely to be the method that gives the best performance - SMB or NFS?

 

Since all the drives are physically connected to the same server I assume all the traffic will be over a virtual NIC and no physical network interface will be involved?

 

Thanks for all the help you all give - it's been a pleasure getting my server setup so far with minimal Linux knowledge thanks to the community.

Edited by moohaha
clarified my questions
  • Thanks 1
Link to comment
  • 2 months later...

so what is the best alternative to mount a (share-)folder from the host into the VM if you want to avoid 9p? I tried to mount the share over SMB and over NFS and set an apache web root to the mounted folder and I got very weird problems like the files disappearing and re-appearing randomly, apache offering the files for download instead of serving them, apache didn't see the latest version of a file until I opened the file on the VM-console etc.

  • Like 1
Link to comment
  • 3 months later...

Hi to all,

 

i ran into the  same this issue. I did the entry  like "cleggypcd" mentioned. I updated the /etc/fstab an did try to manual "mount -a" . The  result is 

"mount: unknown filsystem type 9p"

 

Update:

The VM is a RHEL 7.3 and Cent OS 7.9 and Unraid  Version is 6.8.3

Ubuntu 20.10 is working fine with the above procedure

 

Thanks for any comments

 

Edited by Zappmax
Link to comment
  • 2 months later...

SMB (via cifs) is one way, NFS is another. "correct" is not a term I would use, it's all about what works best in your specific application.

 

Treat a VM the same way as you would any other network client that you would connect to your Unraid shares. The VM just has a more direct network connection, the packets don't necessarily need to leave the machine.

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.