zfs list
for past three snapshotsShould the delta or used space not be the size of the deleted file. I know ZFS is COW but I'm confused as to why I can't rollback the /usr/home/xxxx
child
# ls /home/xxxxx/testing12345.txt
/home/xxxxx/testing12345.txt
# ls -alh /home/xxxxx/testing12345.txt
-rw-r--r-- 1 root xxxxx 254M Aug 28 00:06 /home/xxxxx/testing12345.txt
# zfs list -rt snapshot tank1/usr/home/xxxxx
NAME USED AVAIL REFER MOUNTPOINT
tank1/usr/home/xxxxx@myRecursiveSnapshot 291M - 804M -
tank1/usr/home/xxxxx@devEnv 71K - 1.39G -
tank1/usr/home/xxxxx@xfce 0 - 1.39G -
tank1/usr/home/xxxxx@testhome 0 - 1.39G -
tank1/usr/home/xxxxx@testagain 1K - 1.39G -
tank1/usr/home/xxxxx@27082015 0 - 1.39G -
tank1/usr/home/xxxxx@270820150 0 - 1.39G -
tank1/usr/home/xxxxx@2708201501 0 - 1.39G -
#
#
#
#
# zfs snapshot -r tank1@28082015
# zfs list -rt snapshot tank1/usr/home/xxxxx
NAME USED AVAIL REFER MOUNTPOINT
tank1/usr/home/xxxxx@myRecursiveSnapshot 291M - 804M -
tank1/usr/home/xxxxx@devEnv 71K - 1.39G -
tank1/usr/home/xxxxx@xfce 0 - 1.39G -
tank1/usr/home/xxxxx@testhome 0 - 1.39G -
tank1/usr/home/xxxxx@testagain 1K - 1.39G -
tank1/usr/home/xxxxx@27082015 0 - 1.39G -
tank1/usr/home/xxxxx@270820150 0 - 1.39G -
tank1/usr/home/xxxxx@2708201501 0 - 1.39G -
tank1/usr/home/xxxxx@28082015 0 - 1.39G -
# rm /home/xxxxx/testing12345.txt
# zfs list -rt snapshot tank1/usr/home/xxxxx
NAME USED AVAIL REFER MOUNTPOINT
tank1/usr/home/xxxxx@myRecursiveSnapshot 291M - 804M -
tank1/usr/home/xxxxx@devEnv 71K - 1.39G -
tank1/usr/home/xxxxx@xfce 0 - 1.39G -
tank1/usr/home/xxxxx@testhome 0 - 1.39G -
tank1/usr/home/xxxxx@testagain 1K - 1.39G -
tank1/usr/home/xxxxx@27082015 0 - 1.39G -
tank1/usr/home/xxxxx@270820150 0 - 1.39G -
tank1/usr/home/xxxxx@2708201501 0 - 1.39G -
tank1/usr/home/xxxxx@28082015 0 - 1.39G -
#
I've been tried rolling back using various snapshots the /usr
, /usr/home
, and /usr/home/xxxx
directories. I've read the FreeBSD forums, the handbook, and I've also tried rolling back just tank1@[snapshot name]--all
to no effect.
Something odd, when I change files in /usr/home/xxxxx
files in the hidden .zfs/snapshots/[snapshot name]/usr/home/xxxxx
directory change as well.
A ZFS snapshot is a copy of a data set or a volume that takes up nearly zero space and can be created almost instantly due to ZFS's copy-on-write (CoW) architecture. Unlike other traditional filesystems, when data is modified in ZFS, the data is written to a new block rather than overwriting the old data in its place.
Snapshots of file systems are accessible in the . zfs/snapshot directory within the root of the file system. For example, if tank/home/ahrens is mounted on /home/ahrens , then the tank/home/ahrens@thursday snapshot data is accessible in the /home/ahrens/. zfs/snapshot/thursday directory.
Recursive ZFS snapshots are created quickly as one atomic operation. The snapshots are created together (all at once) or not created at all. The benefit of such an operation is that the snapshot data is always taken at one consistent time, even across descendent file systems.
Since these snapshots contain all blocks for the data in question and since they are read only and immutable, they are IMO a backup.
Use this command to see space used for all snapshots of a vdev - relevant property you want is usedsnap:
zfs list -o name,used,avail,refer,creation,usedds,usedsnap,origin,compression,compressratio,refcompressratio,mounted,atime,lused
I've added a few more properties since I use compression on my zfs pools.
zfs snapshots directories are read-only by the way.
You said you cannot roll back? If that's the case specify -r or -R and possibly -f if you have clones, sample:
zfs rollback -r poolname/dataset@oldersnaphot
zfs rollback -R poolname/dataset@oldersnaphot
Read the manual before issuing zfs rollback:
-r Destroy any snapshots and bookmarks more recent than the one specified. -R Recursively destroy any more recent snapshots and bookmarks, as well as any clones of those snapshots. -f Used with the -R option to force an unmount of any clone file systems that are to be destroyed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With