To Delete ZFS Snapshot
zfs destroy $snapshot
To make it easy, following is the bash script to delete all the zfs snapshot with single shot
#!/bin/bash
for snapshot in `zfs list -H -t snapshot | cut -f 1`;
do
zfs destroy $snapshot;
done
To Delete ZFS Snapshot
zfs destroy $snapshot
To make it easy, following is the bash script to delete all the zfs snapshot with single shot
#!/bin/bash
for snapshot in `zfs list -H -t snapshot | cut -f 1`;
do
zfs destroy $snapshot;
done
ZFS have abilities to save snapshot as file object or save snapshot to other remote.
As I will focus on save snapshot to other remote, only two simple commands that involve here which are zfs send, zfs receive.
The basic concept is send snapshot that you want to send to other remote by ssh protocol and make the remote understand that you gonna give the snapshot
so the commands will be
zfs send [name of the snapshot] | ssh [username]@[remote (ip or hostname)] zfs receive [name of zfs volume]
for example
zfs send DV/Sn03 | ssh reski@zfsserver zfs receive DV/Sn03
If you receive error such as zfs command not found, the solution is that you write full path of zfs in the remote size.
zfs send DV/Sn03 | ssh reski@zfsserver /usr/sbin/zfs receive DV/Sn03
if you receive error such as cannot receive new filesystem stream: permission denied, the solution is that you have to assigned some kind of some ACL permissions to that ZFS volume (remote side). Basic permissions for this remote replication are mount, create and receive
zfs allow everyone mount,create,receive DV/Sn03
* as prerequisite : you should define DV/Sn03 first before you do zfs allow
Additional notes, to send incremental updates, just modify above command
zfs send - [name of the first snapshot] [name of the second snapshot] | ssh [username]@[remote (ip or hostname)] zfs receive [name of zfs volume]
for example
zfs send -i DV/Sn03@1 DV/Sn03@2 | ssh reski@zfsserver zfs receive DV/Sn03
additional note:
if you find message like this
cannot receive new filesystem stream: destination 'VD03/dataVM' exists
must specify -F to overwrite it
it means you have to do it like this
zfs send -i DV/Sn03@1 DV/Sn03@2 | ssh reski@zfsserver zfs receive -F DV/Sn03
Reference :
By default, if you install OpenIndiana Operating System with server installation either USB or CD mode installation, you will never get time-slider features. So what's the beauty of time-slider.
Time Slider is one of ZFS feature that introduce for OpenSolaris Operating system which utilized the ZFS ability to do multiple snapshot. With time-slider, you can forward or backward, your file condition as easy as count 1-2-3
So, how to check whether you have it or not?
You can check it by
reski@nas2:~# svcs -a |egrep "auto-snap|slider"
disabled 4:44:46 svc:/application/time-slider:default
disabled 4:44:46 svc:/application/time-slider/plugin:rsync
disabled 4:44:46 svc:/application/time-slider/plugin:zfs-send
disabled 4:44:46 svc:/system/filesystem/zfs/auto-snapshot:monthly
disabled 4:44:46 svc:/system/filesystem/zfs/auto-snapshot:daily
disabled 4:44:46 svc:/system/filesystem/zfs/auto-snapshot:weekly
disabled 4:44:46 svc:/system/filesystem/zfs/auto-snapshot:hourly
disabled 4:44:46 svc:/system/filesystem/zfs/auto-snapshot:frequent
if you got, any messages above, it means you have it. You can use it straight away.
But if you don't, install it by using following commands
pkg set-publisher -p http://pkg.openindiana.org/sfe
pkg install time-slider
After you install it again, please make sure you check it again by do above command.
To active it via non gui a.k.a console, please check Jason Matthews blogs (http://broken.net/openindiana/how-to-configure-time-slider-without-using-the-gui)
Reference
- http://blog.allanglesit.com/2011/04/zfs-snapshot-management/
- http://borrellstudios.com/2011/07/enabling-time-slider-on-solaris-11-express/