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?
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.
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
|show 4 more comments|
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 Linode.com and SliceHost, for example, don't support LVM.)
If one is hosting with a VPS such as Linode.com, 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
What you Can Do With Hot Copy
rsnapshot is a filesystem snapshot utility for making backups of local and remote systems
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.