How to restore a single directory from ZVOL snapshot or backup to new location?

jaypub

Dabbler
Joined
May 21, 2019
Messages
12
Hello Freenas Community...

I have an issue where a user has accidentally altered contents of shared directory in Windows environment.

The directory is served to windows server via iSCSI from a FreeNAS based ZVOL on TANK1

We do daily snapshots of the ZVOLs as well as replications w/snapshots to another pool on the same freenas system (BIGBACKUPTANK1)

I have plenty of space to play with on BIGBACKUPTANK1.

Is it possible to restore just a specific directory from within the ZVOL in its different versions somewhere on the freenas system (i.e. /tmp/restoretests/) from the various TANK1/snapshots and replicated backups on BIGBACKUPTANK1?
 

Jasse Jansson

Explorer
Joined
Mar 19, 2017
Messages
71
I doubth it because I have never heard of such a feature as access to files in snapshots, at least not in ZFS.

I believe the same goes for ZFS send/receive but I have never got it confirmed.

Mostly leaving a mark here because I too want to know.
 

hescominsoon

Patron
Joined
Jul 27, 2016
Messages
456
if you have shadow copies enabled on the shares then you can use previous version inside of windows..open that version and grab that file. if not you can clone the snapshot..setup a share and then expose it..then you can go grab the file using the windows client and get it from that share...:)
 

jaypub

Dabbler
Joined
May 21, 2019
Messages
12
if you have shadow copies enabled on the shares then you can use previous version inside of windows..open that version and grab that file. if not you can clone the snapshot..setup a share and then expose it..then you can go grab the file using the windows client and get it from that share...:)

Thanks. Yeah that's what I was thinking I would need to do... restore an older snapshot of zvol to temporary area, mount it and access that way. I was just hoping there was an easier way to at least parse though the files within the zvol (within freenas) so I can figure out which backup or snapshot containts what we are looking for.
 

hescominsoon

Patron
Joined
Jul 27, 2016
Messages
456
Thanks. Yeah that's what I was thinking I would need to do... restore an older snapshot of zvol to temporary area, mount it and access that way. I was just hoping there was an easier way to at least parse though the files within the zvol (within freenas) so I can figure out which backup or snapshot containts what we are looking for.
unfortunately not...at least not to my knowledge as a zvol isn't a filesystem in of itself...so something like filezilla or whatever doesn't work...
 

Apollo

Wizard
Joined
Jun 13, 2013
Messages
1,458
You could run "zfs diff" between snapshots or use only one snapshot to know what has changed in the file system against your current state.
If you know the file name, you can use "grep -iname "you_filename" to refine the search.
You can aslo run "zfs history" or "zpool history" I think to list all actions on the file system.

Once you have narrowed down the relevant snapshot, you can clone it and it will be automatically mounted so you can copy the file to the original dataset, then destroy the clone.
 
Top