[plug] re: disk backup
James Devenish
devenish at guild.uwa.edu.au
Tue Jul 1 10:04:14 WST 2003
In message <1057024215.2188.1524.camel at jlmpc>
on Tue, Jul 01, 2003 at 09:50:15AM +0800, Jon Miller wrote:
> However, it appears to indicate that in order to do this correctly one
> has to be in single mode.
It's always safest (to prevent corruption of the backup) to
do it in single-user mode or with the devices unmounted.
Since dd makes an exact backup, changes to file length (e.g. log
entries) can invalidate the backup severely. Utilities such as
dump will not suffer this, though they may still produce a backup
where, say, log files don't correspond to the same time of day.
Since you mentioned disk-to-disk, dd has the advantage of producing an
exact duplicate of the original mountpoint and thus you can mount the
backup if desired. In fact, this is an easy way to create an
immediately-available backup boot volume (without needing RAID as such)
in case your current disk fails.
> Is this the correct method or is there a way this can take place while
> the server is running in regular mode?
The short answer is: it is never safe to do a backup in regular mode.
The long answer is: it is often safe enough to do a backup in regular
mode if you know enough.
The principal reason is:
The backup will take time. 15min or 15hr -- whatever it is for your
system. It won't happen instantaneously. Thus, your backup will be
internally inconsistent if the disk contents are modified while the
backup is in progress.
Three stand-out sources of changes are:
Operating system: your kernel may not have flushed all buffers to
disk when you start the backup (though you have a great chance if
you run `sync` in single-user mode).
Users: they sometimes try to do stuff!
Daemons: including network daemons, kernel logging, cron, log
rotation, etc.
There has been a lot of past discussion on this list regarding backups.
Comments have included mentions of these, at least:
Software: there are lots of backup options on generic systems
(including dd, tar, cpio, dump).
Shutting down daemons: this makes sure databases are in a
self-consistent state (daemons don't necessarily keep the disk
contents valid if they are doing processing in memory), prevents
unexpected modifications.
Snapshots: after syncing your disk, create a snapshot so that
the system can continue to be active while you do a backup from the
static snapshot.
There should be lots and lots of information in the PLUG mail archives
alone.
More information about the plug
mailing list