Taking suggestions: Samba Previous versions implementation

Richard B

Active Member
Jul 17, 2017
2
0
41
43
Is it possible (or conversely a terrible idea) to expose zfs snapshots to a container?

My goal is to enable 'previous versions' via samba's shadow_copy2 vfs object, preferably backed by zfs snapshots, for document storage that can be recovered without IT (me) intervention. The documents in question consume a considerable amount of space, and continuous growth; perhaps 15gb of hot data (accessed at least daily), and (currently) 1.7TB of cool/cold data.

There is several paths to accomplish this as I see it.

The most resource efficient would be to run samba in a lxc container instance, bind mounts to expose a host directory, and bind mounts to expose native zfs snaps to the container. This keeps everything in one filesystem, with no concern about reclaiming space from one container or vm as requirements change.
There is obviously concerns about exposing the snaps, the management of them, naming schema, and mounting/unmounting on creation and removal.

The second would be to use a vm, seperate zfs filesystem carved from raw partitions, or as a disk image on local (non zfs) storage. This means predetermining the disk space allocated for this storage subsystem (a non trivial task considering the unsteady growth of the datastore), and the overhead of two zfs filesystems (arc memory).

The third is to forgo Proxmox, and revert to my existing layout of a Centos host, zfs filesystem, and samba on the host. Not as optimal, as I lose the great management interface, and am running network accessible services on the host.

---
I'm all ears for suggestions, please.
 
I've got this working and am running Samba on the Proxmox host which is also AD joined though I don't allow AD users to log into Proxmox directly so it's just enough for Samba to work correctly.

Before using ZFS I had a file server LXC however with ZFS passing the root ZFS as a bind mount through doesn't work because each dataset below it is a mount point so isn't exposed to the container. As I've more datasets than your allowed bond mount points in Proxmox I just gave up on that and put it on the host.

It's a bit of a faff to get it working as ZFS's auto snapshot needs modification before it will store the snaps in a naming scheme that works with Samba's Shadow Copy implementation.

I do quite a few bind mounts to LXC containers so overall this works nicely. I don't do snaps on all datasets, just the important ones where rolling back a file would be useful.

Let me know if you want to implement it this way and I'll get the details next time I can get to log in to my host with this configured.
 
Let me know if you want to implement it this way and I'll get the details next time I can get to log in to my host with this configured.

I don't know why putting samba on Proxmox didn't occur to me as an option. It's still not optimal, but better than not having access to proxmox's interface, and certainly better than having samba in a vm with pre-allocated/dedicated storage space.

I'm not in a rush, but yes, I'd appreciate seeing how you accomplished it.

I won't be deploying this server(s) for some months, but since I'm new to Proxmox and one of two of these setups will be a remote deployment, I need to get it perfect beforehand #_#
 
As long as the ZFS dataset itself if the samba share 'path' parameter and should work the same as in a non-lxc fashion. Snapshots has to be done from the outside, but everything else works as it should. We use ZFS inside a VM, because we have a LVM-based SAN cluster (so no ZFS on PVE side).

There are tons of examples/tutorials out in the wild, so just use their implementation and create mountpoint-bind inside your LXC from your ZFS dataset.
 
I've got this working and am running Samba on the Proxmox host which is also AD joined though I don't allow AD users to log into Proxmox directly so it's just enough for Samba to work correctly.

Before using ZFS I had a file server LXC however with ZFS passing the root ZFS as a bind mount through doesn't work because each dataset below it is a mount point so isn't exposed to the container. As I've more datasets than your allowed bond mount points in Proxmox I just gave up on that and put it on the host.

It's a bit of a faff to get it working as ZFS's auto snapshot needs modification before it will store the snaps in a naming scheme that works with Samba's Shadow Copy implementation.

I do quite a few bind mounts to LXC containers so overall this works nicely. I don't do snaps on all datasets, just the important ones where rolling back a file would be useful.

Let me know if you want to implement it this way and I'll get the details next time I can get to log in to my host with this configured.
Hi FaseLaneJB,

Mounting the mount point at the same directory within an LXC container as in the Proxmox machine (i.e. /rpool/data/subvol-112-disk-2) will expose the .zfs/snapshot directory within and will allow browsing that via smb.

I do not manage to work with Samba's Shadow Copy implementation, however - none of my auto snapshots are visible on the Windows side. Could you pleas share what you have done to make them visible?

Thanks,
Ralf.
 

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!