Rsync home: differenze tra le versioni

Da PNLUG.
(Locale)
(Copiare tutto o solo cio che ci server)
Riga 49: Riga 49:
  
 
possiamo dargli un path di directory da escludere.
 
possiamo dargli un path di directory da escludere.
 +
 +
 +
===Esempio di file exclude ===
 +
 +
# rsync-homedir-excludes
 +
#
 +
# A list of files to exclude when backing up *nix home directories using rsync.
 +
#
 +
# Author: Ruben Barkow <https://github.com/rubo77/rsync-homedir-excludes>
 +
# Version: 2015-08-30
 +
 +
 +
# directories, probably not worth a backup:
 +
#Downloads
 +
#games
 +
#VirtualBox*
 +
#.vagrant
 +
#.vagrant.d
 +
#.android
 +
#.AndroidStudioBeta
 +
#.gradle
 +
#.gvm
 +
#.grails/
 +
#.grails_history
 +
#.local/share/notbit/
 +
#.wine
 +
 +
# games
 +
#.minecraft
 +
#.PlayOnLinux
 +
#.local/share/Steam/
 +
 +
#These directories may be excluded:
 +
 +
# contains mounted file systems
 +
.gvfs
 +
.local/share/gvfs-metadata
 +
# contains the actual encrypted home directory
 +
.Private
 +
# session-specific
 +
.dbus
 +
.cache
 +
.Trash
 +
.local/share/Trash
 +
# cached info about audio CDs
 +
.cddb
 +
# cached packages lists
 +
.aptitude
 +
 +
#Flash-specific:
 +
 +
# Cache for flash, maybe others?
 +
.adobe
 +
# except for Flash persistence, there is no reason to keep this
 +
.macromedia
 +
 +
#Files:
 +
 +
# contains errors from the current graphical session
 +
.xsession-errors
 +
# recently used files
 +
.recently-used
 +
.recently-used.xbel
 +
.thumbnails
 +
# session-specific
 +
.Xauthority
 +
.ICEauthority
 +
.gksu.lock
 +
.pulse  # directory
 +
.pulse-cookie
 +
.esd_auth
 +
 +
#KDE specific:
 +
 +
# Recent documents on KDE
 +
.kde/share/apps/RecentDocuments
 +
# Contains a history of the Klipper clipboard (KDE)
 +
.kde/share/apps/klipper
 +
# you will loose saved scrolling positions of PDFs
 +
.kde/share/apps/okular/docdata
 +
.kde/share/apps/gwenview/recentfolders
 +
# cached other users' profile pics
 +
.kde/share/apps/kmess/displaypics
 +
# cached emoticons of others
 +
.kde/share/apps/kmess/customemoticons
 +
 +
#Firefox-specific (see also Profile folder):
 +
 +
.mozilla/firefox/*/Cache
 +
# in case Fx crashes dumps will be stored in this
 +
.mozilla/firefox/*/minidumps
 +
# session-specific
 +
.mozilla/firefox/*/.parentlock
 +
# phishing database, recreated
 +
.mozilla/firefox/*/urlclassifier3.sqlite
 +
# blacklisted extensions
 +
.mozilla/firefox/*/blocklist.xml
 +
# extension database, recreated on startup
 +
.mozilla/firefox/*/extensions.sqlite
 +
.mozilla/firefox/*/extensions.sqlite-journal
 +
.mozilla/firefox/*/extensions.rdf
 +
.mozilla/firefox/*/extensions.ini
 +
.mozilla/firefox/*/extensions.cache
 +
# cached UI data, recreated
 +
.mozilla/firefox/*/XUL.mfasl
 +
.mozilla/firefox/*/XPC.mfasl
 +
.mozilla/firefox/*/xpti.dat
 +
.mozilla/firefox/*/compreg.dat
 +
 +
#Opera-specific (related question on Superuser.com: Is documentation available on files and directories in the Opera profile folder?):
 +
 +
.opera/temporary_downloads
 +
.opera/cache
 +
.opera/thumbnails
 +
.opera/opcache
 +
.opera/icons
 +
.opera/application_cache
 +
.opera/widgets/*/cache
 +
.opera/lock
 +
 +
#Komodo Edit:
 +
 +
.komodoedit/*/codeintel/db
 +
.komodoedit/*/host-*/*/codeintel
 +
.komodoedit/*/XRE/Cache
 +
.komodoedit/*/XRE/.activatestate/komodo edit/Crash Reports
 +
.komodoedit/*/XRE/.activatestate/komodo edit/*/Cache
 +
.komodoedit/*/XRE/.activatestate/komodo edit/*/minidump
 +
.komodoedit/*/XRE/.parentlock
 +
.komodoedit/*/XRE/extensions.rdf
 +
.komodoedit/*/XRE/extensions.ini
 +
.komodoedit/*/XRE/extensions.cache
 +
.komodoedit/*/XRE/XPC.mfasl
 +
.komodoedit/*/XRE/XUL.mfasl
 +
.komodoedit/*/XRE/xpti.dat
 +
.komodoedit/*/XRE/pluginreg.dat
 +
.komodoedit/*/XRE/compreg.dat
 +
.komodoedit/*/XRE/*.sqlite-journal
 +
.komodoedit/*/pystdout.log
 +
.komodoedit/*/pystderr.log
 +
.komodoedit/*/history.sqlite.bak
 +
.komodoedit/*/running.lock
 +
.komodoedit/*/mutex.lock
 +
.komodoedit/*/*.xmlc
 +
.komodoedit/*/startup-env.tmp
 +
.komoeoedit/*/commandments.fifo
 +
.komoeoedit/*/history.sqlite
 +
 +
#GnuPG:
 +
 +
.gnupg/rnd
 +
.gnupg/random_seed
 +
.gnupg/.#*
 +
.gnupg/*.lock
 +
.gnupg/gpg-agent-info-*
 +
 +
#Google Chrome:
 +
 +
.config/google-chrome/Default/Local Storage
 +
.config/google-chrome/Default/Session Storage
 +
.config/google-chrome/Default/Application Cache
 +
.config/google-chrome/Default/History Index *
 +
 +
#Chromium:
 +
 +
.config/chromium/Default/Local Storage
 +
.config/chromium/Default/Session Storage
 +
.config/chromium/Default/Application Cache
 +
.config/chromium/Default/History Index *
 +
 +
# Local repositories (added by errantlinguist on 2015-04-13):
 +
.gradle/caches
 +
.m2/repository
 +
 +
#indexer
 +
.local/share/baloo
 +
.local/share/zeitgeist
 +
.local/share/akonadi
 +
 +
#Other apps:
 +
 +
# Pidgin
 +
.pulse/icons
 +
# Cached applets
 +
.guayadeque/cache.db
 +
.java/deployment/cache
 +
.icedteaplugin
 +
.icedtea
 +
.gnome2/epiphany/favicon_cache
  
 
=Fonti=
 
=Fonti=
  
 
[http://askubuntu.com/questions/545655/backup-your-home-directory-with-rsync-and-skip-useless-folders link 1]
 
[http://askubuntu.com/questions/545655/backup-your-home-directory-with-rsync-and-skip-useless-folders link 1]

Versione delle 21:43, 21 set 2015

Abstract

Prima di qualunque attività importante, un MUST è salvare i dati. Io ho usato questa tecnica per il cambio di hard disk del mio portatile, ma il motivo per farlo sono molti e un "backup" non ha bisogno di buoni motivi per essere fatto :-)

Strumenti

Esistono molti tool per fare salvataggio. Per questo esercizio ho usato rsync che per mette di "mantenere" aggiornata una copia di backup. rsync infatti sincronizza 2 cartelle (la sorgente con la destinazione) attraverso una fase di controllo e di copia.

Locale

Se avete un disco esterno, una chiavetta usb o qualunque altra device locale, potete usarla come destinazione del salvataggio

un semplice

df -H

mostrerà le periferiche e come il sistema le vede (mount) ipotizziamo che la periferica sia montata come

/media/$USER/linuxbackup/

($USER andrà sostituito con l'utente owner)

bene l'obbiettivo sarà salvare il contenuto di

/home/$USER

in una cartella (home ad esempio), nel percorso

/media/$USER/linuxbackup/home

Copiare tutto o solo cio che ci server

Al netto che copiare tutto non è un errore, vi sono cose che non ha senso copiare e addirittura altre che è preferibile non copiare.

Per fare una copia selettiva ci viene incontro la direttiva :

da man rsync:

--exclude-from=FILE     read exclude patterns from FILE
         This option is related to the --exclude option, but it specifies
         a FILE that contains exclude patterns  (one  per  line).   Blank
         lines  in  the  file  and  lines  starting  with  ’;’ or ’#’ are
         ignored.  If FILE is -, the list  will  be  read  from  standard
         input.

possiamo dargli un path di directory da escludere.


Esempio di file exclude

  1. rsync-homedir-excludes
  2. A list of files to exclude when backing up *nix home directories using rsync.
  3. Author: Ruben Barkow <https://github.com/rubo77/rsync-homedir-excludes>
  4. Version: 2015-08-30


  1. directories, probably not worth a backup:
  2. Downloads
  3. games
  4. VirtualBox*
  5. .vagrant
  6. .vagrant.d
  7. .android
  8. .AndroidStudioBeta
  9. .gradle
  10. .gvm
  11. .grails/
  12. .grails_history
  13. .local/share/notbit/
  14. .wine
  1. games
  2. .minecraft
  3. .PlayOnLinux
  4. .local/share/Steam/
  1. These directories may be excluded:
  1. contains mounted file systems

.gvfs .local/share/gvfs-metadata

  1. contains the actual encrypted home directory

.Private

  1. session-specific

.dbus .cache .Trash .local/share/Trash

  1. cached info about audio CDs

.cddb

  1. cached packages lists

.aptitude

  1. Flash-specific:
  1. Cache for flash, maybe others?

.adobe

  1. except for Flash persistence, there is no reason to keep this

.macromedia

  1. Files:
  1. contains errors from the current graphical session

.xsession-errors

  1. recently used files

.recently-used .recently-used.xbel .thumbnails

  1. session-specific

.Xauthority .ICEauthority .gksu.lock .pulse # directory .pulse-cookie .esd_auth

  1. KDE specific:
  1. Recent documents on KDE

.kde/share/apps/RecentDocuments

  1. Contains a history of the Klipper clipboard (KDE)

.kde/share/apps/klipper

  1. you will loose saved scrolling positions of PDFs

.kde/share/apps/okular/docdata .kde/share/apps/gwenview/recentfolders

  1. cached other users' profile pics

.kde/share/apps/kmess/displaypics

  1. cached emoticons of others

.kde/share/apps/kmess/customemoticons

  1. Firefox-specific (see also Profile folder):

.mozilla/firefox/*/Cache

  1. in case Fx crashes dumps will be stored in this

.mozilla/firefox/*/minidumps

  1. session-specific

.mozilla/firefox/*/.parentlock

  1. phishing database, recreated

.mozilla/firefox/*/urlclassifier3.sqlite

  1. blacklisted extensions

.mozilla/firefox/*/blocklist.xml

  1. extension database, recreated on startup

.mozilla/firefox/*/extensions.sqlite .mozilla/firefox/*/extensions.sqlite-journal .mozilla/firefox/*/extensions.rdf .mozilla/firefox/*/extensions.ini .mozilla/firefox/*/extensions.cache

  1. cached UI data, recreated

.mozilla/firefox/*/XUL.mfasl .mozilla/firefox/*/XPC.mfasl .mozilla/firefox/*/xpti.dat .mozilla/firefox/*/compreg.dat

  1. Opera-specific (related question on Superuser.com: Is documentation available on files and directories in the Opera profile folder?):

.opera/temporary_downloads .opera/cache .opera/thumbnails .opera/opcache .opera/icons .opera/application_cache .opera/widgets/*/cache .opera/lock

  1. Komodo Edit:

.komodoedit/*/codeintel/db .komodoedit/*/host-*/*/codeintel .komodoedit/*/XRE/Cache .komodoedit/*/XRE/.activatestate/komodo edit/Crash Reports .komodoedit/*/XRE/.activatestate/komodo edit/*/Cache .komodoedit/*/XRE/.activatestate/komodo edit/*/minidump .komodoedit/*/XRE/.parentlock .komodoedit/*/XRE/extensions.rdf .komodoedit/*/XRE/extensions.ini .komodoedit/*/XRE/extensions.cache .komodoedit/*/XRE/XPC.mfasl .komodoedit/*/XRE/XUL.mfasl .komodoedit/*/XRE/xpti.dat .komodoedit/*/XRE/pluginreg.dat .komodoedit/*/XRE/compreg.dat .komodoedit/*/XRE/*.sqlite-journal .komodoedit/*/pystdout.log .komodoedit/*/pystderr.log .komodoedit/*/history.sqlite.bak .komodoedit/*/running.lock .komodoedit/*/mutex.lock .komodoedit/*/*.xmlc .komodoedit/*/startup-env.tmp .komoeoedit/*/commandments.fifo .komoeoedit/*/history.sqlite

  1. GnuPG:

.gnupg/rnd .gnupg/random_seed .gnupg/.#* .gnupg/*.lock .gnupg/gpg-agent-info-*

  1. Google Chrome:

.config/google-chrome/Default/Local Storage .config/google-chrome/Default/Session Storage .config/google-chrome/Default/Application Cache .config/google-chrome/Default/History Index *

  1. Chromium:

.config/chromium/Default/Local Storage .config/chromium/Default/Session Storage .config/chromium/Default/Application Cache .config/chromium/Default/History Index *

  1. Local repositories (added by errantlinguist on 2015-04-13):

.gradle/caches .m2/repository

  1. indexer

.local/share/baloo .local/share/zeitgeist .local/share/akonadi

  1. Other apps:
  1. Pidgin

.pulse/icons

  1. Cached applets

.guayadeque/cache.db .java/deployment/cache .icedteaplugin .icedtea .gnome2/epiphany/favicon_cache

Fonti

link 1