Bye backups… hi ZFS snapshots!

Today an entire folder disappeared from my Owncloud instance. It is an entire mystery why has disappeared. And I haven’t backups since owncloud data supposedly is synced between all client computers…

But, who wants backups when you have ZFS snapshots? I have all my private Owncloud data into a ZFS volume, and a cron job that do snapshots at midnight. Unlike Solaris, ZFS on Linux doesn’t have snapshotting natively so we have to use this set of pretty scripts: zfs-auto-snapshot

ZFS snapshots can be accessed like if they were a regular filesystem and they show you the files as it were just at the snapshot moment. The good thing is that the space occupied is *very* low (only stores changed data like it were an incremental backup).

So you only have to copy the missing data from the snapshot folder into the original place.

zfs list shows us all the datastores, mountpoints and snapshots:


We want to restore the latest snapshot from May 12th at 04:25am. First we have to ensure that snapshots are visible to us. We’ll set RomaniHD/Magatzem datastore to show snapshots. It will be located hidden on the datastore root (/datastore/.zfs)


Voilà, we have a virtual copy of our datastore of the last week:

Now we have to enter the desired folder (day) and copy the contents into the correct place.

In my case, I restored Owncloud data, so after copying the missing data I had to do a content refresh. First become www-data user and tell owncloud to refresh its entire data folder:


Deixa un comentari

L'adreça electrònica no es publicarà. Els camps necessaris estan marcats amb *