ZFS "remote" replication.

More games with ZFS on my laptops. I was wondering about getting an external disk that I could attach to the zpool to act as a backup of the pool. This would seem the ideal solution, but has one draw back. I have not got an external drive here, now.

I do however have another laptop. How about exporting (sharing) a file over a back to back ethernet link and then creating a lofi device and attaching that into the zpool?

I'll gloss over the setting up the link but is was a private link, how I like that gigabit networks auto-detect the cable. Now zfs does all the sharing for me, so no editing dfstab and running extra commands. I did not even have to sacrifice a chicken. Just use zfs set to set the sharenfs option. Smf then starts all the nfs server services automatically.

principia 788 # zfs list -o name,sharenfs backup
NAME                  SHARENFS
backup                root=192.168.2.1,rw=192.168.2.1
789 #

Meanwhile on the host I am backing up(sigma) :

sigma 761 # lofiadm -a /net/192.168.2.2/backup/sigma /dev/lofi/1
sigma 762 # zpool attach home c0d0s6 /dev/lofi/1

Now at this point I did expect it all to go wrong and at least in some ways I was not disappointed. The system being backed up did after a short while stop responding to anything and I had to power cycle it. When I rebooted I was more than slightly apprehensive as to whether the zpool, which contains my home directory would still be there. I should not have worried.

sigma 785 # zpool status home
  pool: home
 state: DEGRADED
status: One or more devices could not be opened.  Sufficient replicas exist for
        the pool to continue functioning in a degraded state.
action: Attach the missing device and online it using 'zpool online'.
   see: http://www.sun.com/msg/ZFS-8000-2Q
 scrub: resilver completed with 0 errors on Sat Nov 26 17:42:39 2005
config:

        NAME             STATE     READ WRITE CKSUM
        home             DEGRADED     0     0     0
          mirror         DEGRADED     0     0     0
            c0d0s6       ONLINE       0     0     0
            c0d0s7       ONLINE       0     0     0
            /dev/lofi/1  FAULTED      0     0     0  cannot open
sigma 786 #

So now lets bring back the interface and get the lofi device back and see what happens:

sigma 904 # zpool online home /dev/lofi/1
Bringing device /dev/lofi/1 online
sigma 905 # zpool status home
  pool: home
 state: ONLINE
 scrub: resilver completed with 0 errors on Sat Nov 26 18:39:20 2005
config:

        NAME             STATE     READ WRITE CKSUM
        home             ONLINE       0     0     0
          mirror         ONLINE       0     0     0
            c0d0s6       ONLINE       0     0     0
            c0d0s7       ONLINE       0     0     0
            /dev/lofi/1  ONLINE       0     0     0  588K resilvered
sigma 906 #

Now I can take it offline in a more graceful way:

sigma 906 # zpool offline home /dev/lofi/1
Bringing device /dev/lofi/1 offline
sigma 907 # zpool status home
  pool: home
 state: DEGRADED
status: One or more devices has been taken offline by the adminstrator.
        Sufficient replicas exist for the pool to continue functioning in a
        degraded state.
action: Online the device using 'zpool online' or replace the device with
        'zpool replace'.
 scrub: resilver completed with 0 errors on Sat Nov 26 18:39:20 2005
config:

        NAME             STATE     READ WRITE CKSUM
        home             DEGRADED     0     0     0
          mirror         DEGRADED     0     0     0
            c0d0s6       ONLINE       0     0     0
            c0d0s7       ONLINE       0     0     0
            /dev/lofi/1  OFFLINE      0     0     0  588K resilvered
sigma 908 #

At this point I need to try the next step which is to import the data that is in that file on another system.


More on this later.


Tags:

Comments:

How about iSCSI?

Posted by Mikael Gueck on November 26, 2005 at 01:10 PM GMT #

iSCSI would be good. My main reason for the approach I have taken was that was the hardware I have. However I think generally NFS offers a good solution especially if the files are then on ZFS. I'm wondering about setting up a server that would allow me to dock my laptop when ever I was in the office such a server could serve a large number of laptops and the flexibility of nfs and ZFS would make this much easier to manage than using iSCSI.

Posted by Chris Gerhard on November 26, 2005 at 01:24 PM GMT #

Have you heard of any plans to make ZFS a clustered, networked filesystem as well?

Posted by Mikael Gueck on November 27, 2005 at 12:26 PM GMT #

why not use the zfs "backup" and "restore" functions to do either a FULL or INCR "dump" to the remote machine... Since (in your example) both machines seem to run ZFS this should be fairly straightforward without doing NFS-shares and other such such fun....

Especially doing the backup/restore operation through ssh (with compression, or an external bzip2/gzip -9 piping) should cut down on bandwidth, althoug that may not be such a big deal in this case.

(I think the zfs manpage has an example on doing the backup/restore)

Lets us know how you make out.

thanks --MikeE

Posted by guest on November 27, 2005 at 03:35 PM GMT #

Mikael,

You would be best served by posting your question to the ZFS forum over at OpenSolaris.org there are people in there who are in the know about ZFS futures.

Posted by Chris Gerhard on November 29, 2005 at 04:17 AM GMT #

MikeE,

Part of the reason for doing this this way was just to see if it would work and how practical it would be.

The problem for me with zfs dump and zfs restore is in the man page were it says the format is not defined.

        The format of the backup archive is evolving.  No  back-
         wards  compatibility  is guaranteed; you may not be able
         to restore your backups on future versions of ZFS.

So it can break in an update. This is fair enough but it would not get me anything more than can get using cpio. Meanwhile it only backs up the snapshot, not all the snapshots. I have one every minute and I really like it. If zfs backup could back up the whole file system including the snapshots then it would be more interesting.

Posted by Chris Gerhard on November 29, 2005 at 04:28 AM GMT #

What is the reason for using lofiadm ? zpool can use files arealdy, can't it ?

Posted by Cyril Plisko on December 20, 2005 at 10:41 AM GMT #

[Trackback] After the debacle of the reinstall of my laptop zpool having to be rebuild and “restored” using zfs send and zfs receive I thought I would look for a better back up method. One that did not involve being clever with partitions on an e...

Posted by The dot in ... --- ... on April 18, 2007 at 06:37 AM BST #

I have one question about this. The remote "backup" to the remote file works, but what happens when your primary laptop fails completely, and you need to restore from your backup? How do you get to the ZFS inside the file that is on the remote system?

In my experience, if the primary source of the data is cut off, the mirror "sections" or "slices" don't have complete sets of data, even though ZFS claims that it does complete synchronous writes. Every time I try to import the slice, it gives me a "dangling dbuf" error, which means that the slice is completely unuseable. Perhaps this has been fixed by now, but not from when I tried it.

Posted by Ian on October 31, 2007 at 12:10 PM GMT #

Ian, the dangling dbuf panic has been fixed in a recent build of nevada. However I have stopped using this method of backing up my systems as it is not as flexible as zfs send | zfs receive.

See http://blogs.sun.com/chrisg/entry/rolling_incremental_backups

This allows you to see the backups as real file systems on the remote system without "damaging" them as you would if you mounted a pool. It also allows me to only backup parts of the pool.

Posted by Chris Gerhard on November 01, 2007 at 05:18 AM GMT #

Thanks dear..i got those options which i was not aware...

Posted by vipin on November 23, 2008 at 12:39 AM GMT #

Post a Comment:
Comments are closed for this entry.
About

This is the old blog of Chris Gerhard. It has mostly moved to http://chrisgerhard.wordpress.com

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today