Rsync home: differenze tra le versioni

Da PNLUG.
(Esempio di file exclude)
(Esempio di file exclude)
Riga 54: Riga 54:
  
 
  # rsync-homedir-excludes
 
  # rsync-homedir-excludes
#
+
#
# A list of files to exclude when backing up *nix home directories using rsync.
+
# A list of files to exclude when backing up *nix home directories using rsync.
#
+
#
# Author: Ruben Barkow <https://github.com/rubo77/rsync-homedir-excludes>
+
# Author: Ruben Barkow <https://github.com/rubo77/rsync-homedir-excludes>
# Version: 2015-08-30
+
# 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
  
# directories, probably not worth a backup:
+
#Flash-specific:
#Downloads
+
#games
+
# Cache for flash, maybe others?
#VirtualBox*
+
.adobe
#.vagrant
+
# except for Flash persistence, there is no reason to keep this
#.vagrant.d
+
.macromedia
#.android
+
#.AndroidStudioBeta
+
#Files:
#.gradle
+
#.gvm
+
# contains errors from the current graphical session
#.grails/
+
.xsession-errors
#.grails_history
+
# recently used files
#.local/share/notbit/
+
.recently-used
#.wine
+
.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
 +
#GnuPG:
 +
 +
.gnupg/rnd
 +
.gnupg/random_seed
 +
.gnupg/.#*
 +
.gnupg/*.lock
 +
.gnupg/gpg-agent-info-*
 +
 +
#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
  
# games
+
#indexer
#.minecraft
+
.local/share/baloo
#.PlayOnLinux
+
.local/share/zeitgeist
#.local/share/Steam/
+
.local/share/akonadi
 +
 +
#Other apps:
  
#These directories may be excluded:
+
  # Pidgin
 
+
.pulse/icons
# contains mounted file systems
+
# Cached applets
.gvfs
+
.guayadeque/cache.db
.local/share/gvfs-metadata
+
.java/deployment/cache
# contains the actual encrypted home directory
+
.icedteaplugin
.Private
+
.icedtea
# session-specific
+
.gnome2/epiphany/favicon_cache
.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:47, 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

# 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 
#GnuPG: 

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

#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

link 1