Incremental Remote Backups Using rsnapshot

There’s an old adage about backups:

There are two kinds of people: people who’ve never lost data, and people who’ll never lose data again.

If you’ve ever experienced data loss, you will instantly become passionate about backups.  To prevent bad experiences with your data, you want backups that are comprehensive, manageable, versioned, automated, and secure.  Let’s break that down:

  • comprehensive: They should include everything by default.  It’s certainly legitimate to exclude OS directories, temp files, etc. but you don’t want a system where you have to manually add directories as you add applications and data.  Inevitably, you’ll forget something and not know it until it’s too late.
  • manageable: If you have a 1TB server and take a full backup every day and retain them for a month, that’s 30TB in a month.  You need a system that allows for regular pruning.
  • versioned: If you have a system that simply copies everything from system A to system B once a night, that’s better than nothing, but on Monday you trash a file and don’t notice it until Thursday, you can’t recover.
  • automated: Because humans are lazy.
  • secure: It’s annoying to be hacked.  It’s heartbreaking to find the hacker also destroyed your backups.

In this tutorial, we’ll show you how to setup backups using rsnapshot.  Quoting rsnapshot.org:

rsnapshot is a filesystem snapshot utility based on rsync. rsnapshot makes it easy to make periodic snapshots of local machines, and remote machines over ssh. The code makes extensive use of hard links whenever possible, to greatly reduce the disk space required.

This means if you have 500MB of files, you want to retain 30 days’ backups, and your change rate is 10% over that period, you don’t need 30 * 500 = 15,000MB but rather only 550MB.  Beautifully, you still have point-in-time recovery (depending on your backup schedule) throughout that period.

In this tutorial, we’ll setup the following:

  • server1.lowend.party has a directory called /data with lots of valuable files.
  • We want to back it up to backup.lowend.party using a scheme of hourly/daily/weekly/monthly backups.  These are stored in /backups/server1.lowend.party
  • backup.lowend.party has other hosts it backs up as well.
  • We’re using passwordless ssh keys for authentication so we can run everything out of cron.

Before we start, there’s one more key concept.

I’ve long advocated pull backups.  In other words, the backup server comes along and backs up the client.  In this scenario, backup.lowend.party initiates the backups and contacts server1.lowend.party to get the data.  This is in contrast to push backups, where server1.lowend.party contacts backup.lowend.party and pushes the backups to it.

What’s the difference?  Imagine server1 is hacked.  If we’re using push backups, it would be trivial for the hacker to use the passwordless ssh keys to nuke the backups as well.  In a pull-based model, backup.lowend.party can authenticate to server1, but not vice-versa, so the hacker is out of luck.

On Debian, it’s as easy as

apt install rsnapshot

rsnapshot’s config lives in /etc/rsnapshot.conf.  I recommend making a backup of it before you start changing things:

mv /etc/rsnapshot.conf /etc/rsnapsnap.conf.default

There are different philosophies about how to setup rsnapshot configs.  I prefer to have a separate config file for each client (system being backed up).  If you only have one system to backup, this is not necessary.  You can backup multiple systems in one config file, but you lose some flexibility.  Experiment and decide which you like.  In my case, I do this:

cp /etc/rsnapshot.conf.default /etc/rsnapshot.conf.server1

Now modify as follows.  Important Note: rsnapshot.conf requires TABs between elements.  So “cmd /usr/bin/ssh” is “cmd<TAB>/usr/bin/ssh”.

Enable remote backups:

cmd_ssh /usr/bin/ssh

Add these backup intervals:

interval hourly 6
interval daily 7
interval weekly 4
interval monthly 3

I’m using a passwordless ssh key stored in /root/.ssh/backup.  I also use a different ssh port.  So make this change:

ssh_args -p 8989 -i ~/.ssh/backup
These two commands are for reporting (see below):

rsync_long_args --stats --delete --numeric-ids --relative --delete-excluded
verbose 4

Now I tell rsnapshot where to save backups:

snapshot_root /backups/server1.lowend.party/

Finally, I add the backup definition:

backup root@server1.lowend.party:/data/ .

This will keep files in /backups/server1.lowend.party/hourly.0, etc.

I want to exclude /data/cache on my backups:

exclude_file /etc/rsnapshot.server1.exclude

And in that file I put:

- /data/cache/*

OK, we’re ready to go.  Now because I’m not using the default /etc/rsnapshot.conf name, I need to use the -c parameter for all rsnapshot commands.  Let’s start by testing the config:

root@backup:/etc# rsnapshot -c /etc/rsnapshot.conf.server1 configtest
Syntax OK

Now we can run a simulation:

root@backup:/etc# rsnapshot -c /etc/rsnapshot.conf.server1 -t hourly
echo 9633 > /var/run/rsnapshot.pid
mkdir -m 0755 -p /backups/hourly.0/
/usr/bin/rsync -a --stats --delete --numeric-ids --relative --delete-excluded 
--exclude-from=/etc/rsnapshot.server1.exclude --rsh=/usr/bin/ssh -p 8989 
-i ~/.ssh/backup root@server1.lowend.party:/data/ 
/backups/hourly.0/server1.lowend.party/
touch /backups/hourly.0/

One more thing to do.  I like to use rsnapshot’s reporting tool, so let’s enable it:

cp /usr/share/doc/rsnapshot/examples/utils/rsnapreport.pl /usr/local/bin
chmod 755 /usr/local/bin/rsnapreport.pl 

We’re good to go!

On server1, I have 547MB in /data, and 30MB in /data/cache which will be excluded:

root@server1:~# du -sm /data
547 /data
root@server1:~# du -sm /data/cache
30 /data/cache

Let’s run our first rsnapshot backup:

root@backup:/backups/server1.lowend.party# rsnapshot -c /etc/rsnapshot.conf.server1 hourly
Setting locale to POSIX "C"
echo 10012 > /var/run/rsnapshot.pid
mkdir -m 0755 -p /backups/server1.lowend.party/hourly.0/
/usr/bin/rsync -av --stats --delete --numeric-ids --relative 
--delete-excluded --exclude-from=/etc/rsnapshot.server1.exclude 
--rsh=/usr/bin/ssh -p 8989 -i ~/.ssh/backup 
root@server1.lowend.party:/data/ 
/backups/server1.lowend.party/hourly.0/.
receiving incremental file list
data/
<snipped>
data/cache/

Number of files: 10,982 (reg: 10,980, dir: 2)
Number of created files: 10,982 (reg: 10,980, dir: 2)
Number of deleted files: 0
Number of regular files transferred: 10,980
Total file size: 518,702,282 bytes
Total transferred file size: 518,702,282 bytes
Literal data: 518,702,282 bytes
Matched data: 0 bytes
File list size: 611,123
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 208,691
Total bytes received: 519,874,481

sent 208,691 bytes received 519,874,481 bytes 80,012,795.69 bytes/sec
total size is 518,702,282 speedup is 1.00
touch /backups/server1.lowend.party/hourly.0/
rm -f /var/run/rsnapshot.pid
/usr/bin/logger -p user.info -t rsnapshot(10012) /usr/bin/rsnapshot -c 
/etc/rsnapshot.conf.server1 hourly: completed successfully

Now I can also run that using the rsnapshotreport.pl script we setup.  If I do, the output will look like this (the TOTAL MB is a little different because I ran these at different times):

# rsnapshot -c /etc/rsnapshot.conf.server1 hourly | /usr/local/bin/rsnapshotreport.pl
SOURCE TOTAL FILES FILES TRANS TOTAL MB MB TRANS LIST GEN TIME FILE XFER TIME
--------------------------------------------------------------------------------------------------------------------
server1.lowend.party:/data/ 11982 1 564.81 46.10 0.001 seconds 0.000 seconds

Now if I continue running hourly backups, I see new directories being created in /backups/server1.lowend.party:

drwxr-xr-x 3 root root 4096 Jul 12 16:03 hourly.0
drwxr-xr-x 3 root root 4096 Jul 12 16:01 hourly.1
drwxr-xr-x 3 root root 4096 Jul 12 15:58 hourly.2

Interestingly, hourly.0 is 500-odd MB, will the rest are only 1MB.  Why?  Because hourly.1, hourly.2, etc. are simply hard links back to hourly.0.  This is a huge space savings.

If I nuke some files on server1’s /data and run another couple backups, you’ll see this:

root@backup:/backups/server1.lowend.party# du -sm *
526 hourly.0
39 hourly.1
1 hourly.2
1 hourly.3

rsnapshot is retaining data in hourly.1 because it’s needed to reconstruct the backups for that hour.

Setting up automated backups is as easy as putting jobs in cron.  For example:

MAILTO=you@somewhere.com
0 * * * * root /usr/bin/rsnapshot -c /etc/rsnapshot.conf.server1 hourly 2>&1 | /usr/local/bin/rsnapreport.pl
0 3 * * * root /usr/bin/rsnapshot -c /etc/rsnapshot.conf.server1 daily 2>&1 | /usr/local/bin/rsnapreport.pl 
0 3 * * 1 root /usr/bin/rsnapshot -c /etc/rsnapshot.conf.server1 weekly 2>&1 | /usr/local/bin/rsnapreport.pl
30 2 1 * * root /usr/bin/rsnapshot -c /etc/rsnapshot.conf.server1 monthly 2>&1 | /usr/local/bin/rsnapreport.pl

Now

raindog308

I’m Andrew, techno polymath and long-time LowEndTalk community Moderator. My technical interests include all things Unix, perl, python, shell scripting, and relational database systems. I enjoy writing technical articles here on LowEndBox to help people get more out of their VPSes.

How many customer backups do you retain?

Until now, we have kept 7 daily backups, 4 weekly backups, and 1 monthly backup.

We’re thinking to change to 30 daily backups. (So custo… | Read the rest of https://www.webhostingtalk.com/showthread.php?t=1842739&goto=newpost

7 – It’s not allowed to store backups inside the Drupal root directory

I must be missing something because I can’t determine what I’m doing wrong. I’ve got a D7 site, and we’re running Drush 8.1.10

I’m trying to run through some updates but I keep running into this error:

It's not allowed to store backups inside the Drupal root directory.

I don’t have the backups directory inside the drupal root directory – or at least so far as I know, it’s not. I’ve set the directory to be one level above the webroot and declared it in my settings.php as follows:

/** declaring the private files directory 
*/
$settings['file_private_path'] = '/var/www/vhosts/drush-backups';

In my file system I’ve also got my private files path set to the same to the same dir just trying to figure out where this issue is coming from.

Can someone help me figure out what I’m missing?

50% OFF >> 6/year – linux SSD – Unlimited Bandwidth – Free Domains & SSL – Daily Backups | NewProxyLists

Hostpoco.com specializes in making reliable hosting affordable. Offering affordable web hosting at a great price is our passion and always will be. We provide blazing-fast SSD web hosting, with our servers maintaining more than 99.9% uptime. We care about your website and data, so we provide free daily backups and our servers are protected with a Web Application Firewall (WAF) for maximum security.

Whether it be shared web hosting or reseller web hosting, you can rest assured you are receiving the best possible price and service with Hostpoco.com!

Payment methods: PayPal, Razorpay, Stripe.

Promotion Code: “HP50” for 50% discount on any plan

Linux Shared Hosting Features:
– Latest cPanel Control Panel
– 24/7 Technical Support
– Money-Back Guarantee
– 99.9% Uptime Guarantee
– Softaculous Auto Installer
– Server Level Protection
– Unlimited Bandwidth
– Free Let’s Encrypt SSL
– Unlimited Sub-Domains
– Unlimited MySQL Databases
– Unlimited Email Accounts
– Unlimited FTP Accounts
– FREE Online Sitebuilder
– FREE Auto SSL
– CloudLinux
– Cloudflare
– Unlimited Parked Domains
– FREE DDOS Protection
– FREE Backup Restore
– FREE PhpMyAdmin
– FREE Virus Scanner

Detailed Plan Info: https://www.hostpoco.com/one-dollar-cheap-ssd-hosting.php

For more web hosting plans, please visit our website: https://www.hostpoco.com/
Should you have any questions, email us: sales@hostpoco.com

 

50% OFF >> 6/year – Linux SSD – Unlimited Bandwidth – Free Domains & SSL – Daily Backups | Forum Promotion

30% OFF – Reseller Hosting – cPanel & WHM | SSD | CloudLinux | Backups | 99.9% Uptime – VernalWeb | NewProxyLists

VernalWeb is offering 30% discount on the first invoice (Up to 12 months) for all SSD Reseller Hosting plans. For a limited time only, new customers can receive 30% DISCOUNT on any of our reseller web hosting plans.

Coupon Code: SmartWay

Code will be applied on regular price & Discount Price will be shown at Checkout

Coupon rules:
• Valid for all customers.
• This coupon can’t be used with any other special offer.
• This coupon is only available on 1, 6 or 12-month billing terms.
——————————————————————

Lots Of Free Gifts
• Free Domain (Yearly Term)
• Free CloudFlare CDN
• Free SSL
• Free Migration
• Free Daily Backups(No Extra Charge)
• Free DDoS Protection
• Free SEO Tools

Included with all shared hosting accounts:
* WHM Control Panel
* cPanel Control Panel
* Softaculous Script Auto-installer (Hundreds of one-click install scripts!)
* SNI Supported
* High-Redundancy RAID 10 Arrays
* WordPress Optimized
* Developer Friendly Atmosphere
* E-commerce Ready!
* Secure IMAP & POP3
* Apache Handlers
* FREE Website Migrations (We will migrate your current website, free of charge!)

Blazing Fast Server Hardware, Premium Bandwidth:
We SPARE NO EXPENSE for our offer! Our newest shared servers are purpose-built for performance using enterprise components, including RAID-10 SSDs for all storage.

SSD Reseller Hosting Plans

StartMe Plan
25GB Pure SSD Storage
250GB Data Transfer
25 cPanel Accounts
Free Domain Registration
Unlimited Subdomains
Unlimited E-mail Addresses
Unlimited MySQL Databases
Unlimited FTP Accounts
1-Click Software Installations
Instant Activation

Order Now!

GoodFace Plan
50GB Pure SSD Storage
500GB Data Transfer
50 cPanel Accounts
Free Domain Registration
Unlimited Subdomains
Unlimited E-mail Addresses
Unlimited MySQL Databases
Unlimited FTP Accounts
1-Click Software Installations
Instant Activation

Order Now!

FineGrow Plan
100GB Pure SSD Storage
1000GB Data Transfer
100 cPanel Accounts
Free Domain Registration
Unlimited Subdomains
Unlimited E-mail Addresses
Unlimited MySQL Databases
Unlimited FTP Accounts
1-Click Software Installations
Instant Activation

Order Now!

If you need any further information or help please feel free to contact us at Help Desk

Why VernalWeb?
• Instant Activation
• Multiple Locations
• Solid State Drive makes your website 20X faster
• 24X7 In-house Support via Phone or Email
• Lowest Pricing in the industry
• Enterprise Grade Server with reliability and Stability
• CloudLinux
• Multiple PHP versions (PHP4.4, PHP5.1, PHP5.2, PHP5.3, PHP5.4, PHP5.5, PHP5.6, PHP7.0, PHP7.1, PHP7.2, PHP7.3, PHP7.4)
• 99.9% Uptime Guarantee
• 30 Days Money Back Guarantee
• 1 Click Software Installer
• No overloaded Servers
• Easy Control Panel (WHM)

Get in touch with us:
Facebook | Twitter | Pinterest | LinkedIn

CPanel Offsite Backups

Where do I find a CPanel Shared Host with automated, user-level, offsite backups?
If the meteor hits the hosting company, local backups are… | Read the rest of https://www.webhostingtalk.com/showthread.php?t=1840213&goto=newpost

30% OFF – Reseller Hosting – cPanel & WHM | SSD | CloudLinux | Backups | 99.9% Uptime – VernalWeb | NewProxyLists

VernalWeb is offering 30% discount on the first invoice (Up to 12 months) for all SSD Reseller Hosting plans. For a limited time only, new customers can receive 30% DISCOUNT on any of our reseller web hosting plans.

Coupon Code: SmartWay

Code will be applied on regular price & Discount Price will be shown at Checkout

Coupon rules:
• Valid for all customers.
• This coupon can’t be used with any other special offer.
• This coupon is only available on 1, 6 or 12-month billing terms.
——————————————————————

Lots Of Free Gifts
• Free Domain (Yearly Term)
• Free CloudFlare CDN
• Free SSL
• Free Migration
• Free Daily Backups(No Extra Charge)
• Free DDoS Protection
• Free SEO Tools

Included with all shared hosting accounts:
* WHM Control Panel
* cPanel Control Panel
* Softaculous Script Auto-installer (Hundreds of one-click install scripts!)
* SNI Supported
* High-Redundancy RAID 10 Arrays
* WordPress Optimized
* Developer Friendly Atmosphere
* E-commerce Ready!
* Secure IMAP & POP3
* Apache Handlers
* FREE Website Migrations (We will migrate your current website, free of charge!)

Blazing Fast Server Hardware, Premium Bandwidth:
We SPARE NO EXPENSE for our offer! Our newest shared servers are purpose-built for performance using enterprise components, including RAID-10 SSDs for all storage.

SSD Reseller Hosting Plans

StartMe Plan
25GB Pure SSD Storage
250GB Data Transfer
25 cPanel Accounts
Free Domain Registration
Unlimited Subdomains
Unlimited E-mail Addresses
Unlimited MySQL Databases
Unlimited FTP Accounts
1-Click Software Installations
Instant Activation

Order Now!

GoodFace Plan
50GB Pure SSD Storage
500GB Data Transfer
50 cPanel Accounts
Free Domain Registration
Unlimited Subdomains
Unlimited E-mail Addresses
Unlimited MySQL Databases
Unlimited FTP Accounts
1-Click Software Installations
Instant Activation

Order Now!

FineGrow Plan
100GB Pure SSD Storage
1000GB Data Transfer
100 cPanel Accounts
Free Domain Registration
Unlimited Subdomains
Unlimited E-mail Addresses
Unlimited MySQL Databases
Unlimited FTP Accounts
1-Click Software Installations
Instant Activation

Order Now!

If you need any further information or help please feel free to contact us at Help Desk

Why VernalWeb?
• Instant Activation
• Multiple Locations
• Solid State Drive makes your website 20X faster
• 24X7 In-house Support via Phone or Email
• Lowest Pricing in the industry
• Enterprise Grade Server with reliability and Stability
• CloudLinux
• Multiple PHP versions (PHP4.4, PHP5.1, PHP5.2, PHP5.3, PHP5.4, PHP5.5, PHP5.6, PHP7.0, PHP7.1, PHP7.2, PHP7.3, PHP7.4)
• 99.9% Uptime Guarantee
• 30 Days Money Back Guarantee
• 1 Click Software Installer
• No overloaded Servers
• Easy Control Panel(WHM)

Get in touch with us:
Facebook | Twitter | Pinterest | LinkedIn

Selling – WSR – improves SEO and conversion! CDN + Firewall + SSL + Backups + AV + Monitoring | NewProxyLists

The speed, stability and security of your website significantly affect:

  • SEO (in a direct way and also affect user experience)
  • Conversion
  • The effectiveness of advertising investments

Everything you need to know about WSR in order to start using it right now:

  • Your website will be perfectly fast and reliable
  • 100% money-back guarantee within the first 30 days – you risk nothing
  • Turnkey setup – you don’t have to waste your time
  • Affordable prices – flexible solutions for any business

1. Page speed

Our CDN specializes in dynamic content caching.
With proper caching, the loading speed of each page is 0.02-0.2s. in most regions.

Check your site at webpagetest.org or at tools.pingdom.com and compare with our metrics!

Benefits:

  • No need to think about cache existence
  • No need to install anything on your website
  • Most websites are fully cached by default
  • Complex projects such as some online stores, can be flexibly configured to cache only specific visitors or to cache under specific conditions (robots, visitors who have not yet performed any actions on the site – commenting, adding products to the cart)
  • Large and growing network – 49 regions around the world
  • 100% uptime guarantee

In addition to smart caching our CDN will also provide you with:

  • Effective image optimization
  • Minification for CSS, JS, HTML
  • Brotli compression
  • Preload critical resources to browser
  • The complex of “Turbo-HTTPS” technologies
  • Network optimizations
  • And many others. Plus you’ll get an increase of Google PageSpeed scores!

2. Security

  • Fully customizable firewall with ready-made profiles for many popular CMS (including protection against hacking and brute force)
  • The most efficient backup system with changes control and antivirus makes it easy to find and restore virus-infected files or any other appeared problems
  • The scanner that checks the site for new or suspicious script inserts, external links and other factors at the HTML level, allows you to detect problems even faster
  • Free SSL certificates from Let’s Encrypt
  • Full guarantee against website malware infections (included in the option of individual security settings)

3. Reliability

  • Powerful website health monitoring system
  • E-mail, SMS and Telegram notifications about breakdowns or security problems
  • Uptime protection – even if your hosting server goes down, the site will be accessible to visitors from an archive copy
  • Service integration with multi-server projects is available

w.tools
* Promo code – “WSR-2021” (-25% discount for your first order)

 

Selling – WSR – improves SEO and conversion! CDN + Firewall + SSL + Backups + AV + Monitoring | NewProxyLists

The speed, stability and security of your website significantly affect:

  • SEO (in a direct way and also affect user experience)
  • Conversion
  • The effectiveness of advertising investments

Everything you need to know about WSR in order to start using it right now:

  • Your website will be perfectly fast and reliable
  • 100% money-back guarantee within the first 30 days – you risk nothing
  • Turnkey setup – you don’t have to waste your time
  • Affordable prices – flexible solutions for any business

1. Page speed

Our CDN specializes in dynamic content caching.
With proper caching, the loading speed of each page is 0.02-0.2s. in most regions.

Check your site at webpagetest.org or at tools.pingdom.com and compare with our metrics!

Benefits:

  • No need to think about cache existence
  • No need to install anything on your website
  • Most websites are fully cached by default
  • Complex projects such as some online stores, can be flexibly configured to cache only specific visitors or to cache under specific conditions (robots, visitors who have not yet performed any actions on the site – commenting, adding products to the cart)
  • Large and growing network – 49 regions around the world
  • 100% uptime guarantee

In addition to smart caching our CDN will also provide you with:

  • Effective image optimization
  • Minification for CSS, JS, HTML
  • Brotli compression
  • Preload critical resources to browser
  • The complex of “Turbo-HTTPS” technologies
  • Network optimizations
  • And many others. Plus you’ll get an increase of Google PageSpeed scores!
  1. Security
  • Fully customizable firewall with ready-made profiles for many popular CMS (including protection against hacking and brute force)
  • The most efficient backup system with changes control and antivirus makes it easy to find and restore virus-infected files or any other appeared problems
  • The scanner that checks the site for new or suspicious script inserts, external links and other factors at the HTML level, allows you to detect problems even faster
  • Free SSL certificates from Let’s Encrypt
  • Full guarantee against website malware infections (included in the option of individual security settings)
  1. Reliability
  • Powerful website health monitoring system
  • E-mail, SMS and Telegram notifications about breakdowns or security problems
  • Uptime protection – even if your hosting server goes down, the site will be accessible to visitors from an archive copy
  • Service integration with multi-server projects is available

w.tools
* Promo code – “WSR-2021” (-25% discount for your first order)