Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 03-11-2009, 11:40 AM   #1
Registered: Oct 2003
Posts: 252

Rep: Reputation: 20
Some questions about TAR - I'm trying to learn to use it

1) Whats the difference between --incremental and --listed-incremental?
Is Incremental an obsolete or outdated option? The description (which I may not understand) seems less complicated than --listed-incremental.

2) Does every dump (level 0 and level 1) have its own seperate snapshot file(.snar)? Or does the snapshot have info on multiple dumps. Snapshots is the most confusing part of this and the Gnu Tar Manual is less than clear on the topic.

3) Can anyone help me over this hump?

I can do a full incremental(level 0) with no problem. I can do a 'level 1' with no problem. But I do not understand .snar.

Does the first 'level 1' add to the .snar or does it recreate .snar?

If I have a 'level 0' and a 'level 1', do I then have 1 .snar file or 2 .snar files?

Soooo confusing.
Old 03-12-2009, 01:41 AM   #2
Registered: Oct 2003
Posts: 252

Original Poster
Rep: Reputation: 20
Old 03-13-2009, 05:09 PM   #3
Senior Member
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76

Your question appears to be more about incremental backups than general tar usage as your subject implies. Just to be clear, the main use of tar is to build archives for distributing files such as programs. If you want to do that, you don't need to care about snar files at all.

Incremental backups are used for archiving data repeatedly, to avoid having to rebuild the entire archive all the time and reduce archive size.

A level 0 backup is basically an archive (.tar) file, and just contains the current state of the files, and puts additional information into a separate archive (.snar) file.

A level 1 backup is just a normal archive (.tar) file too, but any files that haven't changed since the level 0 backup was made aren't included.

If you use --incremental after a level 0 backup, then it will create a level 1 archive, but it won't create a new (.snar) file, so you any subsequent backups based on this archive. This is useful when you have a directory containing files that need to be archived, but rarely change.

If you use --listed-incremental after a level 0 backup, it will also create a level 1 archive. It will also create a new (.snar) file. This means that any subsequent backups can be based on this archive. This is useful when you want to archive a directory containing files which change frequently.

You should use different filenames for each snar file. The examples at use a -level postfix to the filename (.snar, .snar-1, etc).

Hope that helps,

—Robert J Lee
Old 03-14-2009, 07:57 AM   #4
LQ Guru
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
If your main interest is incremental backups, check out star. It is like tar, I believe even upward compatible, but it offers many more options for incrementals. The man page is about 3000 lines, no need to repeat it here. It is probably available in your distro but has to be installed.

Old 03-15-2009, 01:32 AM   #5
Registered: Oct 2003
Posts: 252

Original Poster
Rep: Reputation: 20
Thanks for your replies. I have had not much luck with getting replies to my recent TAR (or I quess I should say TAR backup) questions.

I have successfully done a level 0 and 1 backup. Here is my progress...

I did a level 0 backup with...

"sudo tar cvf terry-archive.1.tar --listed-incremental=/home/terry.snar terry".

This gave me a file called "terry-archive.1.tar" and a "terry.snar" file. I am not sure if this .snar file is empty or if it has data about the level 0 archive.

Next I made some changes to my /terry directory. So now I am going to do an incremental backup (level 1) of the directory.

So I did a "sudo cp terry.snar terry.snar-2". Then I did the backup...

"sudo tar cvf terry-archive.2.tar --listed-incremental=/home/terry.snar terry".

This gave me a file called "terry-archive.2.tar" and a "terry/.snar" file.

I then listed "terry-archive.1.tar" and "terry-archive.2.tar" and the contents were as they should be. I also deleted the directory from my file system and then extracted the archives individually and they worked perfect.

Now if I want to do a 2nd level 1 backup I do not know how to handle the .snar situation. I do not see a reference to a 2nd level 1 in the "gnu tar manual". Can you guide me a little more?



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
C and C++ (I will post all my questions here while I learn.) Amdx2_x64 Programming 13 08-03-2008 08:28 PM
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 02:53 AM
Questions about Beginning to learn C++ caged Programming 5 02-24-2004 11:29 AM
lots of questions, please help me learn covertninja Linux - Laptop and Netbook 2 10-29-2003 03:14 PM
really want to learn. few questions :) DazeiHead Linux - Newbie 8 05-24-2003 06:28 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:02 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration