Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-28-2004, 09:33 AM   #1
LQ Newbie
Registered: Jun 2004
Location: Oxford, UK
Distribution: Debian
Posts: 27

Rep: Reputation: 16
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
Old 06-28-2004, 10:06 AM   #2
Registered: Jul 2003
Location: Geneva, Switzerland
Distribution: Debian 3.1, SLC3 (based on RHEL)
Posts: 84

Rep: Reputation: 15

See this thread:

If you need further help, don't hesitate to ask again!
Old 06-28-2004, 10:54 AM   #3
LQ Newbie
Registered: Jun 2004
Location: Oxford, UK
Distribution: Debian
Posts: 27

Original Poster
Rep: Reputation: 16
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


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
wget --exclude-directories option broken? (fc2) fsbooks Fedora 3 06-20-2009 06:08 PM
Tar won't exclude directories. yougene Slackware 9 12-01-2005 09:32 AM
tar --exclude --exclude-from cefn Linux - Software 4 10-11-2005 07:31 PM
tar exclude-from drisay Slackware 1 12-23-2004 01:10 PM
wget & --exclude-directories Tinkster Slackware 4 07-20-2003 10:02 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:23 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