<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>tolaris.com &#187; backuppc</title>
	<atom:link href="http://www.tolaris.com/tag/backuppc/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tolaris.com</link>
	<description>When the going gets tough, the tough sniff packets.</description>
	<lastBuildDate>Tue, 24 Jan 2012 17:47:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Backing up your Android device with BackupPC</title>
		<link>http://www.tolaris.com/2011/06/13/backing-up-your-android-device-with-backuppc/</link>
		<comments>http://www.tolaris.com/2011/06/13/backing-up-your-android-device-with-backuppc/#comments</comments>
		<pubDate>Mon, 13 Jun 2011 22:42:40 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[backuppc]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=1399</guid>
		<description><![CDATA[I acquired an Android-based tablet a few weeks back. After the inevitable period of &#8220;new toy!&#8221; passed, I started looking into ways to safely archive my data. I already use BackupPC to backup to my PCs, so why not an Android tablet? I run CyanogenMod 7 on my tablet, which means I have root and [...]]]></description>
			<content:encoded><![CDATA[<p>I acquired an Android-based tablet a few weeks back. After the inevitable period of &#8220;new toy!&#8221; passed, I started looking into ways to safely archive my data. I already use BackupPC to backup to my PCs, so why not an Android tablet?</p>
<p><span id="more-1399"></span>I run <a href="http://www.cyanogenmod.com/">CyanogenMod 7</a> on my tablet, which means I have root and the rsync binary. I assume you do too. I also assume you have a working BackupPC installation, and are familiar using <a href="https://wiki.archlinux.org/index.php/SSH_Keys">SSH key authentication</a> and rsync as a BackupPC transfer method. If not, this is not the time to figure it out. Get it working on a normal Linux backup target first, then come back here.</p>
<p>First, install an SSH server on your Android device. I recommend you use <a href="https://market.android.com/details?id=com.teslacoilsw.quicksshd">QuickSSHd</a>, but <a href="https://market.android.com/details?id=berserker.android.apps.sshdroidpro">SSHDroidPro</a> works as well. QuickSSHd has a nicer GUI and can run quietly (without persistent notification) in the background. Both are paid apps.</p>
<p>Open QuickSSHd, check &#8220;Password&#8221;, and enter a password for your root user. Then find the device&#8217;s IP address (displayed in the app), and verify that you can SSH in. Assuming its IP address is 192.168.0.100:</p>
<p><code>ssh root@192.168.0.100</code></p>
<pre>QuickSSHD for Android
# </pre>
<p>Both QuickSSHd and SSHDroidPro are really just GUIs wrapped around dropbear, so you can (hopefully) trust the cryptography to be implemented correctly. Once you login, verify you have root access, and install your SSH keys.</p>
<pre># id
uid=0(root) gid=0(root) groups=0(root)
# pwd
/data/data/com.teslacoilsw.quicksshd/home
# umask 077
# mkdir .ssh
# cat > .ssh/authorized_keys</pre>
<p>Now paste in your SSH keys. I have one for myself, and one for my BackupPC server:</p>
<pre>ssh-rsa AAAABjkkgGSukkA....Yt/Ew== tyler@laptop
ssh-rsa AAAABAADsUXeWwh....wkq9F== backuppc@backup-server</pre>
<p>And press Ctrl-D to close the file. Finally, set them to be owned by the QuickSSHd app user. This varies between devices, so first find it:</p>
<pre># ls -la /data/data/com.teslacoilsw.quicksshd/home
drwxrwx--x    3 app_84   app_84        4096 Jun  2 12:10 .
drwxr-xr-x    7 app_84   app_84        4096 Jun  9 17:16 ..
drwxrwx--x    2 app_84   app_84        4096 May 29 20:36 .ssh</pre>
<p>Here the user is &#8220;app_84&#8243;, so:</p>
<p><code>chown app_84:app_84 .ssh/authorized_keys<br />
chmod 600 .ssh/authorized_keys</code></p>
<p>Now open QuickSSHd, check &#8220;Shared keys&#8221;, and uncheck &#8220;Password&#8221; (optional, for enhanced security). You should now see your SSH keys listed by comment in the main app window. If you didn&#8217;t change the ownership on the authorized_keys file, they&#8217;ll still work for login, but won&#8217;t be visible in the app.</p>
<p>In QuickSSHd, Menu / Settings, set the options &#8220;Keep Awake&#8221; to on, to prevent the phone from sleeping while clients are connected; &#8220;Start at Boot&#8221; to on; and &#8220;Show Notification&#8221; to off, so that SSH can run quietly in the background all the time. Contrary to popular belief, a background process on Android doesn&#8217;t necessarily consume battery time. A sleeping SSH server does nothing until something tries to connect to it. So your battery is safe, as long as you don&#8217;t have a script kiddie roommate, constantly brute-forcing SSH logins against your phone.</p>
<p>Now test that you can login from the &#8220;backuppc&#8221; user of your BackupPC server. If so, you&#8217;re ready to set up this device in BackupPC.</p>
<p>Create a new host, named for your Android device. In the device&#8217;s config, go the &#8220;Xfer&#8221; tab. Set:</p>
<ul>
<li>RsyncShareName = /</li>
<li>BackupFilesOnly = /data/, /mnt/asec/, /mnt/emmc/, and /mnt/sdcard/</li>
<li>RsyncClientPath = /system/xbin/rsync (may be specific to CyanogenMod, check from the shell first)</li>
<li>Optional: Any excludes for files you don&#8217;t need to back up. Here, I&#8217;ve set BackupFilesExclude to ignore Music and Videos, since I also have those files on my PC.
</li>
</ul>
<p>Here is my configuration:</p>
<p><a href="http://www.tolaris.com/blog/wp-content/uploads/2011/06/android-backuppc-config1.png"><img src="http://www.tolaris.com/blog/wp-content/uploads/2011/06/android-backuppc-config1.png" alt="BackupPC Xfer tab for Android device" title="BackupPC Xfer tab for Android device" width="539" height="431" class="alignnone size-full wp-image-1421" /></a></p>
<p>Why backup only those directories?</p>
<ul>
<li>/data/, for all installed applications&#8217; apk files and their configurations.</li>
<li>/mnt/asec/, for APP2SD-compatible apps&#8217; apk files.</li>
<li>/mnt/emmc/, because my tablet mounts additional internal storage there.</li>
<li>/mnt/sdcard/, for obvious reasons.</li>
</ul>
<p>Why not backup the root directory? Because it&#8217;s a rootfs, which is just tempfs. Even if you wanted to back it up, you can&#8217;t restore to it. You only need a few subdirectories.</p>
<p>Why not backup /system/? Because I haven&#8217;t remounted /system/ read-write, nor changed the firmware from the regular CyanogenMod install. For disaster recovery, I plan to reinstall CyanogenMod, then restore the lost apps and their configurations.</p>
<p>Once done with the Xfer settings, test it by starting a full backup of your Android device. If you get the dread &#8220;unable to read 4 bytes&#8221; message, check that your SSH authentication is actually working. My server ran the first full backup in 20 minutes, and now runs nightly in about one minute.</p>
<p>Aside: SSH logins on Android default to a minimal bourne-type shell. It has no colourisation and no tab-completion. If you plan on doing anything else from the command line, you may find it convenient to start <code>bash</code> immediately after login.</p>
<p><code>ssh -t root@192.168.0.100 'cd / ; echo ; bash'</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2011/06/13/backing-up-your-android-device-with-backuppc/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Maverick repo updates: BackupPC 3.2.0 added, Clementine removed</title>
		<link>http://www.tolaris.com/2010/12/31/maverick-repo-updates-backuppc-3-2-0-added-clementine-removed/</link>
		<comments>http://www.tolaris.com/2010/12/31/maverick-repo-updates-backuppc-3-2-0-added-clementine-removed/#comments</comments>
		<pubDate>Fri, 31 Dec 2010 16:23:16 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[backuppc]]></category>
		<category><![CDATA[maverick]]></category>
		<category><![CDATA[repo]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=1256</guid>
		<description><![CDATA[Update 2011-08-06: BackupPC has been removed from the repo. A newer release is available in maverick-backports. Minor updates to the repo for Ubuntu 10.10 Maverick Meerkat: BackupPC 3.2.0 has been added. This is the same package from Debian Sid, and works on Lucid as well. I don&#8217;t recommend a non-LTS release for your backup solution, [...]]]></description>
			<content:encoded><![CDATA[<p><em>Update 2011-08-06: BackupPC has been removed from the repo. A newer release is available in maverick-backports.</em></p>
<p>Minor updates to the <a href="http://www.tolaris.com/apt-repository/">repo</a> for Ubuntu 10.10 Maverick Meerkat:</p>
<ul>
<li>BackupPC 3.2.0 has been added. This is the same package from Debian Sid, and works on Lucid as well. I don&#8217;t recommend a non-LTS release for your backup solution, but if your hardware requires a newer kernel, you might need this. I&#8217;ve tested it myself.</li>
<li>Clementine 0.5.3 has been removed. You can now find a newer release in <a href="http://packages.ubuntu.com/maverick-backports/clementine">maverick-backports</a>.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2010/12/31/maverick-repo-updates-backuppc-3-2-0-added-clementine-removed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BackupPC 3.2.0 now in repository, &#8220;Download ZIP archive&#8221; fixed</title>
		<link>http://www.tolaris.com/2010/10/21/backuppc-3-2-0-now-in-repository-download-zip-archive-fixed/</link>
		<comments>http://www.tolaris.com/2010/10/21/backuppc-3-2-0-now-in-repository-download-zip-archive-fixed/#comments</comments>
		<pubDate>Thu, 21 Oct 2010 16:56:19 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[backuppc]]></category>
		<category><![CDATA[hardy]]></category>
		<category><![CDATA[lucid]]></category>
		<category><![CDATA[repo]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=1187</guid>
		<description><![CDATA[Update 2011-08-06: BackupPC has been removed from the repo. A newer release is available in lucid-backports. BackupPC 3.2.0 is now in the repository for both Ubuntu Lucid and Hardy. The Lucid version is taken directly from Debian sid. The Hardy version is backported from the same package, with edits to make the graphs&#8217; fonts work [...]]]></description>
			<content:encoded><![CDATA[<p><em>Update 2011-08-06: BackupPC has been removed from the repo. A newer release is available in lucid-backports.</em></p>
<p>BackupPC 3.2.0 is now in the <a href="http://www.tolaris.com/apt-repository">repository</a> for both Ubuntu Lucid and Hardy. The Lucid version is taken directly from Debian sid. The Hardy version is backported from the same package, with edits to make the graphs&#8217; fonts work (older rrdtool on hardy) and depend on samba-common instead of samba-common-bin (changed after hardy).</p>
<p>This version fixes the <a href="http://www.tolaris.com/2010/07/21/fixing-backuppcs-download-zip-archive-restore-option-in-ubuntu-lucid/">&#8220;Download Zip archive&#8221; issue</a> in Ubuntu lucid. You no longer have to manually install an older Archive::Zip Perl module.</p>
<p>It&#8217;s also got a shiny new favicon, courtesy yours truly. That was a hard 10 minutes&#8217; work with <a href="http://www.gimp.org/">GIMP</a>, right there. Astute readers of changelogs may believe that the developers didn&#8217;t use the favicon I submitted. But according to md5sum they did, and that is <em>awesome</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2010/10/21/backuppc-3-2-0-now-in-repository-download-zip-archive-fixed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>rrdtool: This RRD was created on other architecture</title>
		<link>http://www.tolaris.com/2010/09/06/rrdtool-this-rrd-was-created-on-other-architecture/</link>
		<comments>http://www.tolaris.com/2010/09/06/rrdtool-this-rrd-was-created-on-other-architecture/#comments</comments>
		<pubDate>Mon, 06 Sep 2010 20:17:40 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[amd64]]></category>
		<category><![CDATA[backuppc]]></category>
		<category><![CDATA[cacti]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=1150</guid>
		<description><![CDATA[I use a number of open-source tools that rely on rrdtool to generate graphs. Cacti uses it for its core functionality. BackupPC uses it to graph storage pool usage over time. Unfortunately, the files it generates are architecture-dependent. This means that if you upgrade your BackupPC server from i386 to amd64, your pool graphs will [...]]]></description>
			<content:encoded><![CDATA[<p>I use a number of open-source tools that rely on <a href="http://oss.oetiker.ch/rrdtool/">rrdtool</a> to generate graphs. <a href="http://www.cacti.net/">Cacti</a> uses it for its core functionality. <a href="http://backuppc.sourceforge.net/">BackupPC</a> uses it to graph storage pool usage over time. Unfortunately, the files it generates are <a href="http://oss.oetiker.ch/mrtg/nable-mrtg.en.html#nabble-td5444154">architecture-dependent</a>. This means that if you upgrade your BackupPC server from i386 to amd64, your pool graphs will mysteriously disappear. Shall we fix that?</p>
<p><span id="more-1150"></span>This problem is easy to verify. Login to your server and inspect one of its RRD files.</p>
<pre>root@backuppc:~# cd /var/lib/backuppc/log
root@backuppc:/var/lib/backuppc/log# rrdtool info pool.rrd
ERROR: This RRD was created on other architecture</pre>
<p>To correct it, export the RRD files to XML format <em>before</em> <a name="comment1_src" href="#comment1">*</a> upgrading the server:</p>
<pre>rrdtool dump pool.rrd > pool.xml</pre>
<p><a name="comment1" href="#comment1_src">*</a> What if you&#8217;ve already upgraded? You can use any other server with the same architecture. Just copy your RRD files to it and run the same commands there.</p>
<p>After upgrading, import your XML files into the new RRD format:</p>
<pre>rrdtool restore -f pool.xml pool.rrd</pre>
<p>The above example is for BackupPC, but these commands work for any RRD file. If you have a lot of files (such as on a Cacti server), here is a handy loop:</p>
<pre>for i in *.rrd; do rrdtool dump $i > $i.xml ; done</pre>
<p>And another for restoring:</p>
<pre>for i in *.xml; do rrdtool restore -f $i `basename $i .xml`.rrd ; done</pre>
<p>Don&#8217;t forget to set expected file ownership and permissions (<code>chown --reference</code> and <code>chmod --reference</code> are your friends), and remove the XML files afterward.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2010/09/06/rrdtool-this-rrd-was-created-on-other-architecture/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing BackupPC&#8217;s &#8220;Download Zip archive&#8221; restore option in Ubuntu Lucid</title>
		<link>http://www.tolaris.com/2010/07/21/fixing-backuppcs-download-zip-archive-restore-option-in-ubuntu-lucid/</link>
		<comments>http://www.tolaris.com/2010/07/21/fixing-backuppcs-download-zip-archive-restore-option-in-ubuntu-lucid/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 19:39:47 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[backuppc]]></category>
		<category><![CDATA[lucid]]></category>
		<category><![CDATA[repo]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=949</guid>
		<description><![CDATA[We recently upgraded our BackupPC servers to Ubuntu 10.04 Lucid Lynx. It&#8217;s working almost perfectly. However, the &#8220;Download ZIP archive&#8221; restore option no longer works. This is due to a bug in recent version of the Archive::Zip Perl module which generates corrupt ZIP archives. Note to developers: when releasing new versions of your library, try [...]]]></description>
			<content:encoded><![CDATA[<p>We recently upgraded our BackupPC servers to Ubuntu 10.04 Lucid Lynx. It&#8217;s working almost perfectly. However, the &#8220;Download ZIP archive&#8221; restore option <a href="http://sourceforge.net/mailarchive/message.php?msg_name=4BE98532.4070001%40mail.ru">no longer works</a>. This is due to a bug in recent version of the Archive::Zip Perl module which generates corrupt ZIP archives.</p>
<p><span id="more-949"></span>Note to developers: when releasing new versions of your library, try to avoid breaking its <em>core functionality</em>.</p>
<p>If you try decompressing a corrupted file, you&#8217;ll see a message like this:</p>
<pre>tyler@laptop:~$ unzip restore.zip
Archive:  restore.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of restore.zip or
        restore.zip.zip, and cannot find restore.zip.ZIP, period.</pre>
<p>I posted a solution on the mailing list. I&#8217;ve since uploaded an older version (1.18-1) of this package to <a href="http://www.tolaris.com/apt-repository">my repository</a>, so the process is even more streamlined.</p>
<p>If you are using my repo:<br />
<code>apt-get install libarchive-zip-perl=1.18-1<br />
echo "libarchive-zip-perl hold" | dpkg --set-selections</code></p>
<p>If you aren&#8217;t using my repo but want a quick fix:<br />
<code>wget http://www.tolaris.com/apt/pool/main/liba/libarchive-zip-perl/libarchive-zip-perl_1.18-1_all.deb<br />
dpkg -i libarchive-zip-perl_1.18-1_all.deb<br />
echo "libarchive-zip-perl hold" | dpkg --set-selections</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2010/07/21/fixing-backuppcs-download-zip-archive-restore-option-in-ubuntu-lucid/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Moving an existing BackupPC partition to LVM</title>
		<link>http://www.tolaris.com/2010/05/06/moving-an-existing-backuppc-partition-to-lvm/</link>
		<comments>http://www.tolaris.com/2010/05/06/moving-an-existing-backuppc-partition-to-lvm/#comments</comments>
		<pubDate>Thu, 06 May 2010 20:39:42 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[backuppc]]></category>
		<category><![CDATA[lvm]]></category>
		<category><![CDATA[screen]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=796</guid>
		<description><![CDATA[I recently discussed how to use LVM to make a live copy of a BackupPC pool. That guide covers how to set up LVM on a new server with no data. But what if you already have a working BackupPC install, and you want to move your existing pool to LVM? I wrote a post [...]]]></description>
			<content:encoded><![CDATA[<p>I <a href="http://www.tolaris.com/2010/04/23/using-lvm-to-make-a-live-copy-of-a-backuppc-pool/">recently</a> discussed how to use LVM to make a live copy of a BackupPC pool. That guide covers how to set up LVM on a new server with no data. But what if you already have a working BackupPC install, and you want to move your existing pool to LVM?</p>
<p><span id="more-796"></span>I wrote a post 18 months ago on <a href="http://www.tolaris.com/2008/10/01/moving-your-linux-root-partition-to-raid/">moving a Linux root partition to software RAID</a>. Moving to LVM shares a lot of the same problems. The differences are:</p>
<ul>
<li>We&#8217;re not touching the root (or /boot) filesystem. Therefore we don&#8217;t have to deal with BIOS or GRUB. In fact, this entire process can be done without rebooting.</li>
<li>We must copy the filesystem bit-for-bit instead of using file-aware tools like rsync, cp, or tar. This is due to the design of the BackupPC storage pool.</li>
</ul>
<p>If you have another disk to use as a swap space, this problem is easy to solve. Simply unmount your backuppc partition and use dd to clone the data to the new drive. Then make create a logical volume on the old partition and copy it back.</p>
<p>If you don&#8217;t have another disk, you must convert the disk layout in place. The instructions in this post can be used to move any filesystem to LVM; just disregard the parts specific to BackupPC. I assume that your server&#8217;s drive and filesystem layout is as described in my <a href="http://www.tolaris.com/2010/04/23/using-lvm-to-make-a-live-copy-of-a-backuppc-pool/">last post</a>:</p>
<ul>
<li>/dev/sda provides the root filesystem (and possibly others). We&#8217;re not concerned about it here.</li>
<li>/dev/sdb is a RAID array with one partition. It does not yet use LVM, and contains an ext3 filesystem mounted on /var/lib/backuppc.</li>
</ul>
<p>The general plan is:</p>
<ol>
<li>Reduce filesystem usage on /var/lib/backuppc to 49% or less</li>
<li>Resize the filesystem and partition to 49%</li>
<li>Create a second partition and logical volume with the free space</li>
<li>Copy the filesystem to the logical volume</li>
<li>Add the first partition to the logical volume</li>
<li>Expand the logical volume and filesystem</li>
<li>Mount the logical volume</li>
</ol>
<p><strong>Warning:</strong> this is a multi-day process with many long delays for large data transfers. I&#8217;ll identify the delays as we go along. Never interrupt a filesystem operation unless you know exactly what you are doing. I recommend executing all long-running processes in a <a href="http://www.tolaris.com/2010/02/28/flying-without-a-net/">GNU screen</a> session in case your network connection is interrupted.</p>
<p><strong>Step 1: Reduce filesystem usage on /var/lib/backuppc to 49% or less</strong></p>
<p>If your BackupPC pool filesystem is larger than 49%, you must reduce disk usage.</p>
<ol>
<li>Remove old backups.  Reduce the BackupPC variables $Conf{FullKeepCnt} and $Conf{IncrKeepCnt} to keep fewer backups.  Alternately, use a script like <a href="http://sourceforge.net/apps/mediawiki/backuppc/index.php?title=How_to_delete_backups">BackupPC_deleteBackup.sh</a> to delete old ones manually.</li>
<li>Set $Conf{BackupPCNightlyPeriod} = 1</li>
<li>Wait for the next BackupPC_Nightly run. BackupPC will purge old backups and clean the pool of unnecessary files. This may take several days, but during this time you can perform backups as normal.</li>
</ol>
<p>Do not proceed until filesystem usage is below 49%. Verify this with <code>df</code>.</p>
<p><strong>Step 2: Resize the filesystem and partition to 49%</strong></p>
<p>You may wish to read <a href="http://www.howtoforge.com/linux_resizing_ext3_partitions">this guide</a> first. It is possible to use the parted &#8220;resize&#8221; function for this, but it doesn&#8217;t work for all filesystems. We&#8217;ll do it manually.</p>
<ol>
<li>Stop BackupPC. From this point no new backups will be kept until the entire process is finished, which may be several days.<br />
<code>/etc/init.d/backuppc stop</code></li>
<li>Unmount the partition<br />
<code>umount /var/lib/backuppc</code></li>
<li>Get the block size and block count for the partition, and calculate the new size in K.<br />
<code>tune2fs -l /dev/sdb1 | grep Block</code></p>
<pre>Block count:              2620595
Block size:               4096</pre>
<p>I&#8217;ve used a 10 GB partition in this example, and we now know that this filesystem consists of 2620595 blocks of 4K size. Calculate the new size as follows:</p>
<p><em>new size = (current size in blocks) * (block size in K) * 0.49</em></p>
<p>Round this number down. Our new size will be 2620595 * 4 * 0.49 = 5136366 K.</li>
<li>Check the filesystem. This may take several hours or days.<br />
<code>fsck -f /dev/sdb1</code></li>
<li>Resize the filesystem.<br />
<code>resize2fs /dev/sdb1 5136366K</code></p>
<pre>resize2fs 1.40.8 (13-Mar-2008)
Resizing the filesystem on /dev/sdb1 to 1284091 (4k) blocks.
The filesystem on /dev/sdb1 is now 1284091 blocks long.</pre>
</li>
<li>Resize the partition by deleting it and creating a new one of 5136366K.<br />
<code>fdisk /dev/sdb</code></p>
<pre>Command (m for help): p

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0005eeec

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1305    10482381   83  Linux

Command (m for help): d 1
Selected partition 1

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305): +5136366K

Command (m for help): p

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0005eeec

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         640     5140768+  83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.</pre>
</li>
</ol>
<p><strong>Step 3: Create a second partition and logical volume with the free space</strong></p>
<ol>
<li>If you haven&#8217;t already, install LVM.<br />
<code>apt-get install lvm2</code></li>
<li>Use fdisk again to create a second partition. You can combine this step with the last one. Hit enter at the prompts to use  all available space, and change the new partition to type 8e, Linux LVM.<br />
<code>fdisk /dev/sdb</code></p>
<pre>Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (641-1305, default 641):
Using default value 641
Last cylinder or +size or +sizeM or +sizeK (641-1305, default 1305):
Using default value 1305

Command (m for help): p

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0005eeec

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         640     5140768+  83  Linux
/dev/sdb2             641        1305     5341612+  83  Linux

Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 8e
Changed system type of partition 2 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0005eeec

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         640     5140768+  83  Linux
/dev/sdb2             641        1305     5341612+  8e  Linux LVM

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.</pre>
</li>
<li>The second partition must be equal to or larger than the first partition. If it is not, check your math or try resizing to a smaller percentage and try again.</li>
<li>Create a volume group and logical volume.<br />
<code>pvcreate /dev/sdb2<br />
vgcreate volgroup /dev/sdb2<br />
lvcreate -l 100%VG -n backuppc volgroup</code></li>
</ol>
<p><strong>Step 4: Copy the filesystem to the logical volume</strong></p>
<ol>
<li>Use dd, the sysadmin&#8217;s oldest friend, to copy the filesystem bit-for-bit from the old partition to the new. This may take several hours or days.<br />
<code>dd if=/dev/sdb1 of=/dev/volgroup/backuppc</code></li>
<li>If you get impatient during the copy, you can force dd to output the current progress. Find the process ID of the running dd, and send a USR1 signal.<br />
<code>ps -ef | grep dd</code></p>
<pre>root      4786  4642 26 15:44 pts/0    00:00:01 dd if /dev/sdb1 of /dev/volgroup/backuppc</pre>
<p><code>kill -USR1 4786</code></p>
<pre>18335302+0 records in
18335302+0 records out
9387674624 bytes (9.4 GB) copied, 34.6279 seconds, 271 MB/s</pre>
</li>
<li>A neater way to do this is:<br />
<code>dd if=/dev/sdb1 of=/dev/volgroup/backuppc &#038;<br />
pid=$!<br />
kill -USR1 $pid</code></li>
<li>When dd finishes you will see one last progress report which should total the size of /dev/sdb1.</li>
</ol>
<p><strong>Step 5: Add the first partition to the logical volume</strong></p>
<p>We&#8217;ve copied our data to the logical volume, so we no longer need the original partition. Add it to the volume group.</p>
<ol>
<li>Use fdisk to change partition 1 to type 8e.<br />
<code>fdisk /dev/sdb</code></p>
<pre>Command (m for help): p

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0005eeec

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         640     5140768+  83  Linux
/dev/sdb2             641        1305     5341612+  8e  Linux LVM

Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0005eeec

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         640     5140768+  8e  Linux LVM
/dev/sdb2             641        1305     5341612+  8e  Linux LVM

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.</pre>
</li>
<li>Add it to the volume group.<br />
<code>pvcreate /dev/sdb1<br />
vgextend volgroup /dev/sdb1</code></li>
</ol>
<p><strong>Step 6: Expand the logical volume and filesystem</strong></p>
<p>We&#8217;ve moved the data to a logical volume and added all the disk space to the volume group. Now we expand the logical volume and filesystem to use the available space.</p>
<ol>
<li>Extend the logical volume. I advise using only 75% so you can use LVM snapshots.<br />
<code>lvextend -l 75%VG /dev/volgroup/backuppc</code></li>
<li>Resize the filesystem to use the entire logical volume. This may take several hours or days.<br />
<code>resize2fs /dev/volgroup/backuppc</code></li>
<li>If at any point you&#8217;ve mounted the filesystem, you&#8217;ll have to run a new fsck before resizing. This will cause another long delay, so try to avoid it.</li>
</ol>
<p><strong>Step 7: Mount the logical volume</strong></p>
<p>We&#8217;re now ready to mount the new logical volume on /var/lib/backuppc and restart BackupPC.</p>
<ol>
<li>Edit /etc/fstab and replace any references to /dev/sdb1 with /dev/volgroup/backuppc. If your fstab uses UUIDs instead of explicit device paths, you shouldn&#8217;t have to change anything.</li>
<li>Mount the filesystem.<br />
<code>mount /var/lib/backuppc</code></li>
<li>Restart BackupPC<br />
<code>/etc/init.d/backuppc start</code></li>
</ol>
<p>You have successfully migrated to LVM!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2010/05/06/moving-an-existing-backuppc-partition-to-lvm/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Using LVM to make a live copy of a BackupPC pool</title>
		<link>http://www.tolaris.com/2010/04/23/using-lvm-to-make-a-live-copy-of-a-backuppc-pool/</link>
		<comments>http://www.tolaris.com/2010/04/23/using-lvm-to-make-a-live-copy-of-a-backuppc-pool/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 20:32:41 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[backuppc]]></category>
		<category><![CDATA[lvm]]></category>
		<category><![CDATA[raid]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=787</guid>
		<description><![CDATA[&#8220;How do I backup my BackupPC pool&#8221; is perhaps the most common topic of discussion on the backuppc-users mailing list. BackupPC stores all files in a common compressed pool (cpool, although I&#8217;ll use simply &#8220;pool&#8221; for this discussion), and maintains trees of hardlinks into the pool for each backup host. Therefore BackupPC requires a Linux/Unix [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;How do I backup my <a href="http://backuppc.sourceforge.net/">BackupPC</a> pool&#8221; is perhaps the most <a href="http://www.backupcentral.com/phpBB2/two-way-mirrors-of-external-mailing-lists-3/backuppc-21/backup-the-backuppc-pool-with-bacula-98217/?sid=f13fcfba7eafa7ee90702cf4eecf946f">common</a> <a href="http://www.experts-exchange.com/Storage/Backup_Restore/rSync/Q_24448762.html">topic</a> of <a href="http://www.mail-archive.com/bacula-users@lists.sourceforge.net/msg01324.html">discussion</a> on the <a href="https://lists.sourceforge.net/lists/listinfo/backuppc-users">backuppc-users</a> mailing list. BackupPC stores all files in a common compressed pool (cpool, although I&#8217;ll use simply &#8220;pool&#8221; for this discussion), and maintains trees of hardlinks into the pool for each backup host. Therefore BackupPC requires a Linux/Unix filesystem. If you want to back up the BackupPC server itself, you must duplicate the pool, and the hardlinks to it.</p>
<p><span id="more-787"></span>The problem with this design is that conventional duplication/archival tools like <code>rsync</code> and <code>tar</code> can&#8217;t be used to duplicate the cpool in a reasonable period of time. Any file with more than one hardlink must be tracked and restored correctly on the destination host or filesystem. Copying my 700 GB pool with rsync between two identical disks with rsync would take a minimum of 3 days. Copying the same amount of raw data would take only a few hours.</p>
<p>So we can&#8217;t use filesystem-aware tools to backup a BackupPC server&#8217;s pool. Instead, we must make a bit-for-bit copy of the disk image.</p>
<p>One suggestion I&#8217;ve seen is to make the cpool part of a RAID1 array of two disks. When you want to make a backup, pull one disk and replace it. Or make it a 3-disk mirror with a removable drive, and periodically swap it out and carry it elsewhere. This is a sound solution, but it is still <a href="http://en.wikipedia.org/wiki/Sneakernet">sneakernet</a>.</p>
<p>What I want is a solution that:</p>
<ol>
<li>Duplicates the entire BackupPC storage to a second server,</li>
<li>in a matter of hours not days,</li>
<li>over the network,</li>
<li>such that the secondary server can quickly replace the primary server if it fails,</li>
<li>without interrupting normal operations on the disk, including BackupPC itself.</li>
</ol>
<p>To accomplish this, we build the BackupPC storage on <a href="http://en.wikipedia.org/wiki/Logical_Volume_Manager_%28Linux%29">LVM</a>, and use LVM snapshots and netcat to copy the disk image.</p>
<p>My BackupPC server uses a 3ware hardware RAID card with two arrays:</p>
<ol>
<li>/dev/sda is a RAID1 of two disks, and provides the / and /var filesystems.</li>
<li>/dev/sdb is a RAID5 array of 5 disks, and provides the physical volume for the backuppc logical volume and filesystem</li>
</ol>
<p>The server&#8217;s filesystem looks like this:</p>
<pre>root@backuppc:~$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             9.2G  1.2G  8.0G  13% /
/dev/sda3              63G   21G   41G  34% /var
/dev/mapper/volgroup-backuppc
                      1.4T  711G  644G  53% /var/lib/backuppc</pre>
<p>If you&#8217;re planning to install BackupPC on a new server, this is easy to prepare. First, install the latest Ubuntu LTS server (I&#8217;m still using 8.04 &#8220;Hardy Heron&#8221;) on /dev/sda, using / and /var partitions as above. It is possible to configure LVM through the installer UI, but I&#8217;m not going to cover that here.</p>
<p>Once the base OS is installed, login via SSH and prepare the LVM setup. LVM is discussed in excellent detail elsewhere.  I strongly urge you to read <a href="http://www.howtoforge.com/linux_lvm">this How-To</a> and play with LVM a little before building the final system.</p>
<p>All commands are run as root.  Use sudo if you prefer.</p>
<ol>
<li>Create one partition of type 8e (Linux LVM) on the RAID disk.<br />
<code>fdisk /dev/sdb</code></p>
<pre>Command (m for help): o
Building a new DOS disklabel with disk identifier 0xf2704d76.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-243147, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-243147, default 243147):
Using default value 243147

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/sdb: 1999.9 GB, 1999957393408 bytes
255 heads, 63 sectors/track, 243147 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x92cf8945

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1          1      243147  1953078277   8e  Linux LVM

Command (m for help): w
The partition table has been altered!

Syncing disks.</pre>
</li>
<li>Prepare the physical volume and volume group.<br />
<code>pvcreate /dev/sdb1<br />
vgcreate volgroup /dev/sdb1</code></li>
<li>Create a logical volume which is 75% of the available space. We&#8217;ll reserve the remaining space for the snapshot.<br />
<code>lvcreate -l '75%VG' -n backuppc volgroup</code></li>
<li>Create a filesystem on the logical volume. Some prefer XFS, but I&#8217;m happy with ext3 (with an eye to upgrading to ext4 later).<br />
<code>mkfs.ext3 /dev/volgroup/backuppc</code></p>
<li>Add the new logical volume to /etc/fstab.<br />
<code>vi /etc/fstab</code><br />
Add a new line. We mount with the most efficient options since BackupPC doesn&#8217;t need them.</p>
<pre>/dev/volgroup/backuppc /var/lib/backuppc ext3 noatime 0 2</pre>
</li>
<li>Now mount it for the first time.<br />
<code>mkdir /var/lib/backuppc<br />
mount /var/lib/backuppc</code></li>
<li>Finally, install BackupPC. This will also install Apache2, Perl, and a mail server.<br />
<code>apt-get install backuppc</code></li>
</ol>
<p>You now have a working BackupPC system using LVM for storage. Now we create an LVM snapshot.</p>
<p>Why use LVM <a href="http://en.wikipedia.org/wiki/Snapshot_%28computer_storage%29">snapshots</a>?  Because we must take a copy of the filesystem as it exists at one moment in time. If we install directly on /dev/sdb1 and then try to copy the filesystem while it is mounted, the copy will be inconsistent.  Some data blocks will represent the time we started copying, others the time we ended, or anything in between. There is a disk performance penalty to using snapshots, as this creates a copy-on-write fork of the filesystem from the moment the snapshot is taken. The best practice is to create the snapshot when the server is idle, copy it to the secondary server, and then remove it immediately after.</p>
<p>Create the snapshot using all remaining free space.<br />
<code>lvcreate -l '100%free' -s -n backuppcsnapshot /dev/volgroup/backuppc</code></p>
<p>If you are curious, you can now mount the logical volume /dev/volgroup/backuppcsnapshot and compare the difference between it and the original filesystem. But we don&#8217;t need to do that. We just need to copy it to our secondary server.</p>
<p>The secondary server should be configured exactly like the first. At minimum, it must have a partition or logical volume that is the same size or greater than /dev/volgroup/backuppc on the primary server. To copy it, we&#8217;ll use <code>dd</code> and SSH.</p>
<p>I previously recommended using <a href="http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html">netcat</a> to perform this step. However, I&#8217;ve had a lot of difficulty getting cron, SSH, dd, and netcat to behave together when starting the listener on the destination server. I&#8217;ve also found that SSH is just as fast as using netcat, which is surprising given that encryption should be slower than transmitting the data in the clear.</p>
<p>Now we copy the data from primary to secondary via SSH. On the primary:<br />
<code>dd if=/dev/volgroup/backuppcsnapshot | ssh root@192.168.0.2 "dd of=/dev/volgroup/backuppc"</code></p>
<p>This reads the logical volume block for block and sends it to the secondary server on 192.168.0.2, via SSH.  The secondary server receives and writes it to the logical volume.</p>
<p>One advantage of using <code>dd</code> is that you can easily check progress:</p>
<pre>root@backuppc:~# ps -ef | grep dd
root      4958  4495  0 18:39 pts/0    00:00:03 dd if=/dev/volgroup/backuppcsnapshot
root@backuppc:~# kill -USR1 4958</pre>
<p>On the terminal where <code>dd</code> is running, you&#8217;ll see this.</p>
<pre>126689+0 records in
126689+0 records out
64864768 bytes (65 MB) copied, 9.97271 s, 6.5 MB/s</pre>
<p>You may wish to use <code>bzip</code> to compress the data after the first <code>dd</code> operation and decompress it before the second, or use <code>ssh -C</code>. Using compression will save bandwidth at the cost of CPU usage. In my tests, a raw copy gave sustained speeds of 200 mbit over gigabit Ethernet. Using bzip2, throughput was reduced to 20 mbit. Therefore I do not recommend using compression if copying over your own gigabit LAN.</p>
<p>As a last step, archive the BackupPC configuration whenever you clone the storage pool.  Since you don&#8217;t want the secondary to start running backups, put it in a safe place.  On the secondary:</p>
<p><code>mkdir /etc/backuppc/backup/</code></p>
<p>On the primary, after copying the snapshot:</p>
<p><code>rsync -av --delete /etc/backuppc/ root@192.168.0.2:/etc/backuppc/backup/</code></p>
<p>We now have a complete BackupPC server with LVM storage and a means of completely backing up to a secondary server, over the network, without interrupting the operation of the primary.  But what if you have an existing BackupPC pool directly on disk partition? You&#8217;ll need to migrate it to LVM without losing the data. I&#8217;ll discuss how to do that in my next post.</p>
<p><em>Updated 2010-09-17: removed directions for netcat and recommended SSH method.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2010/04/23/using-lvm-to-make-a-live-copy-of-a-backuppc-pool/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Replacing Bacula with BackupPC</title>
		<link>http://www.tolaris.com/2009/10/08/replacing-bacula-with-backuppc/</link>
		<comments>http://www.tolaris.com/2009/10/08/replacing-bacula-with-backuppc/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 22:26:42 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[backuppc]]></category>
		<category><![CDATA[bacula]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=456</guid>
		<description><![CDATA[We recently moved our primary backup machine to another location, and have overhauled a lot of our network infrastructure. This meant a lot of work updating the Bacula configurations on those machines. I&#8217;ve been unhappy with Bacula for some time, so I replaced it with BackupPC. Bacula is very complicated. That complication provides flexibility &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>We recently moved our primary backup machine to another location, and have overhauled a lot of our network infrastructure.  This meant a lot of work updating the <a href="http://www.bacula.org/">Bacula</a> configurations on those machines.  I&#8217;ve been unhappy with Bacula for some time, so I replaced it with <a href="http://backuppc.sourceforge.net/">BackupPC</a>.</p>
<p><span id="more-456"></span>Bacula is very complicated.  That complication provides flexibility &#8211; if you want your level-0 backups to run on Tuesdays at 1900 and Thursdays at 22:30, and to exclude some files on Wednesdays only, it can &#8211; but it also makes it brittle.  One daemon hangs for any reason, and half the backups never complete.  It scales well to very large enterprise sizes, but I don&#8217;t really need that yet.</p>
<p>What Bacula does really well is dump data to tape.  I don&#8217;t use tape.  I use a RAID array.  When you dump data to tape, you do it in series.  But when you dump data to disk, you can just as easily do it in parallel.  The process of calculating checksums and compressing files limits the rate at which you actually transfer those files to the backup store.  With most of my servers, that turns out to be about 20 mbit/sec at max.  But my servers are typically connected via gigabit LAN, so why not backup several at the same time?  Further, my backup window is limited to 12 hours at night so as to avoid affecting normal traffic during the day.  If you are running backups in series and one takes 4 hours, the other backups run the risk of pushing into the morning work hours.</p>
<p>How to install and configure BackupPC is already well documented <a href="http://www.howtoforge.com/linux_backuppc">elsewhere</a>.  Where my install differs is that we don&#8217;t run Windows, so we don&#8217;t have to deal with backing it up.  All of my defaults are configured to use rsync and expect Linux filesystems.</p>
<p>What BackupPC does really well is just back stuff up, to disk, whenever it can.  It is possible to force exactly when backups run, but in general the system isn&#8217;t designed that way.  I tried to force everything to kick off at 20:00 UTC nightly, and run until finished.  But by default, BackupPC is configured to try to backup every hour on the hour, and to run the next backup 24 hours after the last one finished.  I soon realised that it was best to do it that way.  When a server is down or the backup fails, BackupPC tries again every hour until it succeeds.  That is far more robust than &#8220;the backup failed last night, so we have to wait until next night&#8221;.</p>
<p>So what about not running backups during the day?  It can do that too.  You can specify exactly which hours to wake up and perform pending jobs:</p>
<pre>$Conf{WakeupSchedule} = [ '19', '20', '21', '22', '23', '0', '1', '2', '3', '4', '5', '6' ];</pre>
<p>But a better way is to run every hour anyway, and instead use blackout periods:</p>
<pre>$Conf{WakeupSchedule} = [ '12', '13', '14', '15', '16',
'17', '18', '19', '20', '21', '22', '23', '0', '1',
'2', '3', '4', '5', '6', '7', '8', '9', '10', '11' ];

$Conf{BlackoutBadPingLimit} = '3';
$Conf{BlackoutGoodCnt} = '7';
$Conf{BlackoutPeriods} = [ {
    'weekDays' => [ '0', '1', '2', '3', '4', '5', '6' ],
    'hourBegin' => '6.5'
    'hourEnd' => '18.5',
  } ];</pre>
<p>Now jobs run every hour.  But for any host that has stayed online for 7 days (tested by ping, where 3 are sent before declaring failure), backups will not start between 6:30 and 18:30.  Unfortunately all times are hours, so you must use decimal HH.HH instead of HH:MM.  You&#8217;ll only make a few mistakes before you get used to it.</p>
<p>The advantage to the blackout system is that it backs up a recently failed server within an hour of it coming online again, even during the day, while restricting backups of functioning servers to the later hours.  Servers just added to the system may also back up during the day because they don&#8217;t have 7 good pings yet.  The easy solution is to add new servers at night.  Backups tend to stay near to when they last ran, but can move within the normal job period.</p>
<p>While backup times can move around, every server is still backed up every 24 hours, at some point during the night.  Now that I&#8217;ve run this for 5 weeks, on 47 servers, I&#8217;m very pleased with it.  It has proven more reliable than Bacula, and the disk usage is far, far better.  BackupPC compresses and pools stored files, and uses hashes to determine if a file needs to be archived again.  If you have multiple copies of the same file, across all servers, you only have one on disk on the BackupPC server.  Backing up every copy of /usr/ suddenly makes no difference at all.  From the web interface:</p>
<pre>There are 47 hosts that have been backed up, for a total of:
    * 177 full backups of total size 1331.97GB (prior to pooling and compression),
    * 395 incr backups of total size 783.92GB (prior to pooling and compression).

Pool is 337.28GB comprising 4081543 files and 4369 directories (as of 2009-10-08 13:46),
Pool hashing gives 543 repeated files with longest chain 21,
Nightly cleanup removed 63257 files of size 37.75GB (around 2009-10-08 13:46),
Pool file system was recently at 29% (2009-10-08 21:25), today's max is 29% (2009-10-08 12:00)
and yesterday's max was 29%. </pre>
<div id="attachment_536" class="wp-caption alignnone" style="width: 697px"><a href="http://www.tolaris.com/blog/wp-content/uploads/2009/10/backuppc-pool.png"><img src="http://www.tolaris.com/blog/wp-content/uploads/2009/10/backuppc-pool.png" alt="BackupPC pool statistics" title="BackupPC pool statistics" width="687" height="185" class="size-full wp-image-536" /></a><p class="wp-caption-text">BackupPC pool statistics</p></div>
<p>That&#8217;s 5 weeks of weekly level-zeroes plus the last 14 daily incrementals.  The same data in Bacula for only 27 servers came to 900 GB.  BackupPC is configured to keep backups going back 5 months; at best I could only manage a month of Bacula backups for the same period.</p>
<p>What about data throughput?  Bacula topped out at about 20 mbit for even gigabit-connected hosts, and it could only run in serial (unless I configured multiple &#8220;storage devices&#8221; (directories), but there is no way to pool them for dynamic use.  Allowing only 3 simultaneous backups, the server routinely exceeds 60 mbit of traffic during the first hour of the run.</p>
<div id="attachment_525" class="wp-caption alignnone" style="width: 613px"><a href="http://www.tolaris.com/blog/wp-content/uploads/2009/10/backup.png"><img src="http://www.tolaris.com/blog/wp-content/uploads/2009/10/backup.png" alt="Network statistics" title="Network statistics" width="603" height="304" class="size-full wp-image-525" /></a><p class="wp-caption-text">Network statistics</p></div>
<p>Unfortunately I don&#8217;t have useful Cacti graphs from the time we ran Bacula, but it was at best 80% as fast for only one backup.  And of course it could run only one.</p>
<p>What else does BackupPC have over Bacula?</p>
<ul>
<li>A good web interface.  Yes, webacula exists, but you are still limited to editing config files and using an interactive terminal interface to do anything useful.  With BackupPC you can use any standards-compliant browser to review statistics and logs about recent backups, edit the config, browse backups in tree format and restore from them, and start additional backups outside of the normal schedule.  You can also grant users the ability to browse and schedule backups for specific servers or desktops, but not see any others.</li>
<li>Inline help.  When editing BackupPC&#8217;s config in the web GUI, all configuration variables are hyperlinks to the HTML documentation.</li>
<li>Several ways to restore.  You can directly restore file to the server by the same transport that you use to backup (rsync, ssh+tar, SMB).  You can also download a ZIP or tar.gz through your browser.</li>
<li>No database dependency.  The filesystem is the database.  Files are stored in disk trees, and logs are text on disk.  I&#8217;m not against using MySQL, but it adds one more point of failure.</li>
<li>No client daemon.  That&#8217;s right, nothing to install on the clients.  Just add the server&#8217;s SSH key to your root user, and rsync does the rest.  If you think that&#8217;s a security risk, it is.  Any other backup system has the same vulnerability.  I suggest using <a href="http://www.tolaris.com/2009/09/05/using-ssh-agent-and-setting-key-access-limits/">key access limits</a>.</li>
</ul>
<p>I&#8217;ve tested basic restores and bare-metal ones.  So far there are no issues with BackupPC, and I&#8217;m much happier using it.  It is simpler, less prone to failure, and less likely to require user intervention.  It may not scale to 100 distributed backup stores with tape drives, but it is excellent for the small-to-medium enterprise.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2009/10/08/replacing-bacula-with-backuppc/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>

