From owner-freebsd-questions@FreeBSD.ORG Sat Apr 28 02:27:58 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DFDCB106564A for ; Sat, 28 Apr 2012 02:27:57 +0000 (UTC) (envelope-from fbsd8@a1poweruser.com) Received: from mail-03.name-services.com (mail-03.name-services.com [69.64.155.195]) by mx1.freebsd.org (Postfix) with ESMTP id 313168FC0A for ; Sat, 28 Apr 2012 02:27:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; q=dns/txt; s=DKIM-NAME-SERVICES; d=a1poweruser.com; h=From:To:Cc:Subject:Message-ID:X-Sender:X-Envelope-From; l=500; bh=myLybDkuPob5rB2ebX/U7+47frcH8GH8MlVeydALjnM=; b=FAFXBlm+M38uSFmEFL8pNWalPsl5qZ65Jhm53yf3MOxaLftMSX6vOWsRQOv8+g9izU7jKo2qAQsMVIO1d7GOM6NhaK4jIen18I0JF8IzCZdPx9fJJbehGfKRPUmHLiPMycNdxRUYm7pkOAefiO3OzmhiVqmsXdW84AlATNLp/2Q= Received: from [10.0.10.1] ([173.88.208.155]) by mail-03.name-services.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 27 Apr 2012 19:26:52 -0700 Message-ID: <4F9B5571.3040808@a1poweruser.com> Date: Fri, 27 Apr 2012 22:26:57 -0400 From: Fbsd8 User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: Frank Staals References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 28 Apr 2012 02:26:52.0372 (UTC) FILETIME=[5F4F4140:01CD24E6] X-Sender: fbsd8@a1poweruser.com X-Authenticated-Sender: fbsd8@a1poweruser.com X-EchoSenderHash: [fbsd8]-[a1poweruser*com] X-Envelope-From: fbsd8*a1poweruser.com Cc: FreeBSD-Questions Subject: Re: Synchronising jails X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Apr 2012 02:27:58 -0000 Frank Staals wrote: > Hey Everyone, > > I'm looking for a way to synchronise two jails. More specifically, I > would like to keep/maintain an exact copy of a given jail. As an > example: Suppose I build a jail A on some system (in my particular case > build with ezjail) , and I copy the jail > into jail B on some other system (using tar, as is mentioned > here: http://forums.freebsd.org/showthread.php?t=17813). Now stuff > happens in Jail A, e.g. files change, new stuff is installed etc. I > would like to propagate these changes to jail B, but since the transfer > is over WAN I would like not to have to copy the entire jail again, just > the stuff that has changed since the last backup. It is safe to assume > nothing in Jail B changes: I basically want to maintain the exact copy > so if something would happen to the system running Jail A I can > immediately switch to jail B without much hassle. > > Normally I would say this a perfect use case for rsync. But as the > aforementioned thread mentions ``scp or similar wont work to copy a > jail'', and I consider rsync similar to scp, I am under the impression > that rsync would not be usable in this situation. Can anyone shed some > light on this, or suggest an alternative to synchronise the jails? > > > Regards, > I have 3 different ideas that would work. Method 1. move changes to basejail. Use qjail to create your hosta-jaila and hostb-jaila. Qjail has a bkup function that you can backup the hosta-jaila basejail in compressed dump format and move that file to hostb any way you want and then use qjail restore function to restore that dump file to hostb-jaila basejail. bkuping up basejail takes less than one minute. method 2. move user data changes to jaila. create hosta-jaila and hosta-jailb both being the same. After changes to hosta-jaila run diff on hosta-jaila, hosta-jailb and them move the diff file to hostb and apply the diff to hostb-jaila. method 3. move user data changes to jaila. Use qjail to backup hosta-jaila and restore it to hostb-jaila. Backing up a jail takes less than 15 seconds. Note, Both hosta and hostb must be at same operating system version level. Ezjail also has function to bkup a jail but no way to bkup basejail. You can issue a "dump" command on the command line to create one after all jails are stopped. In my book rsync is the automated way to keep two live system in sync real time. Maybe overkill in something that is pretty much stable. If say hosta/jaila is running a mail server or a website that remote users enter info into, then rsync is the only solution.