[PLUG] Backing up with tar

MJang mike at mommabears.com
Sun Jul 23 15:23:15 UTC 2006


Comments and answers inline

On Sat, 2006-07-22 at 22:54 -0700, John Jason Jordan wrote:
snip
> I've got the command down to this (manually adding today's date to the
> filename): [Wait ... I bet I could automate that, right?]
> 
> tar -pczvf /media/usbdisk/backup_7_22_2006.tar.gz /home /etc
snip
> 
> But I have a few questions that google is not supplying answers for.

First, the popular option is rsync. If you back up frequently, it
overwrites only those files that have changed, saving a lot of t
> 
> 1) Does this command back up files that are open? In other words, had I
> better close all open programs and files before running it?
It should, to your last saved state. (i.e., you'll lose changes that
you're making after your last save)

> 2) The first time I ran it I did it as root (sudo), and then I noticed
> that the resulting archive was owned by root. This might not be very
> handy in case I need to access it as jjj. Any thoughts on this? The
> files are just personal stuff that I don't want to lose. We're not
> talking national defense archives here.

You should be fine - test a small bit of your backup. When you restore,
you should have file ownership by the original users and groups.

> 3) I have been trying to figure out relative path vs absolute path. 
snip

If you use relative path to backup, you need to be disciplined when you
restore, otherwise, you might end up with restored files
in /home/john/home/john directories.

> 4) I'm also trying to figure out how to make it incremental. My best
> guess is that I'm supposed to add -u to the command:

That's one reason why rsync is more popular. You can also rsync over
ssh, which makes it easier to back up securely.

> 5) Clearly I need to back up the entire /home folder. And I have read
> that /etc should be included as well. But are there other folders that
> I should include? How about the /boot folder?

In principle, if you're not backing up an entire hard drive, you need to
back up those files which you've changed personally.

If there's a crash, you can reinstall your version of Linux, and connect
to restore any additional updates (including kernel updates
to /boot). /home and /etc in general cover this. However, if you
recompile your own kernel (or have a dual-boot), backing up /boot is a
good idea.

> That's enough questions for one day. Now I need to go learn how to
> restore a file. 

Post again when you do.

Thanks,
Mike




More information about the PLUG mailing list