Backup and Restore Valeria Mazzola mazzolavale1@gmail.com Corsi - - PowerPoint PPT Presentation

backup and restore
SMART_READER_LITE
LIVE PREVIEW

Backup and Restore Valeria Mazzola mazzolavale1@gmail.com Corsi - - PowerPoint PPT Presentation

Backup and Restore Valeria Mazzola mazzolavale1@gmail.com Corsi GNU/Linux Avanzati 2016 Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 1 / 19 What are backups? Definition The copying and archiving of computer data so that it


slide-1
SLIDE 1

Backup and Restore

Valeria Mazzola mazzolavale1@gmail.com Corsi GNU/Linux Avanzati 2016

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 1 / 19

slide-2
SLIDE 2

What are backups?

Definition

The copying and archiving of computer data so that it may be used to restore the original after a data loss event.

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 2 / 19

slide-3
SLIDE 3

Why backups?

Bad things can and do happen A disk can break if dropped

  • r shaken...

...or will just die of old age

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 3 / 19

slide-4
SLIDE 4

What (not) to back up

Do: /home Maybe: /etc /var Don’t: /proc /sys /tmp /dev /mnt /media

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 4 / 19

slide-5
SLIDE 5

Backup types

Backups can be full - a backup of all the files and folders incremental - an incremental backup contains all the differences since the last incremental backup differential - a differential backup contains the changes since the last full backup

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 5 / 19

slide-6
SLIDE 6

Where do I put my data?

Optical supports: CDs, DVDs, Blu-ray Hard disks (HDD) Solid-state drives (SSD) Flash drives Cloud storage services

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 6 / 19

slide-7
SLIDE 7

dd

dd is a simple tool that can be used for disk cloning dd if=/dev/sdX of=/dev/sdY && sync

if: input file

  • f: output file

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 7 / 19

slide-8
SLIDE 8

GNU ddrescue

gddrescue copies data from one file or block device to another, trying hard to rescue the good parts first in case of read errors ddrescue [options] /dev/sdX outfile mapfile

mapfile: a human readable text file ddrescue uses to manage the copy

warning

for the rescued data to be correct, both dd and gddrescue are best used on unmounted devices

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 8 / 19

slide-9
SLIDE 9

GNU ddrescue

gddrescue copies data from one file or block device to another, trying hard to rescue the good parts first in case of read errors ddrescue [options] /dev/sdX outfile mapfile

mapfile: a human readable text file ddrescue uses to manage the copy

warning

for the rescued data to be correct, both dd and gddrescue are best used on unmounted devices

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 8 / 19

slide-10
SLIDE 10

rsync

also known as an advanced version of cp

Pros

(unlike cp) preserves hard and symbolic links, file permissions and

  • wnership, modification times, etc

designed to be network efficient: only transfers file changes easy to use

Cons

no storage encryption

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 9 / 19

slide-11
SLIDE 11

rsync: usage

$ rsync -Pr source destination

P: keep partially transferred files if the transfer is interrupted r: recursive directory option

$ rsync source host:destination

uses ssh by default, but can also be forced with the -e ssh option

$ rsync -aAXv --exclude={...} /* /backup_folder

backup /* while following symlinks and preserving file properties

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 10 / 19

slide-12
SLIDE 12

rsync: usage

$ rsync -Pr source destination

P: keep partially transferred files if the transfer is interrupted r: recursive directory option

$ rsync source host:destination

uses ssh by default, but can also be forced with the -e ssh option

$ rsync -aAXv --exclude={...} /* /backup_folder

backup /* while following symlinks and preserving file properties

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 10 / 19

slide-13
SLIDE 13

rsync: usage

$ rsync -Pr source destination

P: keep partially transferred files if the transfer is interrupted r: recursive directory option

$ rsync source host:destination

uses ssh by default, but can also be forced with the -e ssh option

$ rsync -aAXv --exclude={...} /* /backup_folder

backup /* while following symlinks and preserving file properties

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 10 / 19

slide-14
SLIDE 14

rsnapshot: rsync automated

rsnapshot produces automated, periodical system snapshots

Pros

preserves hard and symbolic links, file permissions and ownership, modification times, etc network efficient each snapshot contains a full system backup easy to use

Cons

no storage encryption

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 11 / 19

slide-15
SLIDE 15

duplicity

duplicity produces encrypted, incremental backups in tar format

Pros

preserves hard and symbolic links, file permissions and ownership, modification times, etc network efficient incremental backups supports storage encryption with gpg easy to use

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 12 / 19

slide-16
SLIDE 16

duplicity: usage

duplicity /home/me scp://user@host//some/directory duplicity [restore] scp://user@host//some/directory /home/me duplicity full /home/me scp://user@host//some/directory

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 13 / 19

slide-17
SLIDE 17

duplicity: usage

duplicity /home/me scp://user@host//some/directory duplicity [restore] scp://user@host//some/directory /home/me duplicity full /home/me scp://user@host//some/directory

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 13 / 19

slide-18
SLIDE 18

duplicity: usage

duplicity /home/me scp://user@host//some/directory duplicity [restore] scp://user@host//some/directory /home/me duplicity full /home/me scp://user@host//some/directory

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 13 / 19

slide-19
SLIDE 19

duplicity: usage

duplicity list-current-files scp://user@host//some/directory

list the files contained in the backup

duplicity [restore] -t 3D scp://user@host//some/directory /home/me

  • t: specify the time from which to restore files

duplicity remove-older-than 30D scp://user@host//some/directory

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 14 / 19

slide-20
SLIDE 20

duplicity: usage

duplicity list-current-files scp://user@host//some/directory

list the files contained in the backup

duplicity [restore] -t 3D scp://user@host//some/directory /home/me

  • t: specify the time from which to restore files

duplicity remove-older-than 30D scp://user@host//some/directory

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 14 / 19

slide-21
SLIDE 21

duplicity: usage

duplicity list-current-files scp://user@host//some/directory

list the files contained in the backup

duplicity [restore] -t 3D scp://user@host//some/directory /home/me

  • t: specify the time from which to restore files

duplicity remove-older-than 30D scp://user@host//some/directory

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 14 / 19

slide-22
SLIDE 22

rdiff-backup

another utility for incremental backups

Pros

preserves hard and symbolic links, file permissions and ownership, modification times, etc network efficient incremental backups easy to use

Cons

no storage encryption

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 15 / 19

slide-23
SLIDE 23

Demo

Demo!

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 16 / 19

slide-24
SLIDE 24

One last thing

Remember to keep a copy of your private key!

without it, you won’t be able to decrypt your own backups :)

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 17 / 19

slide-25
SLIDE 25

References

https://en.wikipedia.org/wiki/Incremental_backup https://en.wikipedia.org/wiki/Differential_backup https://wiki.archlinux.org/.../Full_system_backup_with_rsync https://wiki.archlinux.org/index.php/Duplicity http://duplicity.nongnu.org http://www.nongnu.org/rdiff-backup/index.html https://www.digitalocean.com/community/tutorials/how-to-use- duplicity-with-gpg-to-securely-automate-backups-on-ubuntu https://blog.roundside.com/duplicity-vs-rdiff-backup-in-action/ Unix and Linux system administration handbook, fourth edition, Evi Nemeth, Garth Snyder, Trent R. Hein, Ben Whaley

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 18 / 19

slide-26
SLIDE 26

Thank you

Thank you!

These slides are published under a Creative Commons Attribution-ShareAlike 4.0 license.

https://www.poul.org

Valeria Mazzola Backup and Restore Corsi Linux Avanzati 2016 19 / 19