Restore a single file from Snapshot

All your general support questions for OpenZFS on OS X.

Restore a single file from Snapshot

Postby Tsur » Mon Jun 25, 2018 8:59 pm

So I've been dutifully taking weekly snapshots for the past year. I've accidentally deleted a file, but I'm not certain when I deleted it. I rotate two backups biweekly, so I know I deleted it at least a month ago. I definitely don't want to rollback my entire system.

So in practical terms, how do I browse the contents of my snapshots to locate the file and then restore it?
Tsur
 
Posts: 10
Joined: Thu Jan 07, 2016 2:11 pm

Re: Restore a single file from Snapshot

Postby lundman » Tue Jun 26, 2018 9:51 pm

zfs mount $snapshot
ls -l $mountpoint/.zfs/$snapshot/path/to/file
zfs umount $snapshot

then just change $snapshot do go back in time until you find it.
User avatar
lundman
 
Posts: 431
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Re: Restore a single file from Snapshot

Postby Tsur » Fri Jun 29, 2018 9:05 am

Thanks for the help.

But I guess I was wondering (hoping) if there's some sort of snapshot "viewer" functionality or utility - an easier way to browse the contents of multiple snapshots.
Tsur
 
Posts: 10
Joined: Thu Jan 07, 2016 2:11 pm

Re: Restore a single file from Snapshot

Postby thePoet » Tue Jul 03, 2018 6:37 am

I’m not sitting in front of my computer to prove this out, but I believe if you configure Finder to show hidden files, the .zfs directory that you will mount the snapshot to should be visible. You will still need to use the command line to mount and unmount the snapshots, but you will be able to look through the files, copy, etc through Finder like normal.
thePoet
 
Posts: 16
Joined: Sat May 24, 2014 8:12 am


Return to General Help

Who is online

Users browsing this forum: No registered users and 4 guests

cron