From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1NNRmh-0004v2-UQ for garchives@archives.gentoo.org; Wed, 23 Dec 2009 14:01:52 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1E6CBE0807 for ; Wed, 23 Dec 2009 14:01:50 +0000 (UTC) Received: from mail.askja.de (mail.askja.de [83.137.103.136]) by pigeon.gentoo.org (Postfix) with ESMTP id A7715E06C1 for ; Wed, 23 Dec 2009 12:30:06 +0000 (UTC) Received: from static-87-79-89-40.netcologne.de ([87.79.89.40] helo=zone.wonkology.org) by mail.askja.de with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1NNQLt-0000fD-AU for gentoo-user@lists.gentoo.org; Wed, 23 Dec 2009 13:30:05 +0100 Received: from localhost (localhost [127.0.0.1]) (uid 1000) by zone.wonkology.org with local; Wed, 23 Dec 2009 13:30:01 +0100 id 00010DED.4B320D49.00004746 From: Alex Schuster To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Writing a bash script or thinking about it anyway. Date: Wed, 23 Dec 2009 13:29:59 +0100 User-Agent: KMail/1.12.4 (Linux/2.6.31-tuxonice_k8; KDE/4.3.4; i686; ; ) References: <4B303B5D.2060400@gmail.com> In-Reply-To: <4B303B5D.2060400@gmail.com> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200912231330.00014.wonko@wonkology.org> X-Archives-Salt: 9865ce32-42ff-4b41-8aa5-420137cbfa06 X-Archives-Hash: d8568f6f5584630e637a132e69de3132 Dale writes: > Me again. I'm thinking about writing a bash script that backs up my > /home directory. I found a guide but before I read all that stuff and > muddy up the waters, is this thing current and will it work fine with > the bash Gentoo uses? Links to a even better guide would be good too. > The guide I found is here: > > http://tldp.org/LDP/abs/html/ I learnt bash that way. And by reading the man page over and over again. And again. Now I have scripts > 100k in size, I had not expected that bash was so powerful. http://www.shelldorado.com/shelltips/ has some nice tips http://sayle.net/book/basics.htm#what_is_a_shell explains what a shell is, maybe that's something to browse first. But for the backup: I recommend rdiff-backup and rsnapshot, I use the former. Basically, it rsyncs a directory, but allows incremental backups, too. After the first backup, the backup directory looks exactly like the original directory, except for a 'rdiff-backup-data' folder containing additional information. When A drive went bad, I just renamed my 1st and 2nd drives LVM volume groups and rebooted, now my system ran on the backup drive. The next backups only back up files that have been modified, and save the compressed differences into the rsync-backup-data folder. rsnapshot works similar (but I did not use it yet). The main difference is that rsnapshot creates a whole directory for every backup, containing exactly the files as they were present at the time of backup. Files that stayed the same are not copied, but hard-linked so they take up no extra space. So, I would say, rsnapshot is more practical, at the expense of storage space. If you need a file from an older backup, juts look into the corresponding directory, it is there, just copy it over, no need to use a backup tool to restore stuff. If you want to save space, try rdiff-backup. But if you need a file not from the last backup, but from an earlier one, you need to extract it first with rsnapshot (No big deal, still). My backup script was written in bash of course. It has some targets like 'home', 'usr', 'opt' (backup this partition) and extras like 'src' (create .tbz2 files of /usr/src/linux-*), 'etc' (tar /etc) or 'kde' (tar ~/.kde*, I regularly do this before I save the session, because this often does not work). All my data is on LVM volumes, so when a partition is to be backed up, a LVM snapshot is created and used for the backup. So I can continue working in my home directory and change data during the backup. The script is here: http://wonkology.org/~wonko/tmp/backup Wonko