Skip to content

ZFS “remote” replication.

November 26, 2005

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: topic:[ZFS] topic:[OpenSolaris] topic:[Solaris]

Advertisements

From → Solaris

12 Comments
  1. Mikael Gueck permalink

    How about iSCSI?

  2. 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.

  3. Mikael Gueck permalink

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

  4. Anonymous permalink

    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

  5. 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.

  6. 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.

  7. 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.

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

  9. [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…

  10. Ian permalink

    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.

  11. 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.

  12. vipin permalink

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: