jelliott7593

Backing Up Linux

13 posts in this topic

I wanted to know the best and most efficient way of backing up a Linux box. I googled around and saw dd but I just wanted to know about any alternative ways out there. By the way I am running Debian 5 "Lenny".

0

Share this post


Link to post
Share on other sites

You can back up an entire disk with dd, but that's not very efficient. There are better backup schemes usually involving things like rsync. There's certainly no shortage of information on this subject, but your solution has to fit your needs. My needs are simple. I do manual backups to a network drive on another machine. That's it. My backup software is cp -r. Crude, but it does everything I need. Making an overblown backup sceme you'll get bored of in a few weeks and stop keeping up with won't do anyone any good at all.

(I just typed all that on the DSi o -screen keyboard, I'm getting pretty quick with it. I don't seem to have made many mistakes either.)

0

Share this post


Link to post
Share on other sites

What I was planning on doing was starting a netcat session between my Debian and my OpenBSD computers and backing it up and saving it over to the OpenBSD box. I like the "cp -r" idea, but do I just enter that and it backs everything up or do I need arguments of some type?

0

Share this post


Link to post
Share on other sites

When i wanna backup its usually only my home directory so i tar it up and stick it on my fileserver

sudo tar -cvzf /path/to/save.tgz ~/

0

Share this post


Link to post
Share on other sites

I prefer tarring over a simple recursive copy. Unless you only want a single instance of a backup at a time, why recreate the thousands of files/directories? It also makes the end product faster to move (ie. onto a USB stick).

What I was planning on doing was starting a netcat session between my Debian and my OpenBSD computers and backing it up and saving it over to the OpenBSD box. I like the "cp -r" idea, but do I just enter that and it backs everything up or do I need arguments of some type?

cp -r /path/to/copy/from /path/to/copy/to

I just use SFTP to transfer files between my two Linux machines at work, but if they're local you could use NFS - it's more convenient once set up.

Edited by Seal
0

Share this post


Link to post
Share on other sites

You can tar directly over the network without having to save a file on the local machine at all. Just do something like tar cz ~/stuff | ssh user@server tee backup_may3.tar.gz >/dev/null. There's a better way to write to a file without using tee and piping to null, but I can't remember it right now.

0

Share this post


Link to post
Share on other sites

Kinda of a dumb question - but does anyone try incremental backup instead of always copying unchanged files and directories?

0

Share this post


Link to post
Share on other sites
Kinda of a dumb question - but does anyone try incremental backup instead of always copying unchanged files and directories?

This is what rsync does.

0

Share this post


Link to post
Share on other sites

Has anyone ever tried one of the disk image systems like Norton Ghost or Acronis TrueImage on Linux? I have Acronis TrueImage 2009 for Windows, and it's truly a kickass imaging tool. I only have one working computer at present, though, and I really don't want to screw it up playing around with Acronis. So, I figured I'd ask you guys first to see if disk imaging a Linux system works as well as a Windows system. I know some parts of Linux file system aren't really files at all (like proc), so could that screw it up?

EDIT: Been googling around on this, and rsync keeps coming up as best way to do linux backups. Many are hacks, but relatively simple hacks. I've tried SBackup and it monumentally failed. So, this leaves rsync, dd and Acronis as potential options.

Edited by army_of_one
0

Share this post


Link to post
Share on other sites

The virtual filesystems like /proc, /sys and (on some systems) /tmp are generated "on the fly" and won't be effected by restoring from a disk image.

There's no reason disk images won't work. There might be problems if the imaging software tries to be too smart and exclude portions of the disk where there are no files. If the imaging software doesn't fully understand the filesystem it may damage some files and things like the journal.

Disk imaging is good for when you've just installed an OS and you want an easy "factory restore", but it's not a terribly good data backup plan. Using cp or tar to copy files, or rsync to do incremental backups to another computer or second hatrd drive is both handier and more efficient.

0

Share this post


Link to post
Share on other sites

Your choice of software really depends on what type of data you are backing up, ie you don't want to be backing up the on disk files of a MySQL database whilst the DB is 'live' as it can lead to a corrupted image (as the files may change in the time taken to backup). In this case you can do things like snap-shotting a LVM partion.

For general file backup, I like rsnapshot which uses a combination of rsync and hard links to create a series of snapshots spaced by configured timing. The use of hardlinks means that the backed up directory takes only a little more space than the amount of changed data since the last snapshot, but still each snapshot appears to be the full file store when you browse through it.

See

http://rsnapshot.org/

If you are placing sensitive data onto optical disk, tape or a remote store you might want to ensure that it is encrypted. There is a handy hack with 'encfs' (FUSE Encrypted filesystem) where the '--reverse' flag can be used to present a encrypted view/mount of a normal (un-encrypted) directory tree. Just 'mount' and Sync/Copy the encrypted view to disk/remote store (without having to do anything to the local store).

I've also use Unison (which is really a file synchronizer) to keep multiple data stores in sync. It has a CLI or GUI frontend and is cross platform.

Cheers,

Mungewell.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now