[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Backing up a Linux system



On Wed, Aug 02, 2000 at 05:28:14PM +0100, bsamuels@datamansys.co.uk wrote:
> Debian Potato (Frozen) with Slink  KDE.
> 
> I want to be able to backup my linux system to scsi tape (nst0)
> such that, if my hard drive falls into little pieces one bright
> sunny day, I can boot from a rescue floppy and restore the lot
> onto a new drive without having to re-install anything.
> 
> I plan to use afio for the backup in conjunction with the
> Tomsrtbt rescue floppy (an amazing piece of work).

afio is a good choice.  I use tar.  It's prevelant, though slightly less
robust.

> Most parts of the system are straightforward and I could include
> mount point directories, such as /cdrom, as long as there is
> nothing actually mounted then they would, at least, be
> automatically re-created.  


However, if you do have something mounted beneath a mount point it
generally *will* be backed up.  You'll end up with a rather redundant
copy of that CDROM you left in the drive last night.

> I wouldn't need to backup /tmp.

> What about /dev?  Could the device files be backed up without
> backing up the contents of the said devices?  I did see once that
> Midnight Commander could copy a complete linux system onto
> another partition so I assume that backing up the /dev directory
> could be done.

GNU tar handles /dev files properly, though strictly you don't need to
back this up.  See below.

> I'm assuming that the contents of /proc, including any
> sub-directories, are generated each time at startup and all that
> would need to be done would be to re-create the actual directory.

In general, you don't *need* to back up anything that's a standard part
of the system.  This would include:

System directories: /bin /sbin /dev /lib /usr /initrd

    Each of these contains *only* files added by the distribution, and
	for which your backups can't necessarily be trusted to restore to
	proper state.  An OS reinstall is appropriate (and buys you an
	upgrade, if desired).  The information will be correctly created.
	Generally, you don't need to back up these trees.


Temporary fils: /tmp 

    This is flushed by the system on each reboot anyway (watch your
    boot messages).  Backups unnecessary.


Secondary mount points: /mnt /net

    YMMV, but you generally won't want to back up arbitrary remote
	filesystems, and frequently don't need to back up removable devices
	(floppy, cdrom, zip, jaz, mo) mounted under /mnt or another mount
	point.  Backups probably irrellevant.


Virtual FS and recovery:  /proc /lost+found 

    /proc is a virtual filesystem.  It doesn't actually "exist" in a
	sense of storage, it's an interface to kernel-space data and state.
	It isn't "created" at boot, it's probably more accurate to say that
	information under /proc is made available on demand.  /lost+found is
	where lost clusters are placed by e2fsck.  Generally you're not
	interested in these (though YMMV).  Backup unnecessary and possibly
	impossible.


Stray links:  /opt

    If you've implemented /opt as a link to /usr/local, you don't need
	to back it up seperately.  If you've created a seperate filesystem,
	ask yourself why, move everything in it to /usr/local, create an
	appropriate link, and remove /opt from your backup schedule.  Backup
	a sign of poor FS layout (IMVAO).


Persistant system state: /var

    There are parts of /var you'll want to keep, much of it you can
	discard.  See the example below for more guidance.  Note that you
	*will* want to save anything relating to your packaging system
	(there are apt and dpkg trees under /var), duplicates of system
	files under /var/backups, system logs, and possibly web space.
	There are arguments on both sides of archiving spools (print, mail,
	news, squid, fax, etc.).  I choose not to.  Backups on a selected
	basis.


Stuff you *REALLY* want to save:  /etc /root /usr/local /home

    This is the non-distribution, non-remote, non-volatile, valuable
	part of your system.  Hard-won configurations, local apps and
	data, and user space.  Backups mandetory.  Early and often.
	Validate your backups.


My own system backup script follows.  This is for an aging single-user
Linux box, and is run typically every few days.  Fits well on a single
2.0 GB SCSI DAT-90 DDS tape, with 1 2.4 GB and 2x 2.1 GB disks.

-------------------- <begin system-backup> --------------------
#!/bin/bash

# Create backups of /etc, /home, /usr/local, and...

mt rewind
tar cvf /dev/nst0 /etc
tar cvf /dev/nst0 /root
tar cvf /dev/nst0 /home
tar cvf /dev/nst0 /usr/local

# and selected /var directories
tar cvf /dev/nst0 /var/backups
tar cvf /dev/nst0 /var/cache/apt
tar cvf /dev/nst0 /var/lib
tar cvf /dev/nst0 /var/log
tar cvf /dev/nst0 /var/www
-------------------- <end system-backup> --------------------

-- 
Karsten M. Self <kmself@ix.netcom.com>     http://www.netcom.com/~kmself
 Evangelist, Opensales, Inc.                    http://www.opensales.org
  What part of "Gestalt" don't you understand?   Debian GNU/Linux rocks!
   http://gestalt-system.sourceforge.net/    K5: http://www.kuro5hin.org
GPG fingerprint: F932 8B25 5FDD 2528 D595 DC61 3847 889F 55F2 B9B0

Attachment: pgpmjaN_21Yqz.pgp
Description: PGP signature


Reply to: