LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Exclude directories when backing up with 'tar'? (https://www.linuxquestions.org/questions/linux-newbie-8/exclude-directories-when-backing-up-with-tar-198660/)

wolfpeach 06-28-2004 09:33 AM

Exclude directories when backing up with 'tar'?
 
Just got my first proper server running - debian woody with the 2.4.18 kernel - doing print & file serving, but having problems doing a basic system backup.

I've been trying to use 'tar' to backup the base system files from the root partition (hda1) to a partition on another drive (sda1) but cant figure out how to use the 'exclude' option.

I've tried using --exclude [filename] in various places, but it does not seem to work. Anyone point me to an idiots guide to the syntax for this? I just want to exclude /dev /tmp /mnt /proc /lost+found & so on from the backup.

I've tried: (having first mounted sda1 & cd'd to it)

tar cvf backup.tar --exclude=/mnt --exclude=/dev --exclude=/proc /
tar --exclude=/mnt --exclude=/dev --exclude=/proc cvf backup.tar /
tar cvf backup.tar / --exclude=/mnt --exclude=/dev --exclude=/proc

but none work - where exactly do i put the 'exclude' command??

cheers, Wolfpeach

arobic 06-28-2004 10:06 AM

Hi!

See this thread:
http://www.linuxquestions.org/questi...ecursively+tar

If you need further help, don't hesitate to ask again!

wolfpeach 06-28-2004 10:54 AM

Thx for the advice! Cd'd into the backup partition & used:

tar -cf backup.tar --exclude=/mnt --exclude=/dev --exclude=/proc --exclude=/tmp /

to backup the whole system filetree except for the directories excluded...
and it worked! :0)

X Wolfpeach


All times are GMT -5. The time now is 03:04 PM.