restore individual files from snapshots on the mac

Buster2k6

Cadet
Joined
Nov 7, 2023
Messages
9
Hello,
is it possible to restore individual files from a snapshot on the mac ? or directly in truenas ?
 

Arwen

MVP
Joined
May 17, 2014
Messages
3,611
Depends on if the snapshots are exposed via network shares.

But, even if you can't see the snapshots from a network share, you can log in via SSH to gain access to the files.

ZFS can have the snapshot paths listed, and you simply change directory in to the appropriate place. Then find the file, or files, that you want, and copy the to a new location. Remember, ZFS Snapshots are R/O, (Read Only), so you can either use the file at the snapshot path, or copy it. No deletion or overwriting is possible, (and good for the concept that ZFS was going for).
 
Joined
Oct 22, 2019
Messages
3,641
Then find the file, or files, that you want, and copy the to a new location.

Although I still think ZFS should implement a feature where you can "link back" to blocks in a snapshot. This would make it possible to restore individual files from snapshots without consuming the extra space of essentially having two "copies" represented by different records. This becomes even more useful for restoring very large files.


I brought it up as a "what if" thought experiment here:
EDIT: Keep in mind I posed this question before block-cloning was a feature in ZFS.


Surely this is possible? OpenZFS 2.2 has given us "block cloning", which is based on a similar concept. Why not also give us a way to "block-clone" using blocks that exist in a snapshot?


Let's say you have a large 4GB file that you deleted (or modified), but the older version of it still exists in an earlier snapshot. You can't rollback to this snapshot, because you'll lose everything that you created since that day. So you'll "browse" the snapshot, and then copy this 4GB file to your live filesystem. Now you've got an extra 4GB being consumed. (4GB for the file's blocks in the snapshot + 4GB for the file's blocks in the live filesystem.)

Ideally, we should be able to find the file in the snapshot and "block-clone copy" it as a new file in the live filesystem, which will not consume any extra space. :smile:
 
Last edited:

Buster2k6

Cadet
Joined
Nov 7, 2023
Messages
9
ok, if i mount in finder the snapshot folder with smb://serverIP/hdd/.zfs/snapshot, it works and i can access all snapshot files. thank you
 
Top