8 Ways to Backup Linux System


Data loss is an error condition in information systems in which information is destroyed by failures or neglect in storage, transmission, or processing.

Information systems implement backup and disaster recovery equipment and processes to prevent data loss or restore lost data.More at Data Loss


[1] Using rsync:rsync stands for remote sync

Syntax:
$ rsync options source destination
$ rsync -zvr /var/opt/installation/inventory/ /root/temp
$ rsync -zvr /var/opt/installation/inventory/ hdhamee@remotehost.com:/root/temp
where
-z is to enable compression
-v verbose
-r indicates recursive



more at rsync

[2] Using rsnapshot

Download the rsnapshot utility from rsnapshot.org as shown below.

$ cd /usr/src
$ suodo wget http://www.rsnapshot.org/downloads/rsnapshot-1.3.1.tar.gz
$ sudo tar xvfz rsnapshot-1.3.1.tar.gz
$ cd rsnapshot-1.3.1
$ ./configure --sysconfdir=/etc
$ sudo make install



Configure:
$ sudo cp /etc/rsnapshot.conf.default /etc/rsnapshot.conf
$ sudo vim /etc/rsnapshot.conf
  cmd_cp /bin/cp
  cmd_ssh /usr/bin/ssh
  cmd_du /usr/bin/du
  cmd_rsnapshot_diff /usr/local/bin/rsnapshot-diff
  logfile /var/log/rsnapshot
  backup /etc/ localhost/

Now test configuration:

$ rsnapshot configtest
Syntax OK

Verify the hourly backup configuration.
$ sudo rsnapshot -t hourly

Verify the daily rsnapshot cwrsync backup process is configured properly.
$ sudo rsnapshot -t daily

Add Crontab Entry for rsnapshot
$ crontab -e
0 */4 * * * /usr/local/bin/rsnapshot hourly
30 23 * * * /usr/local/bin/rsnapshot daily

Verify backup

$ sudo ls -al /.snapshots/
ls: /.snapshots/: No such file or directory



[3] Using dd Command [backup entire harddisk]

To backup an entire copy of a hard disk to another hard disk connected to the same system

$ dd if=/dev/sda of=/dev/sdb

Where:
if=input file
of=outputfile

[4] Using dd Command [create an image of harddisk]

$ sudo dd if=/dev/hda of=~/hdadisk.img

Restore using:
$ sudo dd if=hdadisk.img of=/dev/hdb

Where:

if=input file
of=outputfile

[5] Using dd Command [create a floppy image]

$ sudo dd if=/dev/fd0 of=myfloppy.img
Where:
if=input file
of=outputfile

[6] Using dd Command [backup a partition]

$ sudo dd if=/dev/hda1 of=~/partition1.img
Where:
if=input file
of=outputfile

[7] Using dd Command[CD ROM backup]

$ sudo dd if=/dev/cdrom of=tgsservice.iso bs=2048 
Where:
if=input file
of=outputfile

[8] Using Clonezilla  

Clonezilla site