[plug] back up over network
Craig Ringer
craig at postnewspapers.com.au
Fri Jul 2 21:03:43 WST 2004
On Fri, 2004-07-02 at 12:53, Ryan Smith wrote:
> hello
>
> Im sure this has been asked before but I cant find it anywhere so Ill
> ask it again. I want to back up my root partition on my server and store it as an image on my computer. the partition is only about 600MB and i cant store the image on my server cause its lacking in hard drive space.
> So would something like this work?
> dd if=/dev/hdd1 of=backup.iso bs=2k | scp ryan at tesla:
If you're working with relatively local machines, then there are some
other options that haven't been mentioned: partimage and network block
device.
I've been using Partimage quite a bit recently, and I find it extremely
useful. I wouldn't use it to store long-term backups because I'm not
confident they won't change the format, but it's _great_ for server and
desktop cloning, quick backups, etc. You can also always write a
partimage file to a loopback device once the network partimage operation
has finished if you're concerned about file format issues.
I've also used NBD quite a bit. I had good results with it for a while,
but I must say the more recent versions haven't worked as well for me -
I've had a series of weird problems. NBD is an option, but I'd call it
pretty close to bottom of the pile.
Finally, if you're insane or desperate, you can always
cat file_or_partition > /dev/tcp/target_host/target_port
on the server, and
nc -l -p target_port > image_file
on the target. A real life saver when you can't copy things around any
other way, and something I've used to transfer binaries I need to a
really limited rescue environment. You need to be using bash.
Regarding the issue of cloning a mounted device, I must agree - I think
it's insane. You appear to be using ISO9660, so that's not really an
issue for you, but I'll mention a few options for consideration in case
others find this thread later. The first is to run your server's storage
on top of something like LVM or LVM2 (which is device-mapper based).
There's a bit of added complexity (especially LVM root FS), but when it
comes to things like making backups you'll never understand how you did
without it. You can tell LVM to create a snapshot device, which is a
essentially a view of the file system frozen in time, and back that up.
The FS will be mounted r/w, but not active, so at worst it'll need
journal recovery and maybe an fsck. LVM snapshots also allow you to
_safely_ use rsync, tar, etc to copy active server file systems without
worrying about things getting out of sync. Think mail spools.
Another option is to make sure to remount the FS read only before
copying:
mount /filesystem -o ro,remount
... but this is tricky for the root FS, and often involves dropping down
to runlevel 1 then killing a few things because so many processes like
to hold r/w files open on the root FS. Like syslog, for example.
--
Craig Ringer
More information about the plug
mailing list