Jump to content
We're Hiring! Full Stack Developer ×

VirtioFS Support Page


Recommended Posts

Posted (edited)
On 6/2/2024 at 8:27 PM, wacko37 said:

@mackid1993 Firstly thankyou for all that you do, you have made the virtioFS setup a breeze! 

 

In your comment you mentioned Macrium reflect, I'm currently trying to backup my VM to a folder that is mounted via your  virtiofs script. The problem I'm having is the when Macrium attempts to write to the mapped drive it fails with "error - system cannot find the path specified" When I return to windows explorer the Mapped drive is no longer there. If a re-run the virtiofs script the drive reappears but fails again if trying to backup via Macrium.

 

I can create and open files within the mapped drive as per normal but it seems Macrium cannot use the virtiofs mapped method.

Can you share any knowledge on this, much apricated in advance?

I usually use SMB within Macrium for backups. 

 

I suggest creating a vlan on your server and setting a secondary virtual NIC to it. Then setting a manual IP address in Windows and creating a hosts file entry for Macrium that points to the server using that vlan. That way your SMB traffic doesn't leave the server. 

Edited by mackid1993
Link to comment
9 hours ago, mackid1993 said:

I usually use SMB within Macrium for backups. 

 

I suggest creating a vlan on your server and setting a secondary virtual NIC to it. Then setting a manual IP address in Windows and creating a hosts file entry for Macrium that points to the server using that vlan. That way your SMB traffic doesn't leave the server. 

Thankyou kindly for your reply and expertise, I've just completed a backup via SMB as I would do with my other PC's on the network, sadly don't have a spare NIC onhand to complete the vLan as you mentioned but that's a future upgrade I want to complete anyways down the track. So from my limited understanding data is now being sent out and received via the same ethernet port in my current setup, which is ok for me for now. 

 

Do you have any understanding why M-R was causing the virtioFS to disconnect?

Link to comment
1 hour ago, wacko37 said:

Thankyou kindly for your reply and expertise, I've just completed a backup via SMB as I would do with my other PC's on the network, sadly don't have a spare NIC onhand to complete the vLan as you mentioned but that's a future upgrade I want to complete anyways down the track. So from my limited understanding data is now being sent out and received via the same ethernet port in my current setup, which is ok for me for now. 

 

Do you have any understanding why M-R was causing the virtioFS to disconnect?

You don't need a second NIC. It's a virtual NIC that you need. I'm sorry I'm not sure why you are having issues. 

Link to comment
3 minutes ago, mackid1993 said:

You don't need a second NIC. It's a virtual NIC that you need. I'm sorry I'm not sure why you are having issues. 

Sorry for misinterpreting your reply, I will have to research further on this as I have no idea how to complete this successfully. Would it make much of a difference compared to what is working now? Im guessing speed and security?

Link to comment
Posted (edited)
10 hours ago, wacko37 said:

Sorry for misinterpreting your reply, I will have to research further on this as I have no idea how to complete this successfully. Would it make much of a difference compared to what is working now? Im guessing speed and security?

Probably not a major difference, it will work if your router doesn't. That's about it.

Edited by mackid1993
  • Thanks 1
Link to comment
Posted (edited)

@wacko37

1. Stop the VM and Docker service.

2. Go to Settings -> Network Settings

3. Click add VLAN

image.thumb.png.8569dc7fe2793945c2d75f5844b6f4e6.png

4. Fill it out and click apply. I already have mine set up so my VLAN number for this example is 3, yours will be 2.

image.png.d08b52fcf3066bfb10804e0765fb16eb.png

 

5. Change iP address assignment to static:

image.png.fa0b032c85453c7a5ff9684133037b2e.png

6. Enter 10.0.0.1 this will be the address of your Unraid server on the VLAN. Click apply

image.thumb.png.ccb0b8b91e2a691e3b538b7a905cf0f5.png

7. Scroll down and find your gateway, likely br0.2

image.thumb.png.92da250762e12565c2be563562de298c.png

8. Start VM and Docker back up.

9. Edit your VM template. Scroll to the bottom and add a second NIC. Set it to virtio and the second network source to your gateway likely br0.2.

image.thumb.png.1b8039bfc5f433decc9b8ab81eb69f1b.png

 

10. Start your VM, open a run dialog in Windows and type ncpa.cpl. Find your new NIC that doesn't have an IP address and give it one as follows. Just check IP addresses to make sure you don't set a static address on your main NIC.

 

image.png.f3b3637de4c6faabab7505107fe96996.png

 

Now your server can be accessed over the VLAN from \\10.0.0.1. However when a lot of activity is happening since SMB is single threaded other applications will slow down. To work around this, I create hosts file entries for each application I use and authenticate separately for each one.

 

Open an admin command prompt and type: notepad c:\windows\system32\drivers\etc\hosts

These are my entries but you can make as many as you like.

image.thumb.png.282dd3d8f95907668183ca6505348c23.png

 

Once this is done in Macrium you connect using \\macrium\share and then your Macrium traffic will stay completely within your server and you can avoid any compatibility issues related to Virtiofs and instead use Virtiofs in situations where it works best.

Edited by mackid1993
Link to comment
2 hours ago, mackid1993 said:

@wacko37

1. Stop the VM and Docker service.

2. Go to Settings -> Network Settings

3. Click add VLAN

image.thumb.png.8569dc7fe2793945c2d75f5844b6f4e6.png

4. Fill it out and click apply. I already have mine set up so my VLAN number for this example is 3, yours will be 2.

image.png.d08b52fcf3066bfb10804e0765fb16eb.png

 

5. Change iP address assignment to static:

image.png.fa0b032c85453c7a5ff9684133037b2e.png

6. Enter 10.0.0.1 this will be the address of your Unraid server on the VLAN. Click apply

image.thumb.png.ccb0b8b91e2a691e3b538b7a905cf0f5.png

7. Scroll down and find your gateway, likely br0.2

image.thumb.png.92da250762e12565c2be563562de298c.png

8. Start VM and Docker back up.

9. Edit your VM template. Scroll to the bottom and add a second NIC. Set it to virtio and the second network source to your gateway likely br0.2.

image.thumb.png.1b8039bfc5f433decc9b8ab81eb69f1b.png

 

10. Start your VM, open a run dialog in Windows and type ncpa.cpl. Find your new NIC that doesn't have an IP address and give it one as follows. Just check IP addresses to make sure you don't set a static address on your main NIC.

 

image.png.f3b3637de4c6faabab7505107fe96996.png

 

Now your server can be accessed over the VLAN from \\10.0.0.1. However when a lot of activity is happening since SMB is single threaded other applications will slow down. To work around this, I create hosts file entries for each application I use and authenticate separately for each one.

 

Open an admin command prompt and type: notepad c:\windows\system32\drivers\etc\hosts

These are my entries but you can make as many as your like.

image.thumb.png.282dd3d8f95907668183ca6505348c23.png

 

Once this is done in Macrium you connect using \\macrium\share and then your Macrium traffic will stay completely within your server and you can avoid any compatibility issues related to Virtiofs and instead use Virtiofs in situations where it works best.

WOW!!! thankyou so so much for this detailed step by step guide, I wish every question I had in life was answered by you.....lol

 

I will be implementing this today, even a noob like me can't mess this up.

Link to comment
4 hours ago, wacko37 said:

WOW!!! thankyou so so much for this detailed step by step guide, I wish every question I had in life was answered by you.....lol

 

I will be implementing this today, even a noob like me can't mess this up.

No problem. I had an extra few minutes today. 😊

Link to comment

I'm not sure if anyone else has encountered this, but I'm experiencing a peculiar issue.

 

I have a single share mounted as a drive on my Windows VM via VirtioFS. Generally, it functions well. However, I've recently encountered a problem where Sonarr can't locate certain media files. This issue resolves itself upon restarting, but then it reoccurs with different files.

 

When I access the mounted drive and attempt to play the files that Sonarr couldn't find, I encounter errors. VLC reports "can't play media file," even though I can clearly see the files on the mounted drive.

 

Interestingly, when I access the share through a network drive, or directly via Plex, everything operates smoothly; there are no issues. Additionally, restarting seems to temporarily resolve the problem, but then, another set of media files stop working. 

 

I'm unsure if this is a bug in the VirtioFS system. My drives are in good condition and have passed all SMART tests.

So far, it seems like newly added files seem to be most effected. 

Link to comment
12 hours ago, ajlk199 said:

I'm not sure if anyone else has encountered this, but I'm experiencing a peculiar issue.

 

I have a single share mounted as a drive on my Windows VM via VirtioFS. Generally, it functions well. However, I've recently encountered a problem where Sonarr can't locate certain media files. This issue resolves itself upon restarting, but then it reoccurs with different files.

 

When I access the mounted drive and attempt to play the files that Sonarr couldn't find, I encounter errors. VLC reports "can't play media file," even though I can clearly see the files on the mounted drive.

 

Interestingly, when I access the share through a network drive, or directly via Plex, everything operates smoothly; there are no issues. Additionally, restarting seems to temporarily resolve the problem, but then, another set of media files stop working. 

 

I'm unsure if this is a bug in the VirtioFS system. My drives are in good condition and have passed all SMART tests.

So far, it seems like newly added files seem to be most effected. 

It may be a cache issue. Look into this: 

 and @SimonF's php script and bash script that will be added in 6.13/Unraid 7. It works in 6.12 but configuration is a little advanced. You'll also need to download rust virtiofsd which will also be in 6.13/Unraid 7. If you look through past posts there's a lot of information to configure this in 6.12.

  • Thanks 1
Link to comment

I've read through this thread and got things setup to try to mitigate an issue when using my nvme over share to the VM that keeps happening here https://forums.unraid.net/topic/164041-does-your-device-have-a-faulty-power-saving-mode-enabled-nvme-issues/#comment-1422896

On AMD (5900x x570), the speeds are terrible. Around 55MB's, but I might stick with this for the stability for now. When the drive is in use it seems to hit a single thread.

EDIT: Didn't resolve the above issue (not related to this), but yeah the speeds wasn't worth it.

 

Edited by jlw_4049
Link to comment
On 6/12/2024 at 1:28 PM, jlw_4049 said:

I've read through this thread and got things setup to try to mitigate an issue when using my nvme over share to the VM that keeps happening here https://forums.unraid.net/topic/164041-does-your-device-have-a-faulty-power-saving-mode-enabled-nvme-issues/#comment-1422896

On AMD (5900x x570), the speeds are terrible. Around 55MB's, but I might stick with this for the stability for now. When the drive is in use it seems to hit a single thread.

EDIT: Didn't resolve the above issue (not related to this), but yeah the speeds wasn't worth it.

 

Another user @johnsanc was having major speed issues on AMD. I wonder if there is some sort of issue with the virtio-win driver and AMD platforms.

Link to comment

Yes that is exactly what happens on my machine. Slow transfers and a single CPU hits 100% during the process. I had a feeling it wasn’t something specific to my machine. Good to know another AMD user has the same issue.

Link to comment
19 hours ago, johnsanc said:

Yes that is exactly what happens on my machine. Slow transfers and a single CPU hits 100% during the process. I had a feeling it wasn’t something specific to my machine. Good to know another AMD user has the same issue.

I would open a report with the Virtio-Win team on Github. Clearly there is a bug with AMD hardware. I would help but i'm an Intel guy.

Link to comment
20 hours ago, johnsanc said:

According to YanVugenfirer, it looks like they know what the issue is but not a priority to fix. I guess maybe AMD users are out of luck until they get a chance to look at this. SMB it is for me for now.

GitHub Issue: https://github.com/virtio-win/kvm-guest-drivers-windows/issues/1039#issuecomment-2171441245

Just a shot in the dark, maybe try hugepages to see if it helps you.

Edited by mackid1993
Link to comment
  • 2 weeks later...
1 hour ago, sage2050 said:

Can any of these custom fixes be disabled in the 7.0 beta?

What are you looking to change?

 

This options are added.

 

 

 $file = "/etc/libvirt/virtiofsd.opt";

 # Check if options file exists. Each option should be on a new line.
 if (is_file($file)) $options = explode("\n",file_get_contents($file)) ; else $options =  ['--syslog','--inode-file-handles=mandatory','--announce-submounts'];

 

But yoou can create the file with the options you want. i.e. if you want to remove syslog

 

nano /etc/libvirt/virtiofsd.opt

 

--inode-file-handles=mandtory

--announce-submounts

 

save, note lines need to be terminated with newline.

 

 

These are the values passed from QEMU so do add to the file.

 $options[] = "--fd=".$argoptions['fd'];

         switch ($optsplit[0]) {
             case "source":
                 $options[] = "--shared-dir={$optsplit[1]}";
                 break;
             case "cache":
                 $options[] = "--cache=never";
                 break;
             case "xattr":
                 $options[] = "--xattr";
                 break;
             case "sandbox":
                 $options[] = "--sandbox={$optsplit[1]}";
                 break;

Link to comment
3 minutes ago, sage2050 said:

- replacement of included virtiofsd w/ rust version

- script to export shares to different drive letters

- hugepages memory reservation to stop high cpu usage

beta is rust vers.

Drive letters need to be action on guest. Unless you have a link to info for host side.

 

Hughpages may affect other area So not planned for 7 maybe 7.1 as an option.

  • Like 1
Link to comment
20 hours ago, SimonF said:

beta is rust vers.

Drive letters need to be action on guest. Unless you have a link to info for host side.

 

Hughpages may affect other area So not planned for 7 maybe 7.1 as an option.

Hugepages also fixes memory fragmentation that causes other VMs not in the shared memory pool to get sluggish.

Link to comment
2 hours ago, mackid1993 said:

Hugepages also fixes memory fragmentation that causes other VMs not in the shared memory pool to get sluggish.

But may cause other challenges in other subsystems, would we need to be introduce as part of the next developement cycle. There is your work around users can use as required.

Link to comment
4 hours ago, thunderclap said:

Okay., maybe I'm missing it, but is there a way to mount a virtiofs share through fstab in an Ubuntu VM? I also want the directory only accessed with a specific user and password. Thanks.

Yes you can add to fstab but that would mount and all users on systems would see. Example fstab

 

vm1 /mnt virtiofs rw,_netdev 0 0

 

If you only want specific linux user can you not add mount to a login script for that user.

Link to comment
7 hours ago, SimonF said:

 

If you only want specific linux user can you not add mount to a login script for that user.

I'm trying to keep the directory inaccessible from random people thus the need for a user and password similar to smb. Is there a way to do this with virtiofs but as an executable script instead of a line in fstab? I could then have the script execute on boot. 

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.

×
×
  • Create New...