How can I create images of remote VPS servers? (Linux)

6,853

Solution 1

To create full, working images nothing works better then dd.

mount your root system read-only; a bit tricky, you need to make sure nothing writes to the fs and then issue

mount -o ro -n /

(-n makes sure that the mount itself doesn't write to the filesystem)

and copy the contents using dd:

dd if=/dev/sda1 of=/otherfilesystem/imagefile.img

You can also create an empty filesystem:

dd if=/dev/zero of=/otherfilesystem/file.img bc=size

and format the file using mkfs.ext3 (or whatever your root is using).

after that you can mount the file and create /proc or /dev folders; you can also run grub on that file to make sure it boots the way you want. After you are done, pack all that in a script...

Solution 2

You may use rsync, duplicity (I'd suggest with ftplicity) or dar.

Or, as already said, LVM or filesystem snapshots (some filesystems like XFS support snapshots), but these snapshots tend to be more space wasting than explicit file backups.

EDIT: You said servers. If you have many servers, thinking about an enterprise backup solution like Bacula might be the right choice.

Share:
6,853

Related videos on Youtube

Julien Breuil
Author by

Julien Breuil

Updated on September 17, 2022

Comments

  • Julien Breuil
    Julien Breuil almost 2 years

    I am searching for a tool to assist me in making backup images of remotely running VPS servers. Thanks!

  • Rik Schneider
    Rik Schneider almost 15 years
    You can do this with a running system as well. Turn off all the services you can. In this case you will want to run fsck for the filesystem image after it is made. You may run into some files that were were being written while the image is being made. If these are text or log messages it may not be a big deal. Since dd copies all o the blocks, with or without data, I'd suggest that you compress the image while creating it, especially if you are going to copy it across a network. You may also want to look at dump or xfsdump if you are using ext2/3 or xfs.