Page 1 of 1

[SOLVED] zfs send fails from host with virtualbox running

Posted: 14 Mar 2016 12:39
by erik
I'd like to share a solution I found for a strange problem.

One of my systems is running a small vm under virtualbox.
From that system doing zfs send was very unreliable.

Luckily I found that when you run virtualbox you have to increase the value of net.graph.maxdata to at least 4096
Use system/advanced/loader.conf to add this setting and then reboot.

Since the change sending very large snapshots is rock solid.

Re: [SOLVED] zfs send fails from host with virtualbox running

Posted: 24 Mar 2016 00:39
by tonyd
Hey, I missed this post but found the same solution online yesterday. This problem exhibits itself in many ways, not just zfs send.

In hopes of helping others that search the forum, here are the two ways I hit this problem:

Samba - Trying to transfer multi-gigabyte files from the NAS to a Windows machine. The file transfer would just hang right away or part-way through, with no error messages in the logs (even at high log levels).

SFTP file transfers - This one led me to the solution as it gave me an error in the NAS log. Using FileZilla for instance, try transferring a multi-gigabyte file from ZFS on your NAS to your computer via SFTP. Intermittently, it will disconnect and reconnect again. The logs will say something like "fatal: packet_write_poll: Cannot allocate memory". This is your big clue you are suffering from the same problem.

After pulling my hair out for a couple days, I found articles from 2011 such as https://lists.freebsd.org/pipermail/fre ... 63322.html that talk about this phenomenon. After knowing what to look for, I found freebsd also has it on their virtualbox to-do list: https://wiki.freebsd.org/VirtualBox/ToDo

In my case, I put what the article suggested in the loader.conf: net.graph.maxdata=65536

I have no idea what the value actually does, and I will try reducing it as erik suggests in case I'm wasting memory. But this solved all of my issues with transfering large data with VirtualBox VMs running.

If you use VirtualBox and ZFS, test for this, and add the variable to the loader.conf to solve the problem. Maybe it should be added by default, but just disabled in newer NAS4Free builds?

UPDATE: I've reduced the value to 4096 as mentioned by erik, and everything is still rock solid testing Samba and SFTP. Thanks erik.