Remote snapshot backups with rsync and Samba

Technology

Thanassis Tsiodras writes:

What would you do if you had to automatically backup a remote Linux box (e.g. your web server), and all you had locally was Windows machines? How about this:

  1. automatically expanding local storage space
  2. transmissions of differences only
  3. automatic scheduling
  4. local storage of differences only
  5. secure and compressed transfer of remote data and
  6. instant filesystem navigation inside daily snapshot images

I covered all these requirements using open source tools, and I now locally backup our 3GB remote server in less than 2min!

We’ve all used Samba and rsync before, but Thanassis has really put all the pieces together into a complete backup system that’s superior to a lot of commercial products I’ve seen.

The really impressive bit is how he’s easily doing snapshot images using filesystem hardlinks. You can save several days worth of snapshots at very little cost because additional space is only taken up by files that have changed. Using hardlinks, identical files from different snapshots all point to the same inode.

root# mount /dev/loop0 /mnt/backup
root# cd /mnt/backup
root# rm -rf OneBeforeLast
root# cp -al LastBackup OneBeforeLast
root# cd LastBackup
root# rsync -avz --delete root@hosting.machine.in.US:/ ./

The “cp -al” creates a zero-cost copy of the data (using hardlinks, the only price paid is the one of the directory entries, and ReiserFS is well known for its ability to store these extremely efficiently). Then, rsync is executed with the –delete option: meaning that it must remove from our local mirror all the files that were removed on the server – and thus creating an accurate image of the current state.

And here’s the icing on the cake: The data inside these files are not lost! They are still accessible from the OneBeforeLast/ directory, since hard links (the old directory entries) are pointing to them!

In plain terms, simple navigation inside OneBeforeLast can be used to examine the exact contents of the server as they were BEFORE the last mirroring.

Just imagine the data recovery headaches you could solve by adapting that to a cron job that shuffles a months worth of nightly backups.

Optimal remote Linux backups with rsync over Samba – Link

1 thought on “Remote snapshot backups with rsync and Samba

  1. Kits Para escritorio says:

    I hope this information has given a bit of food for
    thought. You might discover that items made for use outside
    are going to be the most visible as much people spend virtually
    all their time experiencing the warm weather. No matter where they
    wear their branded shirts, hats, or jackets,
    your logo gains visibility within the marketplace.

Comments are closed.

Discuss this article with the rest of the community on our Discord server!
Tagged

ADVERTISEMENT

Maker Faire Bay Area 2023 - Mare Island, CA

Escape to an island of imagination + innovation as Maker Faire Bay Area returns for its 15th iteration!

Buy Tickets today! SAVE 15% and lock-in your preferred date(s).

FEEDBACK