Hi,
I’ve somehow discovered a reason for slow down on creating a lot of snapshots on share that would be visible via samba.
SO, to be able to see snapshots in samba as a shadow copy, snapshots created need to be set to “visible”.
To make it more graphica, lets say you’ve got a pool called “main_pool” and a share called "share"
Those will sit in:
/mnt2/main_pool
/mnt2/share
Fair enough - right ? Now, if rockstor script creates a scheduled snapshot (called for sake “share_5min”) which is set to be visible, it will create snapshot located here:
/mnt2/main_pool/.snapshots/share/share_5min_201609191525
but it will also create a symlink:
/mnt2/share/.share_5min_201609191525
so when a samba comes in and tries to find a shadow copy - here is a symlink, go away and look for veto files there.
So far so good
Now, lets say scheduler creates another snapshot, it will locate it here:
/mnt2/main_pool/.snapshots/share/share_5min_201609191530
and create another symlink:
/mnt2/share/.share_5min_201609191530
BUT !!! Bare in mind that your share has now TWO (2) symlinks on it!!! and your second snapshot has a symlink pointing to previous snapshot !!!
So, samba comes in and looks for veto files:
lets follow symlink:
/mnt2/share/.share_5min_201609191530
-> that points you to snapshot ->
/mnt2/main_pool/.snapshots/share/share_5min_201609191530
-> hey that one has a symlink ->
/mnt2/share/.share_5min_201609191525
-> that points you to snapshot ->
/mnt2/main_pool/.snapshots/share/share_5min_201609191530
That causes samba to hash through a log(n) snapshots (where n = total amount of snaphost of share you have) every time it wants to find a shadow copy.
To fix that:
switch off your “visible” options on snapshots
delete all the snapshots that are visible
delete all silly symlinks you have on your share
disable “shadow copy” on samba share
Go to services configuration and add those lines to samba main config:
wide links = yes
unix extensions = no
Go to configuration of you share and add manually those options:
vfs objects = shadow_copy2
shadow:sort = desc
shadow:basedir = /mnt2/share
shadow:format = share_5min_%Y%m%d%H%M
shadow:snapdir = /mnt2/main_pool/.snapshots/share
And that’s it, you’re golden
I sure hope that this will help somebody and point rockstor developers away from this crazy circular creation scheme (FYI btrfs get’s hell confused while creating “visible” snapshots and very often you can see kworker thread sitting there at 100%)