Date: Mon, 25 Jan 2016 11:05:34 +0000 From: Matthew Seaman <matthew@freebsd.org> To: freebsd-questions@freebsd.org Subject: Re: rolling backup Message-ID: <56A6017E.4020801@freebsd.org> In-Reply-To: <56A5F7FF.1050606@gmail.com> References: <56A5F7FF.1050606@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --LIRXnxtw2htWN2pPAQHiMSt98lX2J9nWb Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 --LIRXnxtw2htWN2pPAQHiMSt98lX2J9nWb Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCgAGBQJWpgF+AAoJEABRPxDgqeTn75UP/0/au433V3WjLeD5j1/c9ohu AM18Env3Gp+zWZnDPXb4us3VdI7WBIUCELsA2Nq6jPDBzG86W4sVqlhshhwyF+hJ /TljskU0jF6DaFQpiEhOvyEtYFPGs0WwI0bx954Pb/DPmEbERG8qPbeklpEiWDwe 8Zyz/DS4l76xT8951s1u1u+AXXYnzO4YTGtjqfkQAF6R1Nr0b8v1hs/SKp14k6pI rGDl6FUR9wIagQTP+NdBL5OeD70qaIOfoASRwEY+rn5E/kCkf0cWNDKMQz5IYBCL l42EUTnjahLP8p20vYMbtUXHPlvs6ELHl/KAYGw399QtYlXrt4an8F8C1FIxJ14m K/5WLvPrNms5iMoqilY/U72jGNBvoqQ4jBEf/wed8eFVoCqhAZhW0R6YXDXVb3Eb 9fhOXC2BDJdAKpbFgzy7qqr14qQOgkiYv2wMnqHiqFmdq6Cueh0t+FvoORItcVeL Oh0FCfVtbvZ8qcYaGi6QMVLTfeieo0iUgXtUfRP8k0+6YUjpFNmq6vaQu2gWGN6u jx69nCj0YgdKFVRNR5/xzxEroVOQndhZUAq7SYA3QLNrOasXuA+jJP8gHqwS/Vdt k40eg9vWTDVl1LzBre15RkABl+oeJwK65OUGjU5CKa6VRs3FWunGPARFPjP+ae4B 2666NBHXhdsO2sDwqGu/ =VY/r -----END PGP SIGNATURE----- --LIRXnxtw2htWN2pPAQHiMSt98lX2J9nWb--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?56A6017E.4020801>