On 17 August 2016 at 20:26, 郑圆杰 <[email protected]> wrote:
> We run docker image on lx zone, and captured an snapshot as zfs snapshot 
> stream.
> Is there a way to export the dataset as tar?

We have a program that you can point at a ZFS snapshot and create a
tar file.  We include this in "cn-agent", the component that creates
Docker layers as part of "docker build" or "docker commit" in Triton.

    https://github.com/joyent/zfs_snapshot_tar

You'll need to compile it first.  You can use it to create a tar file
from an entire snapshot, or an incremental tar file that just includes
the changes between one snapshot and another.  The help message should
hopefully be relatively self-explanatory:

  zfs_snapshot_tar: This program requires 2 or 3 positional arguments.
  Usage:
     zfs_snapshot_tar [OPTIONS] <dataset> [<parent_snapshot>] <snapshot>
     zfs_snapshot_tar [OPTIONS] -e <parentdataset@snapshot> <dataset@snapshot>

     -h        This help message.
     -e        Use explicit "dataset@snapshot" arguments.
     -t        Print details about the archive that would be
               created without creating the archive itself.
     -f FILE   Output tarball name.  Without -f, output is to
               stdout.
     -r SUBDIR Subdirectory within dataset to consider as the
               root directory for the tarball
     -x PATH   Exclude a file or directory (and subdirectories)
               from the archive.  Takes effect after -r, if that
               option is used.


Cheers.

-- 
Joshua M. Clulow
UNIX Admin/Developer
http://blog.sysmgr.org


-------------------------------------------
smartos-discuss
Archives: https://www.listbox.com/member/archive/184463/=now
RSS Feed: https://www.listbox.com/member/archive/rss/184463/25769125-55cfbc00
Modify Your Subscription: 
https://www.listbox.com/member/?member_id=25769125&id_secret=25769125-7688e9fb
Powered by Listbox: http://www.listbox.com

Reply via email to