From owner-freebsd-questions@freebsd.org Mon Jan 25 11:13:12 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 934D1A453D2 for ; Mon, 25 Jan 2016 11:13:12 +0000 (UTC) (envelope-from outbackdingo@gmail.com) Received: from mail-ob0-x22d.google.com (mail-ob0-x22d.google.com [IPv6:2607:f8b0:4003:c01::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5B78A813; Mon, 25 Jan 2016 11:13:12 +0000 (UTC) (envelope-from outbackdingo@gmail.com) Received: by mail-ob0-x22d.google.com with SMTP id is5so112941864obc.0; Mon, 25 Jan 2016 03:13:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=R/B0inQb/Hq5FINicCxsERgNkxbHuSpWwv8el0AWeGU=; b=jAYvHlp80ZvAxF7JzP5y2GZrxqxsfENnrDV2F3psw0LNLuNj8Rq6sXuwwcTC20H/8K iZHitq9dKPzjcz/Rian/h9JJmWVxoM5vMDKQNqPptpSK1DNLkrzvnkKWC/9kSXO8WDdi 6rcGwymj5G2d+0zz9bcUh8eb6Y+DVH8iwxxIArNJ7aiw71IYR0/gz+KF0hr2WBIepl+5 iZpjynBORpM2K1j2JvlByj3WpNCprAuYFgq5OYxRkzFBySxfGlmfLys4c7bXEjL0/YB1 fezY3/xBJLiHQskPCzxYpWSzn4XJlDd+rr1xluyWVPSJ+4kxQ35K1KCQ1FDsb3uIVTKV neUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=R/B0inQb/Hq5FINicCxsERgNkxbHuSpWwv8el0AWeGU=; b=DRiwckHjbBfHX3pkr98A4RqWtmgIsktDiGAx1XywW7vLLVurdUCEdH+5/7fYrcpFd4 x9wGdkhylIqV0TawiqfW46Pb4jZrna29vtnc9LQfEIr1/h85D9VI/MImxNC1NSSwyxSr MIk6EcAV4lanyOKClkhn/rJjXDK89exWf8uEe6F3sA0TEbGV5vMfQh2JK7zdQP68AR0H aV7intL30Z2nJ7h9JSVmFiY2zh2ELUXir0q7wDbldveQv3AhX1B7/5fJ5ypIU0CJgT72 hx1pFDnnZUbRIfiiwgt18w8Ky6oK8acgMXC400h1vX11AhFa9UkgoossjbimGIzQdD5T 0SJA== X-Gm-Message-State: AG10YOQ3XV1nAC6FwFy2a9v4w5JgAJOdoejVy5b9uccrXFlYwYjmZHWBTyYCTmrZVz7+D65bFmvy55kIUsLVPA== X-Received: by 10.182.79.131 with SMTP id j3mr13311926obx.46.1453720391604; Mon, 25 Jan 2016 03:13:11 -0800 (PST) MIME-Version: 1.0 Received: by 10.202.72.197 with HTTP; Mon, 25 Jan 2016 03:12:32 -0800 (PST) In-Reply-To: <56A6017E.4020801@freebsd.org> References: <56A5F7FF.1050606@gmail.com> <56A6017E.4020801@freebsd.org> From: Outback Dingo Date: Mon, 25 Jan 2016 12:12:32 +0100 Message-ID: Subject: Re: rolling backup To: Matthew Seaman Cc: freebsd-questions@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jan 2016 11:13:12 -0000 On Mon, Jan 25, 2016 at 12:05 PM, Matthew Seaman wrote: > On 01/25/16 10:25, Sergei G wrote: > > Is there any good application for maintaining a rolling backup of > > filesystem? > > There are several alternatives here, but the standout application > for system backups is bacula. > > However I suspect that this will be way overkill for your purposes -- > it's designed to backup whole networks of machines and needs its own > RDBMS in order to track backup state. > > The trouble with backup software is that there is such a wide range of > requirements over all the different possible users that once you've > written a piece of software that is sufficiently flexible to support > just about any common usage (and do and the management of archiving, > backup cycling, indexing, restores etc. etc.) you will end up with a > behemoth. > > If you want a small and neat script that does exactly what you want, > then your best approach is to write it yourself. > > > I wrote this simple Makefile that's called from a periodic scripts to > > maintain backups. However, over time it will run out of space. The > > solution would be to have the same backup reusing file names using a > > rolling backup scheme. Is there a project that can do that already? > > Hmmm.... is there any particular reason to use make(1) here? You don't > appear to be utilizing any of the special features of make such as > creating an output file dependant on the ages of any input files. It's > not that it's wrong to use make(1) like that, but it would be more usual > to write that as a shell script. Probably slightly faster too, but I > expect the overhead from make(1) is lost in the noise compared to how > long it takes to run dump. > > > In rolling backup I would be using parts of the date output (date -j > > +"%Y-%m-%d %H:%M:%S") and a mod operation to roll the number. I just > > don't have time to spend on it... > > Actually, I think your best bet is a small extension to your backup > script that just deletes all but the last N copies of the backup for a > particular filesystem. Something like: > > ls -1t $(backupdir)/root_* | sed -e "1,$(N)d" | xargs rm > > Deleting 'all but the last N' is a good strategy with backups. Suppose > for whatever reason, backup fails for N nights in a row. If you just > deleted backup files that were over N days old, you'ld be left without > any backups at all after a certain time. However, keeping a certain > number of files means that you still have some backups available, albeit > older than would be ideal. > > Cheers, > > Matthew > > Even rclone or restic are great for backups also..... https://restic.github.io/ http://rclone.org/