Linode - How to Backup Entire Linode to another Disk Image ?

I am trying to backup my entire linode (on 1 disk image) to another (blank) disk image.

I tried using both rdiff-backup & dump,however I can't seem to get them to work!

Any help would be greatly appreciated!

1. I tried using rdiff-backup with the following command:

rdiff-backup –force --exclude /dev --exclude /proc --

exclude /tmp --exclude /var/tmp --exclude /mnt / /backup

(Where / = the directory I am backing up and /backup = the 2nd

disk image mounted in this directory)

However, when I ran, this, I received the following error:

……..

File "/usr/bin/rdiff-backup", line 523, in call

self.calculatefinalval()

File "/usr/bin/rdiff-backup", line 497, in calculatefinalval

self.state.branch_val)

File "/usr/bin/rdiff-backup", line 3599, in lambda dsrpath, x, y: dsrpath.write_changes(),

File "/usr/bin/rdiff-backup", line 3518, in write_changes

if not self.lstat(): return # File has been deleted in meantime

RuntimeError: maximum recursion depth exceeded

2. I tried using drump through the WebMin FileSystem Backup

module, however again, this didn't work. Here's the error:

Performing backup of / to /backup ..

DUMP: Date of this level 0 dump: Thu Mar 18 12:38:32 2004

DUMP: Dumping /dev/ubda (/) to /backup

DUMP: Added inode 8 to exclude list (journal inode)

DUMP: Added inode 7 to exclude list (resize inode)

DUMP: Label: none

DUMP: mapping (Pass I) [regular files]

DUMP: mapping (Pass II) [directories]

DUMP: estimated 753244 tape blocks.

DUMP: Cannot open output "/backup".

DUMP: fopen on /dev/tty fails: No such device or address

DUMP: The ENTIRE dump is aborted.

Can anyone suggest either (a) a way to get either one of these programs to successfully backup my Linode or (b) suggest an alternate method of backing up my Linode?

Thanks in advance! 8)

8 Replies

Have you tried cpio? If memory serves, something like

find / | cpio -p /mntptoftarget

Actually, you should probably use "find / -xdev". As in

find / -xdev| cpio -p /mntptoftarget

bpendleton - thanks so much for your timely reply! 8)

I used the "find / -xdev| cpio -p /mntptoftarget" command and this worked! So what I did is I created a new debian image on a 2nd drive image, mounted this image as a /backup directory on my original linode, and then ran this cpio command to copy my current linode to the /backup image. This way, if I mess up my linode, I can simply shut it down and boot the 2nd debian image without loosing any data!

However, I still have a few questions:

1. In regards to "cpio" is there any way to: (a) exclude certain directories from being backuped and (b) run an incremental backup so that it doesn't have to compare each file each time it runs?

2. Also, does anyone have any ideas on how I can use an other utility, such as rdiff-backup or dump to successfully run a backup of my linode?

Thanks! :D

Uh, sure, I guess. I haven't used that kind of functionality much, but you should look at the man page for find. Particularly, you'll want to explore "-ctime" or "-newer" (then use "touch" to touch a file called "lastbackup" or something).

For exclusions, find can be a bit tricky. There's "! -name", but, at some point, it might be easier to chain in an

egrep -v "/myexcludedpath|/myexcludedpath2|etc"

Just pipe find to the egrep, to the cpio.

I dony know if its possible in UML, but have you considered dd?

You can also run rsync to do quick updates. Set it to "whole file" mode with the capital 'W' parameter so that it skips a lot of the heavy calculation, and it won't take terribly long to run. You just have to make sure you skip things that don't need to be backed up. Here's a good example of some parameters that would be decent for backups, going from / to /backup as you're suggesting:

time rsync -Waql –ignore-errors --delete --exclude=/var/log/ --exclude=/home2/ --exclude=/dev/ --exclude=/mnt/ --exclude=/proc/ --exclude=/mirror/ --exclude=/sys/ --exclude=/backup/ / /backup

I put 'time' in front of it so you can get a measure of how long it takes. '--delete' deletes files from the backup if they've been removed from the source, so everything stays 100% up to date without extra clutter.

If you (1) want an exact replica; and (2) have spare disk space for a third HD image, setup that 3rd disk with some sort of rescue boot image (RIP works fine for me), and then boot into it. Then you can mount the 1st and 2nd HD image and then pipe a dump into a restore.

The rescue image doesn't have to be large. Mine is 64Mb. Some rescue images can be as small as 2 floppies.

Note that it is dangerous to do backups of live filesystems that might change, since you might end up with your files in an invalid state. A better solution would be to consider using LVM on your Linode and taking a snapshot of your filesystems. Then you can just mount the snapshot and back that up however you like.

Perhaps someone else can post a link to a howto on LVM; making the switch from regular partitions is not usually easy.

Hi,

I recently did some copying of one image to another, if you do not mind shutting down your linode and have the available disk space, the easiest way is to create a small debian and image and mount both the source and destination and do the copy that way.

By doing this you are not copying from a live image.

Adam

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct