I accidentally delete some files from my zfs pool and tried to mount the latest snapshots but i just figured out that i have no snapshots. How to activate the snapshots, how to configure it?

I am using Ubuntu 12.04.1 server and zfs 0.6.1, pool version is 28.


If you have not taken any snapshots, you lost your data.

To take snapshot, use zfs snapshot command



Starting from Ubuntu 17.04 you can install zfs-auto-snapshot like this:

sudo apt install zfs-auto-snapshot

For Ubuntu versions prior 17.04 you could setup zfs-auto-snapshot to use automatic snapshots from repository

sudo add-apt-repository ppa:zfs-native/stable; sudo apt-get install zfs-auto-snapshot

or directly from github

curl -L https://github.com/zfsonlinux/zfs-auto-snapshot/archive/master.tar.gz | tar xz -C /tmp/
pushd /tmp/zfs-auto-snapshot-master && sudo make install && popd && rm -rf /tmp/zfs-auto-snapshot-master

By default it creates snapshots for each data set every 15 minutes and saves snapshot up to 1 year. However you could disable snapshots for specific dataset by setting com.sun:auto-snapshot dataset property to false

sudo zfs set com.sun:auto-snapshot=false tank/tmp

You could also use com.sun:auto-snapshot:... properties to tune auto snapshot behaviour. E.g. save snapshots daily for 31 days for tank/backup dataset:

sudo zfs set com.sun:auto-snapshot=true tank/backup
sudo zfs set com.sun:auto-snapshot:monthly=false tank/backup
sudo zfs set com.sun:auto-snapshot:weekly=false tank/backup
sudo zfs set com.sun:auto-snapshot:daily=true tank/backup
sudo zfs set com.sun:auto-snapshot:hourly=false tank/backup
sudo zfs set com.sun:auto-snapshot:frequent=false tank/backup

By default script saves:

  • frequent snapshots every 15 mins, keeping 4 snapshots
  • hourly snapshots every hour, keeping 24 snapshots
  • daily snapshots every day, keeping 31 snapshots
  • weekly snapshots every week, keeping 7 snapshots
  • monthly snapshots every month, keeping 12 snapshots
  • 2
    You can also install using the prepackaged ZFS repo: sudo add-apt-repository ppa:zfs-native/stable; sudo apt-get install zfs-auto-snapshot – ScottJ Jun 1 '14 at 2:27
  • Thank you Scott! I've added information about repository to the answer. – Andrey Jun 1 '14 at 13:52
  • The PPA is only available for trusty. – Bram Geron Aug 6 '17 at 20:56

I am searching the web for any man pages or at least a list of tunable properties of zfs-auto-snapshot, but I am blind probably? Can You add few words, or a link, please? I found a README, but I can't understand the way I could change or even read the values mentioned.

So, trying a simple task: How to inc or decrease number of kept monthly snapsots?(having disk space in mind).

sun uses svcadm or time-slider tools which seem nonexistant under ubuntu, am I right?


svccfg -s svc:/system/filesystem/zfs/auto-snapshot:frequent setprop zfs/period = 30
svccfg -s svc:/system/filesystem/zfs/auto-snapshot:frequent refresh

svcadm restart svc:/system/filesystem/zfs/auto-snapshot:frequent

I hope this post is relevant here, as the defaults are great, but perhaps many users with "almost full" pools would be afraid of running out of diskspace.

EDIT: I had another issue with zfs-auto-snapshot. It created snaps at cca 8:00am, approximately at start of working day. What a bad idea, assuming that destroy of outdated snaps which could be very intensive operation and take quite a long time, will occur at that time too. I see that as a risk of driving the system unusable at the worst time of a day. It seems to be just an entry in /etc/cron.daily (weekly, monthly), so the change of anacron line for daily (or whatever) jobs in crontab, should suffice.
I am missing the mention about this in readme.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.