How to share drives to VM on FreeNAS 11?

rakesh

Dabbler
Joined
Jan 26, 2014
Messages
16
I just upgraded to FN11 and got a Ubuntu VM setup by using the web GUI and remoting into it via VNC. I got pretty much everything setup, but I can't figure out how to mount my data to the VM. I have a volume called NAS (/mnt/NAS), which is the parent volume of the entire server and under that, I have a data directory (/mnt/NAS/data) that is shared to the network and is where everything is stored. I made a zvol for the VM and that is stored under (/mnt/NAS/vm/ubuntuvm). I made the VM under a zvol(/mnt/NAS/vm) because I plan to spin up one more VM. But because of this, I can't access and/attach the data (/mnt/NAS/data) volume and I am guessing the reason is because it's under a different zvol (/mnt/NAS/vm) vs (/mnt/NAS/data). Due to this, I can't add a another disk device (for access to the data [/mnt/NAS/data] directory) to my Ubuntu VM because the only zvols that show up there are the ones in the VM zvol (/mnt/NAS/vm).

So, is there anyway to mount the data directory (/mnt/NAS/data) onto the Ubuntu VM that is stored in (/mnt/NAS/vm/ubuntuvm
 

alieNus

Dabbler
Joined
Mar 23, 2018
Messages
30
I just upgraded to FN11 and got a Ubuntu VM setup by using the web GUI and remoting into it via VNC. I got pretty much everything setup, but I can't figure out how to mount my data to the VM. I have a volume called NAS (/mnt/NAS), which is the parent volume of the entire server and under that, I have a data directory (/mnt/NAS/data) that is shared to the network and is where everything is stored. I made a zvol for the VM and that is stored under (/mnt/NAS/vm/ubuntuvm). I made the VM under a zvol(/mnt/NAS/vm) because I plan to spin up one more VM. But because of this, I can't access and/attach the data (/mnt/NAS/data) volume and I am guessing the reason is because it's under a different zvol (/mnt/NAS/vm) vs (/mnt/NAS/data). Due to this, I can't add a another disk device (for access to the data [/mnt/NAS/data] directory) to my Ubuntu VM because the only zvols that show up there are the ones in the VM zvol (/mnt/NAS/vm).

So, is there anyway to mount the data directory (/mnt/NAS/data) onto the Ubuntu VM that is stored in (/mnt/NAS/vm/ubuntuvm
Hey rakesh, have you found a way? I've mounted everything over NFS to my Ubuntu VM (docker) and have big problems with the Apps inside, which are using mostly SQLite; the database is locked most of the time.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
You should not run anything that relies on local locking over NFS. SQlite, mail spool, ... all no-nos.
Keep this part of the data inside the VM, take snapshots and possibly replicate. Only put file store like Nextcloud or Plex files on NFS, never the database.

HTH,
Patrick
 

alieNus

Dabbler
Joined
Mar 23, 2018
Messages
30
You should not run anything that relies on local locking over NFS. SQlite, mail spool, ... all no-nos.
Keep this part of the data inside the VM, take snapshots and possibly replicate. Only put file store like Nextcloud or Plex files on NFS, never the database.

HTH,
Patrick
I've mounted now an new zvol to the VM and created there a partition for docker hosts. Now its running fine and my zvol will be snapshoted all the time. Do you know some more best practices there? I'm snapshoting the zvol but I cant access the files in there, only in the VM.
 

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912
I'm snapshoting the zvol but I can't access the files in there, only in the VM.

Yup. That zvol is a block device, ZFS has no way of seeing inside.

For the DB and other files to be visible - what are you looking to achieve? What else, other than your app, is accessing those files / that DB, that you need it to be visible from outside the VM? Maybe diving into the use case will yield some better designs.
 

alieNus

Dabbler
Joined
Mar 23, 2018
Messages
30
Ok, thank you for your help. My plan is to move from my jails to docker.

On FreeNAS I have two pools: Tank and apps (ssd behind).
In my Tank I have all the files, and apps contain all jail data and also my new zvol: /mnt/apps/docker
which was mounted to my Ubuntu 18 VM as DISK (Tank was mounted over NFS and runs fine). Inside this Ubuntu VM I'm now putting all the appdata files to this DISK so its saved in my zvol docker. At the moment I have the feeling that its not the perfect way, because I can't see the appdata files inside this block device and if one docker host breaks I have to snapshot the whole zvol. I'm actually searching for better strategie here to have everything snapshoted and save, separated.
 
Top