Unix Programming - How to use tar to do increamental backup

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > January 2004 > How to use tar to do increamental backup





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author How to use tar to do increamental backup
Steven

2004-01-23, 5:01 pm

I am new in unix/linux. Now I need to know how to use tar to do
increamental backup of my system. specifically I have the following
questions:

1. Looking at the man page, it seems to have options like -d
(difference), -u (update: which append the updated files to archive
file), and -g, and -G. But I am not really sure which one to use for
increamental backup. I tried -u, but it seem to still back up the
whole things (not changed files only).

2. In order not to overwrite the current archive file, do I have to
change archive file name everytime I start to do increamental backup?
e.g if I have a fullback called backupweend, do I have to chagne name
to backupmon, backuptue if I do increamental backup on monday and
tuesday? If yes, that means I have to write a script to do automatic
backup?

3. If I tar the root filesystem "/", will all the filesystem mounted
to it be backup too. If I have a storage system mounted as "/share",
then the backup will include all the contents in "/share"? Is there a
option not to include?

Thanks for your help,

Steven
phn@icke-reklam.ipsec.nu

2004-01-23, 5:01 pm

In comp.unix.misc Steven <yuezhan.zhu@medicinenet.com> wrote:
quote:

> I am new in unix/linux. Now I need to know how to use tar to do
> increamental backup of my system. specifically I have the following
> questions:


quote:

> 1. Looking at the man page, it seems to have options like -d
> (difference), -u (update: which append the updated files to archive
> file), and -g, and -G. But I am not really sure which one to use for
> increamental backup. I tried -u, but it seem to still back up the
> whole things (not changed files only).


quote:

> 2. In order not to overwrite the current archive file, do I have to
> change archive file name everytime I start to do increamental backup?
> e.g if I have a fullback called backupweend, do I have to chagne name
> to backupmon, backuptue if I do increamental backup on monday and
> tuesday? If yes, that means I have to write a script to do automatic
> backup?


quote:

> 3. If I tar the root filesystem "/", will all the filesystem mounted
> to it be backup too. If I have a storage system mounted as "/share",
> then the backup will include all the contents in "/share"? Is there a
> option not to include?


quote:

> Thanks for your help,


quote:

> Steven



Don't confuse backup with archiving.

Tar is a archive/exchange format. Backup is done with other tools,
dump is one of them. And dump will of course make true incremental
backuo(and restore) possible.

--
Peter Håkanson
IPSec Sverige ( At Gothenburg Riverside )
Sorry about my e-mail address, but i'm trying to keep spam out,
remove "icke-reklam" if you feel for mailing me. Thanx.
zentara

2004-01-23, 5:01 pm

On 27 Nov 2003 22:11:26 -0800, yuezhan.zhu@medicinenet.com (Steven)
wrote:
quote:

>I am new in unix/linux. Now I need to know how to use tar to do
>increamental backup of my system. specifically I have the following
>questions:
>
>1. Looking at the man page, it seems to have options like -d
>(difference), -u (update: which append the updated files to archive
>file), and -g, and -G. But I am not really sure which one to use for
>increamental backup. I tried -u, but it seem to still back up the
>whole things (not changed files only).
>
>2. In order not to overwrite the current archive file, do I have to
>change archive file name everytime I start to do increamental backup?
>e.g if I have a fullback called backupweend, do I have to chagne name
>to backupmon, backuptue if I do increamental backup on monday and
>tuesday? If yes, that means I have to write a script to do automatic
>backup?
>
>3. If I tar the root filesystem "/", will all the filesystem mounted
>to it be backup too. If I have a storage system mounted as "/share",
>then the backup will include all the contents in "/share"? Is there a
>option not to include?
>
>Thanks for your help,



You should look at dar, http://dar.linux.free.fr/

It has a nice tutorial, and explains how to make
incremental backups. You have to read thru a few
docs, but it is well worth it. You're backup problems
will be solved. You can do all the things you mention
above.



--
When life conspires against you, and no longer floats your boat,
Don't waste your time with crying, just get on your back and float.
zentara

2004-01-23, 5:01 pm

On 27 Nov 2003 22:11:26 -0800, yuezhan.zhu@medicinenet.com (Steven)
wrote:
quote:

>I am new in unix/linux. Now I need to know how to use tar to do
>increamental backup of my system. specifically I have the following
>questions:
>
>1. Looking at the man page, it seems to have options like -d
>(difference), -u (update: which append the updated files to archive
>file), and -g, and -G. But I am not really sure which one to use for
>increamental backup. I tried -u, but it seem to still back up the
>whole things (not changed files only).
>
>2. In order not to overwrite the current archive file, do I have to
>change archive file name everytime I start to do increamental backup?
>e.g if I have a fullback called backupweend, do I have to chagne name
>to backupmon, backuptue if I do increamental backup on monday and
>tuesday? If yes, that means I have to write a script to do automatic
>backup?
>
>3. If I tar the root filesystem "/", will all the filesystem mounted
>to it be backup too. If I have a storage system mounted as "/share",
>then the backup will include all the contents in "/share"? Is there a
>option not to include?
>
>Thanks for your help,



You should look at dar, http://dar.linux.free.fr/

It has a nice tutorial, and explains how to make
incremental backups. You have to read thru a few
docs, but it is well worth it. You're backup problems
will be solved. You can do all the things you mention
above.



--
When life conspires against you, and no longer floats your boat,
Don't waste your time with crying, just get on your back and float.
Steve Cousins

2004-01-23, 5:02 pm

Steven wrote:
quote:

>
> I am new in unix/linux. Now I need to know how to use tar to do
> increamental backup of my system. specifically I have the following
> questions:
>
> 1. Looking at the man page, it seems to have options like -d
> (difference), -u (update: which append the updated files to archive
> file), and -g, and -G. But I am not really sure which one to use for
> increamental backup. I tried -u, but it seem to still back up the
> whole things (not changed files only).



Using Gnu Tar you can do a full backup with:

--listed-incremental incremental_file

This will create a file that contain information about the files that
have been backed up. Then the next time you do a backup use this same
tag and it will check the incremental_file file to see what files have
changed since that full backup.
quote:

> 2. In order not to overwrite the current archive file, do I have to
> change archive file name everytime I start to do increamental backup?
> e.g if I have a fullback called backupweend, do I have to chagne name
> to backupmon, backuptue if I do increamental backup on monday and
> tuesday? If yes, that means I have to write a script to do automatic
> backup?



Generally a script is a good idea for this purpose. Yes, if you are
writing to a file (instead of /dev/tape) then you will need to change
the file names or it will just overwrite the file.
quote:

> 3. If I tar the root filesystem "/", will all the filesystem mounted
> to it be backup too. If I have a storage system mounted as "/share",
> then the backup will include all the contents in "/share"? Is there a
> option not to include?



With Gnu Tar there is a --exclude-from=exclude_file option where
"exclude_file" is the name of a file that contains all of the
directories and/or files that you don't want backed up. For my root
backup I have an exclude file that looks like:

/lost+found
/usr2
/usr3
/proc
/tmp
/mnt

Then I have separate backups for /usr2 and /usr3. I use one script that
sets up everything so I just have a cron job that does:
"backup root; backup usr2 eject" on Monday nights
and "backup usr3 eject" on Wednesdays

If I want to do an incremental backup I do "backup root incremental".
If the incremental parameter is not specified then the old incremental
file is deleted. The is eject parameter eject the tape when the backup
is done.

I used to use amanda for this sort of thing but I've set up the script
to do remote backups too and I am having fewer problems with this set
up.

Good luck,

Steve
--
________________________________________
_____________________
Steve Cousins Email: cousins@umit.maine.edu
Research Associate Phone: (207) 581-4302
Ocean Modeling Group
School of Marine Sciences 208 Libby Hall,
University of Maine Orono ME 04469
Steve Cousins

2004-01-23, 5:02 pm

Steven wrote:
quote:

>
> I am new in unix/linux. Now I need to know how to use tar to do
> increamental backup of my system. specifically I have the following
> questions:
>
> 1. Looking at the man page, it seems to have options like -d
> (difference), -u (update: which append the updated files to archive
> file), and -g, and -G. But I am not really sure which one to use for
> increamental backup. I tried -u, but it seem to still back up the
> whole things (not changed files only).



Using Gnu Tar you can do a full backup with:

--listed-incremental incremental_file

This will create a file that contain information about the files that
have been backed up. Then the next time you do a backup use this same
tag and it will check the incremental_file file to see what files have
changed since that full backup.
quote:

> 2. In order not to overwrite the current archive file, do I have to
> change archive file name everytime I start to do increamental backup?
> e.g if I have a fullback called backupweend, do I have to chagne name
> to backupmon, backuptue if I do increamental backup on monday and
> tuesday? If yes, that means I have to write a script to do automatic
> backup?



Generally a script is a good idea for this purpose. Yes, if you are
writing to a file (instead of /dev/tape) then you will need to change
the file names or it will just overwrite the file.
quote:

> 3. If I tar the root filesystem "/", will all the filesystem mounted
> to it be backup too. If I have a storage system mounted as "/share",
> then the backup will include all the contents in "/share"? Is there a
> option not to include?



With Gnu Tar there is a --exclude-from=exclude_file option where
"exclude_file" is the name of a file that contains all of the
directories and/or files that you don't want backed up. For my root
backup I have an exclude file that looks like:

/lost+found
/usr2
/usr3
/proc
/tmp
/mnt

Then I have separate backups for /usr2 and /usr3. I use one script that
sets up everything so I just have a cron job that does:
"backup root; backup usr2 eject" on Monday nights
and "backup usr3 eject" on Wednesdays

If I want to do an incremental backup I do "backup root incremental".
If the incremental parameter is not specified then the old incremental
file is deleted. The is eject parameter eject the tape when the backup
is done.

I used to use amanda for this sort of thing but I've set up the script
to do remote backups too and I am having fewer problems with this set
up.

Good luck,

Steve
--
________________________________________
_____________________
Steve Cousins Email: cousins@umit.maine.edu
Research Associate Phone: (207) 581-4302
Ocean Modeling Group
School of Marine Sciences 208 Libby Hall,
University of Maine Orono ME 04469
Oleg Goldshmidt

2004-01-23, 5:02 pm

yuezhan.zhu@medicinenet.com (Steven) writes:
quote:

> I am new in unix/linux. Now I need to know how to use tar to do
> increamental backup of my system.



Assuming GNU tar (you did mention Linux...), look at the info pages,
especially at the --listed-incremental=<snapshot> option.


--
Oleg Goldshmidt | pub@NOSPAM.goldshmidt.org
Oleg Goldshmidt

2004-01-23, 5:02 pm

yuezhan.zhu@medicinenet.com (Steven) writes:
quote:

> I am new in unix/linux. Now I need to know how to use tar to do
> increamental backup of my system.



Assuming GNU tar (you did mention Linux...), look at the info pages,
especially at the --listed-incremental=<snapshot> option.


--
Oleg Goldshmidt | pub@NOSPAM.goldshmidt.org
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com