1 Reply Latest reply on Nov 29, 2012 5:31 PM by KernelSteve-Oracle

    Can I send snapshots to an NFS mounted directory?

      We have a Windows 2008R2 server with a very large attached SCSI drive array. I have a directory on that drive set up as an NFS export. I can mount that share to our Solaris 10 box with ZFS filesystems. But there doesn't seem to be anything in the syntax of the zfs send command that will allow me to send a snapshot to that directory. In fact, it seems to say that it has to be of the same filesystem type. Any thoughts on this?

      Thanks very much.

        • 1. Re: Can I send snapshots to an NFS mounted directory?
          Yes you can. ‘zfs send’ lets you take a snapshot of ZFS filesystems and output it to a file or stream it into another command. In your situation, you want to send the stream to a file which is stored on the NFS filesystem.

          The first step with using ‘zfs send’ is to take a snapshot of the filesystem. Since snapshots are read-only, you do not have to worry about files being written at the time you run ‘zfs send’. Making a snapshot can be done by using zfs snapshot “filesystems name” like so.

          # zfs snapshot tank/dataset@20121129

          Now you can redirect the zfs send stream to a file:

          # zfs send tank/dataset@20121129 > /nfs_storage/backups/tank-dataset.zstream

          Now taking the same idea of output to a file, but it is now piped into gzip or bzip2 to compress it.

          # zfs send tank/dataset@20121129 | gzip > /nfs_storage/backups/tank-dataset.zstream.gz
          # zfs send tank/dataset@20121129 | bzip2 > /nfs_storage/backups/tank-dataset.zstream.bzip2

          It's very important, as with any backup, to validate the backup is good. It's no use taking backups if the backups are useless when it comes time to use them. It's useful to use /usr/sbin/zstreamdump to parse the newly created stream to verify no errors.

          # zstreamdump < /nfs_storage/backups/tank-dataset.zstream

          To use the backup file from a ‘zfs send’ output you just need to stream or pipe it in to ‘zfs receive’. As with 'zfs send' there are may options and arguments to 'zfs receive'. The basic syntax would be:

          # zfs receive tank/newdataset < /nfs_storage/backups/tank-dataset.zstream