Just read an interesting mail on zfs-discuss about working with snapshots without actually working with the zfs commands. I knew that you could create snapshots this way, what i didn't knew until today (never tried it) ... it works from remote as well.

Local

You reate an temporary ZFS pool for testing purposes at first:
jmoekamp@opensolaris1:/testpool1# zpool create -f testpool1 /export/home/jmoekamp/test
Now you change into this directory. At first we just create a small file there to demonstrate the snapshot functionality.
jmoekamp@opensolaris1:/# cd testfile1jmoekamp@opensolaris1:/testpool1# touch testfile1jmoekamp@opensolaris1:/testpool1# ls testfile1
Okay. You remember that you can access and view your snapshots by changing into the .zfs/snapshot directory of a ZFS filesystem for sure.
jmoekamp@opensolaris1:/testpool1# cd /testpool1/.zfs/snapshotjmoekamp@opensolaris1:/testpool1/.zfs/snapshot#
But did you know that you can create, rename and delete them there as well? Without using ZFS command? Let's create an directory in this .zfs directory.
jmoekamp@opensolaris1:/testpool1/.zfs/snapshot# mkdir snapshot-21042010-1jmoekamp@opensola...testpool1/.zfs/snapshot# zfs list -t snapshot | grep testpool1testpool1@snapshot-21042010-1 0 - 22K -
As you have seen an snapshot has been created in this zfs filesystem. You can easily check it by creating another file in the ZFS filesystem and look into the directory and into the snapshot:
jmoekamp@opensolaris1:/testpool1/.zfs/snapshot# ls -l /testpool1total 1-rw-r--r-- 1 root root 0 2010-04-21 17:42 testfile1jmoekamp@opensolaris1:/testpool1/.zfs/snapshot# touch /testpool1/testfile2jmoekamp@opensolaris1:/testpool1/.zfs/snapshot# ls -l /testpool1total 1-rw-r--r-- 1 root root 0 2010-04-21 17:42 testfile1-rw-r--r-- 1 root root 0 2010-04-21 17:45 testfile2jmoekamp@opensolaris1:/testpool1/.zfs/snapshot# cd snapshot-21042010-1/jmoekamp@opensolaris1:/testpool1/.zfs/snapshot/snapshot-21042010-1# ls -ltotal 1-rw-r--r-- 1 root root 0 2010-04-21 17:42 testfile1
Renaming the snapshot is easy. Just use mv for this task.
jmoekamp@opensolaris1:/testpool1/.zfs/snapshot# mv snapshot-21042010-1 snapshot-21042010-1.1jmoekamp@openso...testpool1/.zfs/snapshot# zfs list -t snapshot | grep testpool1testpool1@snapshot-21042010-1.1 19K - 22K -
You can create a second one without any problems:
jmoekamp@opensolaris1:/testpool1/.zfs/snapshot# mkdir snapshot-21042010-2jmoekamp@opensola...testpool1/.zfs/snapshot# zfs list -t snapshot | grep testpool1testpool1@snapshot-21042010-1.1 19K - 22K -testpool1@snapshot-21042010-2 0 - 22K -
When you don't need the snapshot any longer, just delete it with rmdir
jmoekamp@opensolaris1:/testpool1/.zfs/snapshot# rmdir snapshot-21042010-1.1 jmoekamp@opensolaris1:/testpool1/.zfs/snapshot# ls -ltotal 2drwxr-xr-x 2 root root 4 2010-04-21 17:45 snapshot-21042010-2jmoekamp@opensola...testpool1/.zfs/snapshot# zfs list -t snapshot | grep testpool1testpool1@snapshot-21042010-2 18K - 22K -
Remote Control

We just saw that we are able to control the snapshot functionality with mkdir,mv and rmdir. Wouldn't it be nice to use this to control snapshoting remotely from a different system without the need to use ssh? And indeed, you can do such a thing. At first you have to share the ZFS file system via NFS on the NFS server. In this case it's the system opensolaris1. That's easy.
jmoekamp@opensolaris1:/testpool1/.zfs/snapshot# zfs set sharenfs=on testpool1
Now we have to login into the NFS client system. In this example i will use the system hivemind as an NFS client. Both NFS server and NFS client have the same users with the same user ids. It's really useful to open two terminal windows to have both systems in access. I'm login in as jmoekamp. This user has the primary administrator privilege, so the user is able to mount a NFS share via pfexec.

At first mount the directory at your prefered location:
jmoekamp@hivemind:~$ pfexec mount 192.168.2.123:/testpool1 /mntjmoekamp@hivemind:~$ cd /mntjmoekamp@hivemind:/mnt$ cd .zfsjmoekamp@hivemind:/mnt/.zfs$ lsshares snapshotjmoekamp@hivemind:/mnt/.zfs$ cd snapshotjmoekamp@hivemind:/mnt/.zfs/snapshot$ lssnapshot-21042010-2
At the moment you can look into this directory, look into the snapshots, but you can create snapshots. The privilege to do so is up to root and long time users of NFS know that there are specialities to obey with NFS and root. But it's much easier to solve this. You can delegate some of the administrative task to normal users. To allow jmoekamp to create, rename and remove snapshots we have to delegate some tasks to jmoekamp on the fileserver. Failing to do so will just result in a lot of messages about denied permissions.
jmoekamp@opensolaris1:/testpool1/.zfs/snapshot# zfs allow -u jmoekamp create,destroy,mount,snapshot testpool1
Okay, let's use the shell to our NFS client and create a directory in the remote .zfs/snapshot directory:
jmoekamp@hivemind:/mnt/.zfs/snapshot$ mkdir snapshot-remote-21042010
When you use the shell to the NFS server, you will see, that an snapshot named like the directory appeared.
jmoekamp@opensolaris1:/testpool1/.zfs/snapshot# zfs list -t snapshot | grep "testpool1"testpool1@snapshot-21042010-2 18K - 22K -testpool1@snapshot-remote-21042010 0 - 22K -
You've just created a snapshot on your fileserver from remote. Let's to the same for renameing it.
jmoekamp@hivemind:/mnt/.zfs/snapshot$ mv snapshot-remote-21042010 snapshot-remote-21042010-2
Let's do a a short check on the fileserver ...
jmoekamp@opensolaris1:/testpool1/.zfs/snapshot# zfs list -t snapshot | grep "testpool1"testpool1@snapshot-21042010-2 18K - 22K -testpool1@snapshot-remote-21042010-2 0 - 22K -
At last let's try to remove the remotely created snapshot:
jmoekamp@hivemind:/mnt/.zfs/snapshot$ rmdir snapshot-remote-21042010-2/
When you look at the list of snapshots on your fileserver, you will see it disappeared by using rmdir
jmoekamp@opensolaris1:/testpool1/.zfs/snapshot# zfs list -t snapshot | grep "testpool1"testpool1@snapshot-21042010-2 18K - 22K -
Neat ... isn't it ?


Read More about [Interesting way to create, rename and delete snapshots with ZFS...