LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Tar backup (https://www.linuxquestions.org/questions/linux-general-1/tar-backup-284214/)

TheRealDeal 01-30-2005 04:54 PM

Tar backup
 
Hi all.

I have a server that holds alot of important data, but is also used for people to dump files on.

I have a weekly backup that runs on the server and backs the share up to a tar file on a seperate drive. Because of the not so important stuff people are uploading, it is filling the drive.

Is there a way I can specify which folders to add to the tar directory? I really don't want to have to back up 30 or 40 folders one by one.

Thanks alot.

Regs
Craig

win32sux 01-30-2005 06:57 PM

Code:

tar czf example.tar.gz /directory1 /directory2 /directory3

btmiller 01-30-2005 10:03 PM

There's also an --exclude option and --exclude-from <file> where <file> would have a list of directories to exclude. This assumes you're using GNU tar.

TheRealDeal 02-06-2005 03:14 PM

Thanks alot guys!!! Sorry about the long delay.

With the -exclude-from way, I don't suppose there is a way to have a file like that, but an include file? So I can put the folders that I want backed up in there? So any other files that are added are just ignored and not backed up?

Thanks alot.
Craig :)

Tinkster 02-06-2005 05:17 PM

Code:

  -T, --files-from=NAME        get names to extract or create from file NAME
Cheers,
Tink

TheRealDeal 02-07-2005 10:43 PM

Hi Tink,

Sorry about this, just so I understand correctly....

tar -cf --files-from=filestobackup.txt /tarfile.tar

And inside of filestobackup.txt would be like the below?...

----------------------------------------------
/root/secret.txt
/home/johndoe
/etc
/var/www
---------------------------------------------


And that would create a backup of those files, and then allow me to extract them to where they originally were?

Thanks for your help.
>Craig :)

Tinkster 02-07-2005 11:32 PM

Quote:

Originally posted by TheRealDeal
Sorry about this, just so I understand correctly....

tar -cf --files-from=filestobackup.txt /tarfile.tar

And inside of filestobackup.txt would be like the below?...
Close, not sure the position would work like that,
though ... the 'f' in '-cf' wants its argument immediately,
so the --blurb is not quite what it expected ...

I'd do
tar -T filestobackup.txt -czf tarfile.tgz

Quote:

----------------------------------------------
/root/secret.txt
/home/johndoe
/etc
/var/www
---------------------------------------------


And that would create a backup of those files, and then allow me to extract them to where they originally were?

Thanks for your help.
>Craig :)
Got that right mate :)


Cheers,
Tink

TheRealDeal 02-08-2005 03:25 PM

Thanks Tink :)


All times are GMT -5. The time now is 03:07 AM.