Monday, August 22, 2011

How To Check Whether Tar backup Differ From the Original Source File Or Not

Using tar -df option we can find out the difference between tar backup and the original Source files. And we can check whether tar it take Backup complete or not.
it will check size,time,file present or not
Sample Output

size is differ
Mod time differs
Not found in archive >> backup.tar doesn't contain the file
No such file or directory >> backup.tar file it has file but not persent in source file
Syntax
#tar -dvf Backup.tar sourceDirectory*
#tar -dvf rhel5.tar rhel5/*
-d Difference
-v verbose
-f user Archive.
1)Our present working directory it should be current directory of source file
Example
#tar -dvf home.tar home/*
#tar -dvf /root/home.tar home/*>> These are Correct

2)Here we Don't Give Like That | Wrong Syntax
#tar -dvf /root/home.tar /home/*
Original Source Document it does not come with '/' like /root/home* (or) /home*
Example if the original source file is /root/rhel5 mean
our pwd should be /root/
Because while compress file it compress like
[root@master /]# tar -df home1.tar
home/
home/indraveer/
home/indraveer/.login.old
home/indraveer/.profile.old
it compress like.

3)#tar -tf backup.tar >> list the achieve files
4) How to exract the tar file to the particular Location
#tar -xvf scartch.bak -C /
#tar -xvf Sourcefile.tar -C DestinationDirectory
-C change Destination Directory

0 comments:

Flag counter

free counters