• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

I want to learn about backup in Linux

dkm777

Senior member
Hi guys,

I'm running a Debian server and would like to know what are the most popular and reliable methods of backing up the system. Essentially I want to learn how to make a system image in case the main HDD dies and to automate the process. Under Windows I use this very nice piece of software called Macrium Reflect and it can create a system image of a "live" OS. Are there any similar tools available under Linux that I could use to do something like that? Maybe there are some in-depth articles about this that I could study?
 
I'm not aware of imaging tools for Linux, though something like Acronis will work. Once I have a server setup and configured I normally take a base image so I can get running quickly if the drive dies.

For file backups, take a look at rsync. Using key pair authentication you can also do remote rsync backups.

This is a doc I wrote for my own reference on how to set this up: (I should probably put this online somewhere with better details)

How to configure rsync backups over key pair ssh


Server to backup to: srv_tx (pull data from srv_rx)
Server to backup: srv_rx


1: Generate key pair

On srv_tx:

Type ssh-keygen –t rsa [enter] and choose a location for the key pair

Basics:
File with no ext is specified by client to access server
.pub file is appended to server's /home/[user]/.ssh/authorized_keys


DO NOT enter a passphrasae

2: Distribute keys

On srv_rx in the user’s home directory create this file:

~/.ssh/authorized_keys

In it put the contents of the .pub key created in step 1 and make sure its chmodded 700 as well as the key files on srv_tx

Srv_tx now has passwordless access to srv_rx


Automated ssh access:

To execute a remote script on srv_rx from srv_tx:

ssh -p [port] –i [keyfile] [user]@srv_rx ‘cd dir;./runscript’

Automated Rsync backups:

To backup a dir of srv_rx to another dir on srv_tx:

rsync --delete-during --verbose --checksum --recursive --links --times --perms --rsh="ssh -p [port] -i [keyfile]” [user]@srv_rx:[remotedir] [backupdest]

To push backups, reverse:
[user]@srv_rx:[remotedir] [backupdest]
 
For hardcore, you can use "dd" to do a binary backup. However, if you're only dealing with files and what not, why not just use rsync. If you need history on some files < 10G, git would work very nicely too.
 
Did you checkout clonezilla?

Not yet. You have to boot into clonezilla live-cd, right? I will give it a try, in a couple of days, as I could not find a better option. I really like the way dd works, which is why I was more interested in a command line tool.

Edit: I just tried clonezilla on my VitualBox Mint. It cannot clone to a smaller partition. "Target partition size (8334 MB) is smaller than source (53430 MB)". So what is the difference between dd and clonezilla?

http://ubuntuforums.org/archive/index.php/t-1783225.html
 
Last edited:
Not yet. You have to boot into clonezilla live-cd, right? I will give it a try, in a couple of days, as I could not find a better option. I really like the way dd works, which is why I was more interested in a command line tool.

Edit: I just tried clonezilla on my VitualBox Mint. It cannot clone to a smaller partition. "Target partition size (8334 MB) is smaller than source (53430 MB)". So what is the difference between dd and clonezilla?

http://ubuntuforums.org/archive/index.php/t-1783225.html

You can use the -icds option to allow it to clone to a smaller drive (just be sure it will fit or you are in some shit).

Even with dd you should not use it on the drive that is currently in use by the operating system. It isn't going to be a stable clone. It's always better to boot from the network/usb/cd/etc and then do your clone.
 
Back
Top