Solved zfs extract

You do not need to make the .zfs directory visible in order to retrieve files, you can just change directory to it.
Code:
cd /dataset/path/.zfs/snapshot

Yes it does but it doesn't show any data from the jail itself

If you could access the files you wanted by creating a clone of the snapshot, but couldn't see the files in the .zfs/snapshot folder, then you weren't looking in the right place. Every ZFS dataset will have its own (hidden) .zfs directory, which is located in the root of the dataset mountpoint. If your jail has its own dataset mounted on /some/path/myjail, you'd need to go into /some/path/myjail/.zfs/snapshot to view files from that jail.
 
Thank you usdmatt, I misread the OP answer. I thought it could not see the .zfs directory. fred974, if you use iocage(8), your data are in the root dataset associated to the jail.
Code:
# iocage snaplist tests
NAME                                  CREATED                RSIZE   USED
initstate                             Sun Jan 15  9:01 2017  88K    0

# iocage get mountpoint tests
/iocage/jails/ab83c86b-daf8-11e6-812e-d43d7ee06407

% ls /iocage/jails/ab83c86b-daf8-11e6-812e-d43d7ee06407/.zfs/snapshot/initstate/
fstab   root

% ls /iocage/jails/ab83c86b-daf8-11e6-812e-d43d7ee06407/root/.zfs/snapshot/initstate/
COPYRIGHT   etc       mnt       sbin       var
bin       lib       proc       sys
boot       libexec       rescue       tmp
dev       media       root       usr
 
Useful little trick; If you run df ., it gives you the df output for the file system containing the current folder.

Lets say I am in a folder somewhere on the system and I want to restore a file in this folder from snapshot -
Code:
# df .
Filesystem           1K-blocks      Used     Avail Capacity  Mounted on
storage/platform/web 932895775 134345903 798549872    14%    /storage/platform/web

This lets me know that the directory I am in is on the storage/platform/web dataset, which is mounted at /storage/platform/web. So if I want to access a snapshot of this data, it should be under /storage/platform/web/.zfs/snapshot.
 
Back
Top