Results 1 to 18 of 18
  1. #1

    Best way to backup/snapshot/clone my VPS filesystem?

    Hey guys,

    So let's say I'm on a VPS that does weekly backups, but want more control over restoring in case of catastrophe. What is a recommended way of doing my own snapshots? I'm worried about instances where I modify a couple .conf files the wrong way, or I do an apt-get upgrade and it breaks something, and I need to jump back to a previous snapshot. On RamNode, for instance, you can do a snapshot which is great, and it drops a tarball in /panelbackup of the whole filesystem. But there's no way to just say "wipe out my entire system and replace it completely with this snapshot." At least not that I know of.

    Any info would be appreciated!

    EDIT: This is obviously more about system changes, not file changes to websites, as those can easily be scheduled to rsync over ssh.
    Last edited by OtherMDesign; 03-24-2013 at 02:52 PM.

  2. #2
    Join Date
    Jun 2012
    Location
    Saskatchewan, Canada
    Posts
    478
    Since you're asking mostly regarding config files, why not set up a cron job to snap /etc into a tarball and set it in /etc-backup/ with timestamp as filename.

    This way you could just untar the tarball to replace over /etc. You vcan also use rsync/ssh to backup /etc-backup to a remote location as well.

    Would this suffice? Or do you really need the whole FS snapshotted?

  3. #3
    Backing up /etc is definitely a good start. Though sometimes installing/upgrading packages changes stuff in /usr/lib, /usr/share, etc.

    In all my Linux experience, doing an apt-get upgrade on an LTS install has never toasted anything ever. Just trying to be on the safe side. But backing up the domain folders & /etc should probably cover me.

  4. #4
    Join Date
    Jun 2012
    Location
    Saskatchewan, Canada
    Posts
    478
    I run Gentoo for everything. Backup /etc and /var usually covers everything. All of the package manager files are in /var on Gentoo. So if I have to rebuild the system, I can rebuild apps from package info in /var to get it to the same setup I had, then untar /etc backup over /etc.

    I suppose it depends on where your web root is. I always custom configure everything by hand and use /www for web sites.

    apt-get... is that ubuntu or debian?
    Last edited by evohost Canada; 03-24-2013 at 03:43 PM. Reason: spelling

  5. #5
    Join Date
    Jan 2008
    Location
    In home
    Posts
    61
    make rsync to one backup folder, better this way.

  6. #6
    Running Ubuntu 12.04.

  7. #7
    Join Date
    Jun 2012
    Location
    Saskatchewan, Canada
    Posts
    478
    With ubuntu I think you'll be fine with backup your domain data and /etc.

    Anything in /usr/share and /usr/lib should not affect in terms of backup and restore. If you're running into issues with changes in these directories, you'll need to roll back any updated packages, then just reapply etc by untar over the directory.

    One thing I'm not certain about on Ubuntu/Debian, is where databases are stored. On Gentoo they are in /var by default. How do you handle your database backups?

  8. #8
    Are you talking about actual databases (like MySQL)? Almost forgot about that! Looks like this could work: http://www.cyberciti.biz/faq/ubuntu-...backup-script/

    I'd also back up /var as well, which has other misc data.

  9. #9
    Join Date
    Jun 2012
    Location
    Saskatchewan, Canada
    Posts
    478
    That script looks useful, but be careful. It requires you to place your root mysql password in plaintext in the script itself. Be sure to save it in /root/ and set permissions to only be read by root user.

  10. #10
    Yep, as soon as I saw it has plaintext passwords in it, I thought "chown root" and "chmod go="

  11. #11
    Join Date
    Jan 2010
    Location
    Europe
    Posts
    372

    Lightbulb

    Backup mysql, and files separatelly by cron, when this finishes let cron backup the archives into external ftp. when done, delete source archoves.

  12. #12
    Join Date
    Jul 2012
    Posts
    842
    Quote Originally Posted by OtherMDesign View Post
    Hey guys,

    So let's say I'm on a VPS that does weekly backups, but want more control over restoring in case of catastrophe. What is a recommended way of doing my own snapshots? I'm worried about instances where I modify a couple .conf files the wrong way, or I do an apt-get upgrade and it breaks something, and I need to jump back to a previous snapshot. On RamNode, for instance, you can do a snapshot which is great, and it drops a tarball in /panelbackup of the whole filesystem. But there's no way to just say "wipe out my entire system and replace it completely with this snapshot." At least not that I know of.

    Any info would be appreciated!

    EDIT: This is obviously more about system changes, not file changes to websites, as those can easily be scheduled to rsync over ssh.
    Currently my backups are crude and simple, but I have successfully backed-up, wiped, and then restored several VPSs using tar. I think it might be the same as your /panelbackup, except I use /backup instead.

    See:
    http://www.webhostingtalk.com/showthread.php?t=1215449
    ...and post 15 and 16 in this thread:
    http://www.webhostingtalk.com/showthread.php?t=1224354

    I use two VPSs to store each other's backups. I use SFTP to copy the files from one to another, but SCP will do nicely, too. I revised my backup/restore commands slightly:

    Backup:
    tar cvzpf /backup/backup.tgz --same-owner --exclude=/backup/* --exclude=/proc/* --exclude=/dev/* --exclude=/mnt/* --exclude=/sys/* --exclude=/tmp/* / 2>/backup/error.log

    (The new command excludes anything in the /backup directory - including older, renamed backups, and backups copied from other VPSs.)

    Restore:
    tar -xvpzf /backup/backup.tgz -C /

    To do the restore, I would re-install from the same image as before, then patch it to the same level as the backup. After copying the tar file to a newly created /backup directory, run the Restore command above - it will overwrite everything, of course. After that, reboot.

    One time, I had an issue where the restored system would boot, but not communicate on the network. The problem was that I had to do an update/upgrade cycle (latest patches), then run the restore. I can see how it might an issue to get a working restore of an older backup if neither the original install image or the latest patches are not compatible with the restore files from the tarball.

  13. #13
    If you're on a KVM plan with RamNode, you could sign up with an R1Soft backup provider and start backing up your whole VPS, in whatever intervals you want (we do hourly backups for instance).

    So if something happens, you can either retrieve a single file/folder from your backups (from any point back in time) directly to your VPS - this would be the case you want to retrieve a conf file or something OR you can do a Bare Metal Restore by booting up your VPS using R1Soft's recovery disk (you can ask RamNode to add the ISO to their list) and restore your whole VPS exactly as it was x hours/days/weeks ago.

    Note: In order for BMR to work, you need to be running your KVM VPS using the ide disk driver, Virtio is not compatible yet.
    Fusioned - http://www.fusioned.net
    Enterprise & Semi-Dedicated Hosting | CloudLinux, cPanel, LiteSpeed, Acronis | PHP 5.6, 7.2, 7.3, 7.4 & 8.0
    Fully Managed SSD KVM VPS & Dedicated Servers | CloudFlare & Acronis Partner | RIPE LIR

  14. #14
    Join Date
    Mar 2003
    Location
    /root
    Posts
    23,990
    Quote Originally Posted by George_Fusioned View Post
    If you're on a KVM plan with RamNode, you could sign up with an R1Soft backup provider and start backing up your whole VPS, in whatever intervals you want (we do hourly backups for instance).
    The easiest way to do it and you can restore your entire VPS in no time.

    Specially 4 U
    Reseller Hosting: Boost Your Websites | Fully Managed KVM VPS: 3.20 - 5.00 Ghz, Pure Dedicated Power
    JoneSolutions.Com is on the net 24/7 providing stable and reliable web hosting solutions, server management and services since 2001
    Debian|Ubuntu|cPanel|DirectAdmin|Enhance|Webuzo|Acronis|Estela|BitNinja|Nginx

  15. #15
    Thanks for the help, vps_newbie!

    And I'm on the OpenVZ setup with RamNode, so R1Soft may not work in this case.

  16. #16
    Let us know if we can do anything to help!
    RamNode - High Performance Cloud VPS
    SSD Cloud and Shared Hosting
    NYC - LA - ATL - SEA - NL - DDoS Protection - AS3842
    Deploy on our SSD cloud today! - www.ramnode.com

  17. #17
    Nick: I try not to bother you guys too much as I know it's an unmanaged service. I know a lot of the limitations are due to the SolusVM panel. In an ideal world, it would be nice to be able to shut the server down, and restore a quick backup to overwrite the entire filesystem, then boot it back up.

    But some other people have made some great suggestions and I'm sure I can put together an automated backup that will tackle the important folders as well as my MySQL DBs.

    Thanks!

  18. #18
    I believe SolusVM is planning to launch a manual, remote backup system with the next beta. It was due out last Monday so who knows when that will happen...
    RamNode - High Performance Cloud VPS
    SSD Cloud and Shared Hosting
    NYC - LA - ATL - SEA - NL - DDoS Protection - AS3842
    Deploy on our SSD cloud today! - www.ramnode.com

Similar Threads

  1. when RAID10 +backup is not enough, do you use snapshot backup?
    By Peter-SexyWing in forum Colocation, Data Centers, IP Space and Networks
    Replies: 4
    Last Post: 12-19-2010, 01:03 PM
  2. Replies: 0
    Last Post: 03-19-2007, 08:55 AM
  3. Replies: 23
    Last Post: 03-19-2007, 07:25 AM
  4. Replies: 20
    Last Post: 03-09-2007, 12:42 AM
  5. VPS backup or snapshot
    By NelsonT in forum VPS Hosting
    Replies: 2
    Last Post: 11-28-2006, 02:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •