Backup your server

Learn how to backup your *nix box to an external harddrive (or tapedrive without much effort). I cover installation of the backup medium, using `dump`, restoring, and also backing up files from a remote server to an external harddrive.

To backup a Windows PC, read the article here.

Step 1: Get stuff ready
Step 2: Take a `dump`
Step 3: `restore
Step 4: Remote backups
Step 5: Automation

The FreeBSD Logo is a trademark of The FreeBSD Foundation and is used
by John Syrinek with the permission of The FreeBSD Foundation.
Remove these adsRemove these ads by Signing Up

Step 1: Get stuff ready

Before you make a backup, you need to have something to backup to. Tradionally, this has been tape drives; however, a (quality) external harddrive will work just fine. You don't HAVE to use an external harddrive, but with an external drive you have the convenience of being able to bring the harddrive home (or to some other off-site location).

I used a couple of Western Digital MyBook's. Circuit City had an 80% off sale on (select) external drives, and I got two 250GB drives for dirt cheap. In my experience, Western Digital has very high quality drives (meaning they last forever). This makes them great for a backup. If you're going to go through the hassle of backing something up, you don't want your backup medium crapping out on you.

OK, just like my other article, I'll be using FreeBSD®; however, most of the things I'll be covering can be done in any flavor of Linux, Unix, or BSD.

(Skip the next paragraph if you already have USB 2.0 support or aren't using an external USB drive)

The MyBooks are USB 2.0 drives. FreeBSD 5.4-STABLE doesn't have the EHCI driver (basically the thing that gives you USB 2.0) enabled by default. This is an easy fix, though some might think recompiling the kernel to be scary (it's not). If you're one of the overly cautious types, I recommend doing a backup BEFORE recompiling your kernel. USB 2.0 might not be enabled, but USB 1.1 still works. It's just much slower. To enable EHCI, read this page of the Handbook. You will probably also have to refer to this section of the Handbook which explains how to actually recompile the kernel.

If you're using an external drive, or even an internal drive, you will need to mount the drive before you can use it. This is done with the `mount` command, and is pretty straightforward. Here's mount's man page. If mount is complaining about not being able to determine the filesystem type, you'll probably need to format the drive. To do this, you will need to know the correct device to format. For me, it was /dev/da0, but for you it may be different. Consult your distro's documentation. After determining your which device your external HD is attached to, you will need to do the actual formatting of the drive (well, partition). If you need help partitioning your drive, just ask me. FreeBSD uses mkfs to create filesystems on partitions. Any type of filesystem will work, but I opted to use UFS because that's what FreeBSD uses by default. FAT32 is probably the most compatible with other operating systems, and Ext3 is what most Linux flavors are using nowdays (or atleast they did last time I used Linux).

So, I used this command to mount my drive: mount -t ufs /dev/da0 /backup

OK, you should have your backup medium ready to go. If not, just ask :)

Proceed to Step 2.

The mark FreeBSD is a registered trademark of The FreeBSD Foundation
and is used by John Syrinek with the permission of The FreeBSD Foundation.
Back up is good
clievers7 years ago
Interesting article. Always good when people post helpful solutions. Also another method is to use rsnapshot, which uses rsync. You can do daily's, weekly's, etc and have multiple backups. And with rsync, it only copies what has changed in a file, or a new file, etc and with two seperate backups if a file is identical it only stores one copy of that file, thus saving space. A little more advanced would be backuppc, also using rsync, it also has a web interface.
I have to second the recommendation for backuppc. You can backup via tar or rsync with linux boxes. Windows boxes you have to use samba (you can try rsync, but the cygwin version is hosed). It pools files, in other words it only keeps one copy of a file, for instance if you back up the /etc directory on two different linux boxes, chances are many of the files will be the same and it only keeps one copy. I have used it for over a year now. It's so cool to browse to a web page and restore a single accidentally deleted file in seconds.
Well I got my rsnapshot working and it's been running for almost a week. So far I'm impressed. It's very quick. I didn't want to use the advanced backuppc for my situation, rsnapshot seems to work fine. I wrote about my experience on my blog and forum.

Blog: Backing up computers with rsnapshot

Forum: How to back up computers with rsnapshot
Johntron (author)  clievers7 years ago
Great! Thanks for the links :)

Get More Out of Instructables

Already have an Account?


PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!