From owner-freebsd-questions@freebsd.org Mon Jan 25 10:25:05 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 B1663A45235 for ; Mon, 25 Jan 2016 10:25:05 +0000 (UTC) (envelope-from sergeig.public@gmail.com) Received: from mail-pa0-x234.google.com (mail-pa0-x234.google.com [IPv6:2607:f8b0:400e:c03::234]) (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 853D76B6 for ; Mon, 25 Jan 2016 10:25:05 +0000 (UTC) (envelope-from sergeig.public@gmail.com) Received: by mail-pa0-x234.google.com with SMTP id uo6so80497157pac.1 for ; Mon, 25 Jan 2016 02:25:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=to:from:subject:message-id:date:user-agent:mime-version :content-type:content-transfer-encoding; bh=F98dB58jP+cckL9Z81m0GqinDIvwJdxCNSws1Q0+DKU=; b=XvgPpHKETLJCmKWc/hojFe4mpxfLXT53zmLxvu/AsPhW5vtZpnEMi/0E5TY/v+WG0J DfF+LXMeA5qGMFAUMvH42w+8Zo2/trTZ+MnHRp7Is7+1aQ74pZDotQyxeUhYYLHuNT5A 0auMYJYrcnGcj/CzZ1QQLqL+W9o6uRcQXcBs3iqGXclN06yZZADLKxEaojGSqWjI+BZ9 tyepXnatMtzEeVXSuaVjNvSMLkdKzGiXQy3ZPYi5phVKIGzTrxq0v6HkYQikXx3IB/29 Ih0BHrp6m1ffux8kozyANTywlCP6jpYCNABSzymkCHeWcy2YFzLINPR8gOfZMS+g/Yg7 oFUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-type:content-transfer-encoding; bh=F98dB58jP+cckL9Z81m0GqinDIvwJdxCNSws1Q0+DKU=; b=l8hyrK0qZCmO+ojNJSi9gIJGL/xMbp52dkGAB2uTZns8g3HW0S4An29CtsUBsmx2AN jCuztkOaKfNygHlnLXF3hfPLi0ymhjYGek3iVd6PAn17AGsKD00kuFWXw8tuO1VExbon lQXMLsKW2hih8wsOrI+4npqZXuPoYkUKvjcJ8/Ns4jyifSbsg6j29GNLaB3u6L7xOJkY RzPe4jKxajzrwEjH8DDh8KxR47W9SjvMKNEajs7VMSGxS2C/vmDv3/ks7wJsYDCtfwH+ GbDh0KuiRW0VJp5ZUsUOdQV4scqmx0a3HxfRy+dJVTxYOllbGv2W7ageBCXp1tBWex9p cLrQ== X-Gm-Message-State: AG10YOSQJcAIac66DggwnStwSDavSmeqC8064N+Ietp/RJuvPMJxaE3A63IxQ14/bMGCMg== X-Received: by 10.66.102.97 with SMTP id fn1mr24977117pab.131.1453717505243; Mon, 25 Jan 2016 02:25:05 -0800 (PST) Received: from SergeiMBP.local (c-24-16-122-177.hsd1.wa.comcast.net. [24.16.122.177]) by smtp.googlemail.com with ESMTPSA id m87sm27457051pfi.47.2016.01.25.02.25.04 for (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Jan 2016 02:25:04 -0800 (PST) To: FreeBSD Questions From: Sergei G Subject: rolling backup Message-ID: <56A5F7FF.1050606@gmail.com> Date: Mon, 25 Jan 2016 02:25:03 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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 10:25:05 -0000 Is there any good application for maintaining a rolling backup of filesystem? 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? 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... Thanks Script I use: ---------- # Dump Options # -C32 is a cash in MB for snapthot based filesystems. Range is 0..32 # -b128 is number of KB per output block. It improves performance. # -0 is a full backup # -u update dump dates after successful dump # -n notify all operators in operator group # -a autosize is used for harddrives and other non-tape media # -L is a live file system; use /.snap directory # -h1 honor no_dump flag for backup level at or above specified number # -f file_name is write backup to a file_name; use - for STDOUT # # return values: # 0 - ok # 1 - startup errors # 3 - abnormal termination dump=/sbin/dump level=0 dumpargs=-C16 -b128 -$(level)unaL -h1 -f - dumpcmd=$(dump) $(dumpargs) bzip2=/usr/bin/bzip2 bzip2args=--best compress=$(bzip2) $(bzip2args) expr=/bin/expr now=`date +%Y-%m-%d` backupdir=/backup suffix=$(now)_$(level).dump.bz2 default: @cat dump.mak test: @echo level: $(level) @echo dumpargs: $(dumpargs) @echo compress: $(compress) @echo dumpcmd: $(dumpcmd) # http://milan.adamovsky.com/2010/06/freebsd-makefile-local-variables.html # .ifmake target # SOMEVAR=1 # .endif run: @echo Backing up / $(dumpcmd) / | $(compress) > $(backupdir)/root_$(suffix) @echo Backing up /var $(dumpcmd) /var | $(compress) > $(backupdir)/var_$(suffix) @echo Backing up /usr $(dumpcmd) /usr | $(compress) > $(backupdir)/usr_$(suffix) @echo Backing up /usr/jails $(dumpcmd) /usr/jails | $(compress) > $(backupdir)/jails_$(suffix)