Access a ZFS directory from a VM

Jay Hova

Member
Oct 20, 2020
18
0
6
58
Houston, Texas
www.softunderbelly.com
I have a Proxmox machine built by someone else. I am a Windows guy so my knowledge of Linux is very limited. I have a directory with files that I need to be shared by a NAS. I would like to use Zenthyal to serve these files to my Windows clients. I have Zenthyal installed in a VM and I need to connect it to my directory "/zfs0/shared". The information on storage is a bit overwhelming to the extent that I am unsure where to look to find out what I don't know. The problem I keep seeing is that if you ask 10 different Linux guys how to solve a problem you will get 10 different answers and it is very difficult to determine which answer is best.
 
There is no best answer that covers every possible situation.

The first question that comes up - why is your file data located directly on the hypervisor? Why not inside the VM that you plan to use as NAS?
How large of a dataset is it? Is it large enough to warrant a dedicated NAS?
If it is small and must live on hypervisor - why do you think you need a VM to serve CIFS of a data that technically is not under VM control?
The most simple solution is to find basic SAMBA setup guide and configure it directly on PVE host.
A bit more complex - setup a SAMBA container and bind-mound directory to share it out.
A more convoluted one - setup NFS server on PVE host to serve data to your Linux VM , then share it out with SAMBA to windows.
An even more involved and less supported (at the moment) path - configure 9p directory passthrough (search forum) and then SAMBA it out.

So here you have 5 solutions, now you need to ask only 5 more guys.
Good luck


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
Last edited:
  • Like
Reactions: Dunuin and bobmc
You can install zentyal into a KVM for user management (AD)
Then set up a Debian or Ubuntu LXC Container, bindmount your data into it,
install samba and join your (zentyal)domain for user/group info and create your samba shares.

Fileserver (Memberserver)
======================

apt-get install heimdal-clients libpam-heimdal libnss-winbind libpam-winbind samba krb5-user


/etc/resolv.conf set zentyal as nameserver


copy /etc/krb5.conf from zentyal
[libdefaults] default_realm = YOUR.DOMAIN.TLD dns_lookup_realm = false dns_lookup_kdc = true

kinit Administrator@REALM

klist should show kerberos ticket for Administrator


/etc/samba/smb.conf:
--------------------
[global] workgroup = VERWALTUNG realm = VERWALTUNG.ENGELBERG.NET security = ADS winbind enum users = yes winbind enum groups = yes winbind use default domain = no winbind refresh tickets = yes kerberos method = secrets and keytab dedicated keytab file = /etc/krb5.keytab template shell = /bin/bash idmap config * : range = 10000 - 19999 idmap config VERWALTUNG : backend = rid idmap config VERWALTUNG : range = 1000000 - 1999999 inherit acls = yes store dos attributes = yes vfs objects = acl_xattr [myshare] comment = Description of myshare read only = no path=/path/to/data

in /etc/nsswitch.conf add winbind to paswd and group

[ICODE
]passwd: compat winbind
group: compat winbind
shadow: compat
[/ICODE]

add windind to pam
pam-auth-update [x] winbindd

net ads join -Uadministrator net ads testjoin

systemctl restart smbd winbind

wbinfo -u should show AD users

getenp passwd should also show AD Users (additional to local users)


test samba access
smbclient -L -U 'DOMAIN\Administrator' //localhost/
 
  • Like
Reactions: bbgeek17
Nr 7: Instead of using a dataset for your data you create a virtual disk (zvol) for your NAS VM. Then format that virtual disk inside the VM, store your files on it and share it using SMB. If you then still want to access those files from the PVE host you could mount that SMB share there.

8.) In case you got a dedicated SATA/USB controller or a NVMe SSD just for your storage disks you could PCI passthrough the entire controller/NMVe SSD into the NAS VM so the VM could directly access the physical disk without any virtualization overhead.

9.) In case you got a dedicated disk/partition for your data but PCI passthrough is not an option, you could use disk passthrough to passthough a single disk or partition into your VM. But it will still be seen as a virtual disk.

10.) You could use sshfs to mount a folder from your PVE host inside a linux VM. I know...not a great solution...but otherwise the 10th answer would be missing ;)
 
  • Like
Reactions: ubu

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!