+how to exclude directories when tarred to ta

May 17, 2011 at 14:17:28
Specs: aix
I need to exclude some directories, so when I shut down to do an upgrade, my tape backup will not take 4 hours to backup.

See More: +how to exclude directories when tarred to ta

Report •

#1
May 17, 2011 at 14:23:43
What backup software are you using? Have you looked at the man page?

How do you know when a politician is lying? His mouth is moving.


Report •

#2
May 17, 2011 at 14:28:24
I have looked at the man page and I am using tar to do the tape backup. I am running AIX 5.3 on my box.

Report •

#3
May 17, 2011 at 14:33:50
I am trying to exclude two directories, which are a total of 60 GB of data, but no luck so far.

Report •

Related Solutions

#4
May 17, 2011 at 14:45:17
I have looked at the man page and I am using tar to do the tape backup. I am running AIX 5.3 on my box.


Report •

#5
May 17, 2011 at 17:13:00
It has been a very long time since I used TAR
but you should be able to create a list of all the files/directories you wish to archive
and use is -L option

Somthing along the lines of: tar -L MyList

There are more options that need to be set, but like I said it's been a long time.

MIKE

http://www.skeptic.com/


Report •

#6
May 17, 2011 at 21:22:45
You might try something like this:

# untested
tar -cvf tararchive.tar $(find . -type d \( -name sct24 -o -name sct22 \) -prune -o -print)

From the current directory, the find command skips the sct22 and sct24 directories, but tars everything else into the tararchive.tar file. Maybe something like this will help you.


Report •

#7
May 18, 2011 at 04:33:25
Right now, my backup command is tar -cvf /dev/rmt0 /u01 /u02 because I am backing up to the tape drive. Could the tar you posted be adjusted to backup to the tape drive? I appreciate any help you can provide.

Report •

#8
May 18, 2011 at 08:59:21

#!/bin/ksh

# untested
tar -cvf /dev/rmt $(find /u01 /u02 -type d \( -name sct24 -o -name sct22 \) -prune -o -print)

Something like the above command probably will work. Of course, you need to replace my example directories with yours.

But I would make sure the find command is actually working the way you think it should. I would redirect the output of the find command to a file:

# untested
find . -type d \( -name sct24 -o -name sct22 \) -prune -o -print > /tmp/myfile.txt

and verify that the directories are really eliminated from /tmp/myfile.txt. I'd also spot check and make sure the directory and file objects I want to be there actually are.


Report •

#9
May 18, 2011 at 13:23:50
I think that is close, but some character is causing an end of file error. I think I can work with that. Thank-you for the info

Report •

Ask Question