-   Slackware (
-   -   How should I backup my Slack 10.2 (

nhouseman85 02-16-2006 07:47 PM

How should I backup my Slack 10.2
I installed slackware 10.2 recently on my machine and I finally have it tweaked and setup just the way I want it. I was wondering what directories I should backup and what the best way to go about it is. In particular I want to make a **.tar.gz or **.tar.bz2 file that I could just unpack in the event that my system is rendered inoperable. My main thing I want to know is do I need to worry about permissions while I backup my sytem? in the tar man pages it has a switch -p that can be used. Should i d this while creating the backup, or something to be used only when I unpack it? Plus, how do I specify multiple directories to be include. I know for sure that I want the /etc file, and my home folder. Do I have to make seperate backup files for each?

Thanks for your help,

gilead 02-16-2006 08:16 PM

I use a 2 step process for backups. Step 1 is a fortnightly full backup where I boot my PC with a rescue CD and use cp -dpR to copy everything from the main partitions to a backup hard disk. Step 2 is a nightly backup that does a quick and dirty save of files from a cron job.:

# Copies (and compresses) system config files and user data files.

KEEPERS="/boot /etc /home /root /usr/local/cvsrepos /var/spool /var/lib/mysql"
ARCHIVE="`/bin/hostname`-`date '+%F'`.tar"
OPTS="-r --atime-preserve --exclude /home/backup -f"


echo "Creating tar file"
for KEEPER in $KEEPERS; do

echo "Compressing tar file"
[ -f $BACKUPDIR/$ARCHIVE ] && /bin/bzip2 -zv $BACKUPDIR/$ARCHIVE

/bin/chmod 0640 $BACKUPDIR/$ARCHIVEBZ2
/bin/chown backup:backup $BACKUPDIR/$ARCHIVEBZ2

echo "Done. Backup is in ${BACKUPDIR}/${ARCHIVEBZ2}"

# end.

There's probably a cleaner way to add files to the tar file, I just haven't looked for it. As to which locations to back up, it depends on where your applications put their configuration data, if it's all under /etc, you won't have a complicated backup set. Also, the -p switch is used when unpacking so that the extracted files keep their permissions.

mdarby 02-16-2006 09:35 PM

A simple tar file of / has saved my ass numerous times. I make my backups on a live system overnight. I've never had a problem.

ta0kira 02-17-2006 10:47 AM

Whenever I do a new install, I start a log of everything significant I do as root; installations, config changes, permissions, i.e. anything that isn't regular user stuff that changes the original setup. To make things easier, I have a script in /usr/local/sbin which allows me to update the log instantly from the command line. For config files, I create a backup of new + old in a directory in /root. For installs, I put a copy of the package, install logs, and a text file with config and compile command lines. I also set up /root as a symlink to /home/root and mount /, /usr, and /boot as read-only (/ is actually remounted as read-only in rc.local.) Lastly, I keep an archive on a separate partition for backing things up that will not change; images, documents, messages, etc.

I keep most important things backed up in a mirror partition. Periodically I just cp -dpPRux the applicable paths. When I do a hard backup, I just burn a CD or DVD of /home and my archive, and /etc and /var if I feel like it. Because I always have an accurate log of the changes I make to my system, I can restore my system from scratch in as long as it takes to do a clean install plus the changes I've recorded. Believe it or not, I've installed clean about 10 times and this works perfectly. This also prevents restoring latent bugs in your installation (such as undoing a change; rather than have it done then undone, you just skip it altogether.)

The other thing is I keep /home and a few other things on an external device so I can use the same profiles on different machines. This also makes it quite a bit easier to do a clean install without destroying things.

My system is a little more complex than what I've said (e.g. encryption, etc.), but that's the general idea.

Woodsman 02-17-2006 05:16 PM

I think backups is one of those topics that if you ask 10 people for an opinion you'll receive 15 responses. :)

For myself, I use old hardware and I use removable hard drive bays. I temporarily install spare hard drives for my backups. People with more modern hardware could use USB sticks. Although some people might recommend CDs or DVDs, I always have thought that option too slow and cumbersome for my needs.

Because I use hard drives and I am not supporting any large network or additional users, I don't worry about compression. I use one spare disk for full backups and another for differential backups.

I use a separate partition on my installed hard drive to store temporary snapshots when I know I am purposely going to tinker. In that location I copy only configuration files, primarily the entire /etc and /root directories, but also unique files such as certain X11 or KDE config files.

I use two scripts that evolved slowly as my own understanding of my system and needs grew.

I use a partitioning scheme to provide another layer of protection. I maintain /boot, /home, /tmp, /var, /usr/local, /opt all on separate partitions.

FWIW, I maintain backup copies of individual files using the .bak extensions, for files such as xorg.conf, fstab, grub menu.lst, etc. That way if I hose my box I can restore those files quickly.

Lastly, I install an alternate installation of Slackware to provide me an emergency back door to get into all of my partitions should I hose my primary installation in an inaccessible manner.

Of course, some people use RAID to provide another layer of protection.

One technique for developing a backup strategy is to perform a walk-through of trying to restore files.

The bottom line is that every user needs to experiment and customize their backup strategy to taste. Don't be afraid to modify your own strategy as you move along.

Swift&Smart 02-17-2006 09:02 PM

nhouseman85,I recommend you Linux Ghost-"PartImage".

I have a server which I would backup daily.I just download Knoppix Live CD,and use the partimage software inside that CD,all my server's files (around 4GB) was back up in 5 minutes.Also,if you want to restore it,just insert the CD and find the tarball file.

That's my habit to back things up,no permission problem bugs me.

nhouseman85 02-18-2006 01:26 AM

Thanks for all of your suggestions! They have definitely shed some light on how diversely things can be down. I hope this thread helps other new slackers like myself.


All times are GMT -5. The time now is 01:30 AM.