✓ Solved

How to backup block storage to object storage

I have a block storage volume that is mounted to a directory on my Linode which is Ubuntu 18.04. I want to backup this directory periodically to object storage bucket. I'm not able to find a guide for it and I'm completely new to "buckets".

I imagine rsync will be used for it but I'm completely lost as to where to begin. A beginner friendly guide would be much appreciated. :)

5 Replies

✓ Best Answer

I have a guide currently waiting to be published that uses Restic to do exactly that.

Restic creates and maintains a repository of backups on Object Storage and can back up the file system to it.

You can then query the repository using Restic to restore any file from any point in time.

Here’s one I wrote specifically about MySQL - you can use that as a starting point. It dumps the MySQL DBs to the file system, then backs up the directory they’re dumped to.

You can skip the dump step, and backup your block storage mount point instead of the /var/backups/mariadb directory.

https://www.linode.com/docs/guides/backup-mariadb-mysql-to-object-storage-with-restic/

How come you decide to use Restic over rsync?

How come you decide to use Restic over rsync?

At the risk of speaking for @andysh here, rsync won't work with object storage. rsync copies to files that may or may not be remote. Object storage buckets are not ordinary Linux files…object storage is a completely different scheme -- based on collections ("buckets") of key/value pairs referenced by URLs.

In short, object storage and block storage are not the same. Object storage doesn't look like nor is it accessed like a typical file system. Don't be fooled into thinking that the:

rsync://[[[user[@host]]]/]some/path/to/your/file

notation rsync uses is a regular URL like

https://yourdomain.com/some/path/to/your/file


It's not. The notation is an rsync-only thing. rsync doesn't understand https and web servers don't understand rsync.

See:

https://cloud.netapp.com/blog/block-storage-vs-object-storage-cloud

for more info. The article is strictly about Amazon AWS block- and object storage but it works (mostly) the same way on Linode.

-- sw

Ahh alright. Well the guide is superb. I was able to create my first backup :D

@andysh Just want to share some feedback to the guide

  1. Before You Begin section, point 5. The Ubuntu command should be apt install wget bzip2. That is what worked for me.
  2. Install Restic section, point 3. I had to move it to /usr/local/restic for it to work. Maybe that's Ubuntu specific.
  3. An example command for forget and prune would be useful. Although I did figure it out from restic's docs.

Thanks a lot for the guide!

Hi @VipulK

How come you decide to use Restic over rsync?

As @stevewi said, rsync works with file systems, not object storage systems like S3.

Plus Restic holds a repository of backups, allowing you to fetch a version of a file from a point in time. Rsync only syncs a “current” version of a file system tree.

Just want to share some feedback to the guide

Thanks so much for the feedback, I’m really glad you found it useful and got up and running.

Point 1: you are absolutely correct, it is bzip2 on Ubuntu systems. I wonder if it’s bzip on RHEL-based systems and I’ve got it the wrong way round?

Point 2: Restic is in /usr/local/bin on my Ubuntu systems and this works fine. Maybe /usr/local/bin is not in your $PATH?

Point 3: yeah I agree, the guide was about getting backups up and running, I might do a follow up guide for maintenance.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct