Shawn Fertch wrote: > I'm working on getting a backup script to work that uses gnu tar and > the --exclude option. > > Here's my script: > > mt -f /dev/st0 rewind > cd / > tar cpf /dev/st0 --directory / --exclude /proc --exclude /mnt . > mt -f /dev/st0 rewind > tar tvf /dev/st0 >> /home/shawnf/backup.log > mt -f /dev/st0 offline > > > When looking at the tvf output, I'm seeing the excluded filesystems > still within the tarball: > > drwxr-xr-x root/root 0 2005-05-01 21:59:52 ./mnt/ > drwxr-xr-x root/root 0 2002-03-16 01:34:43 ./mnt/hd/ > drwxr-xr-x root/root 0 2002-03-16 01:34:43 ./mnt/floppy/ > > -r--r--r-- root/root 0 2005-07-28 10:53:50 ./proc/net/igmp > -r--r--r-- root/root 0 2005-07-28 10:53:50 ./proc/net/rt_acct > -r--r--r-- root/root 0 2005-07-28 10:53:50 ./proc/net/rt_cache > -r--r--r-- root/root 0 2005-07-28 10:53:50 ./proc/net/route > -r--r--r-- root/root 0 2005-07-28 10:53:50 ./proc/net/arp > -r--r--r-- root/root 0 2005-07-28 10:53:50 ./proc/net/tr_rif > -r--r--r-- root/root 0 2005-07-28 10:53:50 ./proc/net/psched > -r--r--r-- root/root 0 2005-07-28 10:53:50 ./proc/net/dev_mcast > -r--r--r-- root/root 0 2005-07-28 10:53:50 ./proc/net/wireless > dr-xr-xr-x root/root 0 2005-07-28 10:53:50 ./proc/net/drivers/ > -r--r--r-- root/root 0 2005-07-28 10:53:50 ./proc/net/softnet_stat > -r--r--r-- root/root 0 2005-07-28 10:53:50 ./proc/net/dev > dr-xr-xr-x root/root 0 2005-07-28 10:53:50 ./proc/net/rpc/ > -r--r--r-- root/root 0 2005-07-28 10:53:50 ./proc/net/rpc/nfs > -r--r--r-- root/root 0 2005-07-28 10:53:50 ./proc/net/netlink > dr-xr-xr-x root/root 0 2005-07-28 10:53:50 ./proc/net/stat/ > -r--r--r-- root/root 0 2005-07-28 10:53:50 ./proc/net/stat/rt_cache > -r--r--r-- root/root 0 2005-07-28 10:53:50 ./proc/net/stat/arp_cache > -r-------- root/root 671027200 2005-07-28 10:53:50 ./proc/kcore > > I cut the list of /proc down to show some of what's in there. > > Layout of the box is I have multiple disks across to volume groups. > The root filesystem is outside of LVM control. All filesystems are > reiserfs (on Slackware), except for the couple of RHEL boxes that are > ext3. > > Ideally, I'd like a script portable between all version of Linux. > > Any better suggestions than what I'm trying to do? I've looked at a > few different scripts, but this one seems to be more of what I'm > looking for. > I've had lousy luck using the exclude option from the command line. I have had luck with creating a file containing a list of directories to exclude and using the exclude-from option. This works for me: tar -cvf /backup/backup.tar / --exclude-from /backup/exclude.txt exclude.txt looks like this: /backup /dev /proc /sys If you really wanted to make it a single script, you could do something that echos lines out to a file before running the tar command, kind of a hack but the best answer that I have. Josh