[KLUG Members] quick tar question
Bruce Smith
members@kalamazoolinux.org
Wed, 11 Jul 2001 12:58:02 -0400
> I'm doing a lot of testing and potential trashing of a Linux system and would like to get back to an original running state quickly. So I figured I could just create a tar of the / partition to my /data partition. Here's the command line I'm using (compiled from reading various bits at LDP and other sites):
>
> tar -cplf /data/full.tar --directory / --exclude=proc --exclude=mnt --exclude=*/lost+found .
>
> Partitions on the box are:
>
> /
> /home
> /data
>
> Is there a better way of accomplishing this? Now that I think about it, I could probably have excluded /home too. TIA for any pointers.
You don't need to "--exclude" anything in the above example.
The "l" (lowercase "L") option tells tar not to cross mount points,
so it will not backup /home, /data, /proc, or any other partition.
/lost+found should be an empty directory, so it only takes a few bytes.
Also be careful with "*" in your command lines. They will expand
BEFORE the command is executed if possible. If you really need to
send a command a "*", put it in single quotes.
If you need to save disk space on /data, you can give tar the "z"
option to have it gzip your backup file. (at the expense of the
CPU, and it might take longer for the backup to run).
--------------------------------------------
Bruce Smith bruce@armintl.com
System Administrator / Network Administrator
Armstrong International, Inc.
Three Rivers, Michigan 49093 USA
http://www.armstrong-intl.com/
--------------------------------------------