This discussion is archived
2 Replies Latest reply: Apr 18, 2013 12:00 PM by 15609 RSS

How backup ZFS in tape

15609 Newbie
Currently Being Moderated
I think this is an old issue, but I'm not sure if it was solved yet. Someone has a shell script in order to backup to tape a ZFS filesystem in Solaris 10, by using gtar. If it is not possible, why?
Thanks
  • 1. Re: How backup ZFS in tape
    bigdelboy Pro
    Currently Being Moderated
    williamcastrod wrote:
    I think this is an old issue, but I'm not sure if it was solved yet.
    There are many solutions. And you might try amanda also.
    Someone has a shell script in order to backup to tape a ZFS filesystem in Solaris 10, by using gtar.
    I don't know. I dont. But I'll give a couple of pointers:
    If it is not possible, why?
    It is certainly possilble. There are few different ways of dong this. And there a a couple of possilbe gotchas as well ... eg relating to zfs filesystem hidden files.
    Thanks
    Do do a file bacsed backup checkout gtar t oa file ....
    root@solaris:/export# zfs create rpool/export/wtest
    root@solaris:/export# zfs create rpool/export/wtest/wchild
    root@solaris:/export# touch /export/wtest/file1.txt
    root@solaris:/export# touch /export/wtest/file2.txt
    root@solaris:/export# touch /export/wtest/wchild/file3.txt
    root@solaris:/export# (cd $(zfs list -H -o mountpoint rpool/export/wtest); gtar cpf - --one-file-system . ) | gzip > wtest.tar.gz
    root@solaris:/export# gtar tvpf wtest.tar.gz
    drwxr-xr-x root/root         0 2013-01-19 00:20 ./
    -rw-r--r-- root/root         0 2013-01-19 00:20 ./file2.txt
    drwxr-xr-x root/root         0 2013-01-19 00:21 ./wchild/
    -rw-r--r-- root/root         0 2013-01-19 00:20 ./file1.txt
    ... which seems to be getting the correct result

    Obviosuly we could goto tape with something like:-

    (cd $(zfs list -H -o mountpoint rpool/export/wtest); gtar cpf /dev/rmt/0 --one-file-system . )

    ... but this ignores blocking factors which may be important for a not trivial amount of data.

    (cd $(zfs list -H -o mountpoint rpool/export/wtest); gtar cpbf 96 /dev/rmt/0 --one-file-system . )

    ================

    Another apporpchs is to take a snapshort of the zfs filesystme and back that up .....
    zfs send rpool/export/wtest@fortape | dd obs=49152 of=/dev/rmt/0
    This is not a file based backup! And dont run the command if you dont have /dev/rmt/0 device!


    Please be aware I am rusty on tapes, and may have made mistakes. And testing this and brining it up to production quality is for you. I hate tapes. Restores sometimes go wrong .. and it get exciting ... when you discover the backup was not all you thought it was!

    Edited by: bigdelboy on Jan 18, 2013 11:59 PM NB: Having turned off my computer for going to bed I mused the block sizes given above are probably inappropriately low for modern tape drives (ok for 8GB exabytes!)
  • 2. Re: How backup ZFS in tape
    15609 Newbie
    Currently Being Moderated
    Thanks a lot...Regarding the 2nd approach in order to restore I must use send receive and dd -f=....etc..

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points