Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using debian and ubuntu on my vpses. How can I backup my vpses while they are running? And how can I restore on any emergency?

share|improve this question
"VPS" - so those are hosted using a virtualization technique like Xen. You can make instant backups if you've a LVM setup. You need to provide more details and this quesion is better suited for – Lekensteyn Mar 23 '11 at 12:58
But I cant make instant backups, it is not allowed on my service plan. – Baran Mar 23 '11 at 13:48
Can you please explain a bit what are those 'vps' and what is this 'service plan' you're talking about? I wonder if actually you are not talking about some servers you own, but about virtual machines 'in a cloud' from some service provider. – bitwelder Mar 23 '11 at 18:19

The question specifies that the server should be backed up while it is running. The question does not say that the solution must be no-cost or open source. The comments indicate that the hosting provider probably doesn't support LVM. (That last assumption makes sense because and SliceHost, for example, don't support LVM.)

If one is hosting with a VPS such as, they offer an inexpensive backup solution. In my case, I pay an extra $5 per month for Linode's backup solution and it seems well worth it to me. It is very simple.

The only other option I know of that will meet the criteria stated above is R1Soft's Linux Hot Copy. It is free.

Here's their own advertising claims for the product. I have not used it yet, although I am seriously considering it. (I'm reading questions like this one as part of my research.) I have no affiliation with R1Soft and I don't have anything to gain by posting this information. I'm posting it because I do not know of any other solution that allows backing up a running server (including system files) other than LVM, btrfs, zfs, other COW file systems, and things that are generally not available on a VPS -- and R1Soft's Linux Hot Copy. It's the only other choice, afaik.

Hot Copy (hcp) - Free Universal Disk Snapshot Utility for Linux Servers

The R1Soft Hot Copy utility creates an instant point-in-time volume snapshot of any block device while the system is running without interrupting applications. Works on almost any Linux block device. It is like Volume Shadow Copy for Linux.

Hot Copy (hcp) - Universal Disk Snapshots for Linux

R1Soft Hot Copy (hcp) is the answer to taking online point-in-time disk and volume snapshots in Linux. Use the hcp command line utility to take an instant snapshot of any mounted file system on almost any block device!

Windows administrators use Volume Shadow Copy Service (VSS). On Linux servers before Hot Copy nothing equivalent existed. R1Soft created Hot Copy so every Linux server has a universal disk snapshot that is fast and easy to use.

Why Hot Copy is the Answer to Linux Disk and Volume Snapshots

Works on any server-based file system or block device
Install without rebooting
Eliminates LVM pre-requisite
Requires no pre-allocation or pre-configuration of storage
Uses existing free space on your disk to maintain snapshots
Outstanding performance compared to LVM snapshots
Works on most High-Availability and Shared Storage
Specialized performance awareness for: Ext2, Ext3, Ext4, and Reiserfs3
Snapshots are readable and writable
Keep multiple snapshots of each disk or volume

What you Can Do With Hot Copy

Add point-in-time open file backups to your existing backup scripts for free e.g. tar and rsync
Check your disk for errors with fsck without rebooting and without unmounting your file system!
Test scripts and programs in an instant snapshot of your live environment before you use them on real data
Keep instantly recoverable snapshots available by taking periodic snapshots via cron
share|improve this answer

If you've got a good deal of time on your hands, and can leave your system online, you can do a remote rsync down to your system.

rsync --recursive --progress user@host:sourcedir /path/to/save/backup/on/local/machine

That should do what you want, but it'll take up a ton of space on your computer, because its literally a copy of the data on your VPS. Note you might want to run this with the root user, if you want a total copy. Also, this won't preserve the permissions, it'll just give you a copy of the files.

About the Arguments Used Above
In case you're curious as to what the arguments for the rsync directory:

user@host:sourcedir: user means the username to use on the VPS (in this case, probably root). host means the connection address you use for your VPS. sourcedir means the directory you want to copy from. In your case of a full VPS backup, you would probably want this to be /.

/path/to/save/backup/on/local/machine/: You've got several different options with where you want to store your backup when its on your local drive. In any case, you will want to make sure you can access this, so you would probably end up with something like /home/user/VPSbackup/ where user is your local username on the local system (not on the VPS)

The --recursive argument will copy all files in every subdirectory from sourcedir.

The --progress argument will show you the progress of each file as its being downloaded (can be helpful in certain cases), because it can show you the time left to download each file (it'll flood your terminal screen, but that's not necessarily a bad thing if you want to see the progress).

Most importantly...
An rsync in which you switch the user@host:sourcedir and the /path/to/save/ arguments will OVERWRITE your VPS with old data or no data. This can also lead to you breaking things if you specify the wrong /path/to/save/.

share|improve this answer
This method does not copy system files that are in use on a running server, so it does not really address the original question. – MountainX Dec 5 '11 at 4:13
Then their alternative is to have the host do an LVM snapshot, or have the host initiate some type of snapshot/backup system. Otherwise, my statements here should work for most data, including some active data. – Thomas Ward Dec 5 '11 at 4:20
Can you list some other advance methods to backup live server? Full backup solutions. – BigSack Aug 18 '13 at 10:50
@MountainX You have to adjust the sourcedir path to pull data from system directories, and change sourcedir to /somepath for system files. – Thomas Ward Aug 18 '13 at 15:45
@BigSack depends, are you on a VPS? Or on your own system, etc.? Full system backups on VPSes tend to be LVM backups or provider-created images or snapshots of the system after it's in shut-down mode. If it's your own system you can just clone the drive, but that's a different question. And I'm not stating cloud solutions because I consider most cloud solutions to be a vulnerability. – Thomas Ward Aug 18 '13 at 15:45

rsnapshot is a filesystem snapshot utility for making backups of local and remote systems

share|improve this answer
Could you dwell a bit more in how could I use them? – Braiam Oct 4 '13 at 13:13

You CAN move live system to LVM.

Install necessary kernel modules and load them (or compile kernel with appropriate config and reboot VDS).

After that you can move root to LVM, change root FS on live system without reboot. It is possible with "pivot_root" and temporary moving root fs to another place (to RAM, for example).

But be carefully, it's dangerous.

share|improve this answer
If it's a VPS through a VPS provider, you can't, because the VPS image has to be set up as such by the provider. – Thomas Ward Aug 18 '13 at 15:47

Take an LVM snapshot and back it up with dump.

share|improve this answer
Read the comments dude, he cant make the backups: But I cant make instant backups, it is not allowed on my service plan. – Baran – Thomas Ward Mar 23 '11 at 16:15
@EvilPhoenix what does a service plan have to do with anything? It's your server, you have root access, you can back up what you damn well please. They just won't do it automagically for you outside of the vm. – psusi Mar 23 '11 at 17:41
"Take an LVM snapshot" he cant do that, he doesnt have access to that service, from how I interpret his question and comments. – Thomas Ward Mar 23 '11 at 18:16
@EvilPhoenix if he has root he does. AFAICS, the "service" that is offered and he does not have in his plan is for the admins to make a snapshot on the real hardware outside of his virtual machine. What goes on inside the vm is up to him. – psusi Mar 23 '11 at 18:21
@psusi: Could it be that the system isnt set up in LVM format? Or could it possibly be that he doesnt know how? – Thomas Ward Mar 23 '11 at 18:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.