talk.tex 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. \documentclass{beamer}
  2. \usetheme{poul}
  3. \usepackage[utf8]{inputenc}
  4. \usepackage[svgpath=images/]{svg}
  5. %\usepackage{url}
  6. \usepackage[hyphenbreaks]{breakurl}
  7. \usepackage{hyperref}
  8. \def\UrlBreaks{\do\/\do-}
  9. %Information to be included in the title page:
  10. \title{Backup and (possibly) Restore}
  11. \author{Andrea Gussoni}
  12. \institute{P.O.u.L.}
  13. \date{23 Marzo 2017}
  14. \titlegraphic{\includesvg[height=1.5cm]{logowhite}}
  15. \begin{document}
  16. \frame{\titlepage}
  17. \begin{frame}
  18. \frametitle{Why do we need backups?}
  19. Bad things can happen and do happen:
  20. \begin{itemize}
  21. \item You may drop your computer accidentally.
  22. \item The disk may be damaged by vibrations during the daily train commute.
  23. \item The computer where you keep the unique copy of your thesis
  24. may be stolen.
  25. \item Or after some time it may simply age and stop operating.
  26. \end{itemize}
  27. \end{frame}
  28. \begin{frame}
  29. \frametitle{What are backups?}
  30. \begin{block}{Definition}
  31. The copying and archiving of computer data so that it may be
  32. used to restore the original after a data loss event.
  33. \end{block}
  34. \end{frame}
  35. \begin{frame}
  36. \frametitle{What to backup?}
  37. It is important to distinguish what it is necessary to backup from what
  38. it is not.\\
  39. Obviously this depends on the setup that you are using (native services, containers, VMs etc...)
  40. \end{frame}
  41. \begin{frame}
  42. \frametitle{A general guideline}
  43. Must:
  44. \begin{itemize}
  45. \item /home
  46. \end{itemize}
  47. \vfill
  48. At your discretion:
  49. \begin{itemize}
  50. \item /etc
  51. \item /var
  52. \end{itemize}
  53. \vfill
  54. Not necessary\footnote{if these folders contain something important probably you are doing something wrong in your setup}:
  55. \begin{itemize}
  56. \item /proc /sys /tmp
  57. \item /dev /mnt /media
  58. \end{itemize}
  59. \end{frame}
  60. \begin{frame}
  61. \frametitle{Backup types}
  62. Backups can be:
  63. \begin{itemize}
  64. \item \textbf{full}: a complete backup of a all files and folder starting from a root node.
  65. \item \textbf{incremental}: contains all the differences since the last incremental backup.
  66. \item \textbf{differential} contains the changes since the last full backup.
  67. \end{itemize}
  68. \end{frame}
  69. \begin{frame}
  70. \frametitle{Backup Support}
  71. \begin{itemize}
  72. \item Hard disks (HDD).
  73. \item Solid-State drives (SSD).
  74. \item Optical supports: DVDs, Blu-ray.
  75. \item Flash Drives.
  76. \item Cloud\footnote{Remember that there is no cloud, just other people's computers.}.
  77. \end{itemize}
  78. \end{frame}
  79. \begin{frame}
  80. \frametitle{dd}
  81. \textbf{dd} is a powerful tool that basically can copy everything that is a file or a block device. It is common to use it for disk cloning.\\
  82. Usage example:
  83. \begin{itemize}
  84. \item \textit{dd if=/dev/sdX of=/dev/sdY \&\& sync\footnote{useful to actually wait the end of data transfer and avoid corrupted copies}}
  85. \begin{itemize}
  86. \item \textbf{if:} input file/device
  87. \item \textbf{out:} output file/device
  88. \end{itemize}
  89. \end{itemize}
  90. \vfill
  91. \begin{alertblock}{Caution}
  92. Since \textbf{dd} often requires \textit{sudo} privileges to run, if you mismatch the name of a device you can actually wipe the content of your primary hard disk, double check always the arguments before pressing enter.
  93. \end{alertblock}
  94. \end{frame}
  95. \begin{frame}
  96. \frametitle{GNU ddrescue}
  97. gdrescue is an enhanced version of dd that tries to rescue good parts in case of read errors. It may be usefull to recover data from a drive with some damaged sector.\\
  98. Usage Example:
  99. \begin{itemize}
  100. \item \textit{ddrescue [options] /dev/sdX outfile mapfile}
  101. \begin{itemize}
  102. \item \textbf{mapfile:} a human readable text file ddrescue uses to manage the copy
  103. \end{itemize}
  104. \end{itemize}
  105. \begin{alertblock}{Caution}
  106. For the rescued data to be correct, both dd and gddrescue are best used on unmounted devices.
  107. \end{alertblock}
  108. \begin{block}{Tip}
  109. gddrescue can also be useful when trying to reallocate sectors on a drive with a few sector unreadable. Doing a wipe of the drive with gddrescue should reallocate bad sectors.
  110. \end{block}
  111. \end{frame}
  112. \begin{frame}
  113. \frametitle{rsync}
  114. Also known as an advanced version of cp
  115. \begin{exampleblock}{Pros}
  116. \begin{itemize}
  117. \item (unlike cp) preserves hard and symbloic links, file permissions and ownerships, modification times, etc.
  118. \item designed to be network efficient because only transfers file changes.
  119. \item easy to use.
  120. \end{itemize}
  121. \end{exampleblock}
  122. \begin{alertblock}{Cons}
  123. \begin{itemize}
  124. \item no storage encryption.
  125. \end{itemize}
  126. \end{alertblock}
  127. \end{frame}
  128. \begin{frame}
  129. \frametitle{rsync: usage}
  130. \begin{itemize}
  131. \item rsync -Pr source destination
  132. \begin{itemize}
  133. \item \textbf{P:} keep partially transferred files if the transfer is interrupted.
  134. \item \textbf{r:} recursive directory option
  135. \end{itemize}
  136. \vfill
  137. \item rsync source host:destination\footnote{But please don't do this \textit{rsync -av --delete source host:$\sim$/}}
  138. \begin{itemize}
  139. \item uses ssh by default, but can also be forced with the -e ssh option.
  140. \end{itemize}
  141. \vfill
  142. \item rsync -aAXv --exclude={...} /* /backup folder
  143. \begin{itemize}
  144. \item backup /* while following symlinks and preserving file properties.
  145. \end{itemize}
  146. \end{itemize}
  147. \end{frame}
  148. \begin{frame}
  149. \frametitle{rsnapshot: rsync automated}
  150. rsnapshot produces automated, periodical system snapshots
  151. \vfill
  152. \begin{exampleblock}{Pros}
  153. \begin{itemize}
  154. \item preserves hard and symbolic links, file permissions and ownership, modification times, etc.
  155. \item network efficient.
  156. \item each snapshot contains a full system backup.
  157. \item easy to use.
  158. \end{itemize}
  159. \end{exampleblock}
  160. \vfill
  161. \begin{alertblock}{Cons}
  162. \begin{itemize}
  163. \item no storage encryption.
  164. \end{itemize}
  165. \end{alertblock}
  166. \end{frame}
  167. \begin{frame}
  168. \frametitle{duplicity}
  169. duplicity produces encrypted, incremental backups in tar format.
  170. \begin{exampleblock}{Pros}
  171. \begin{itemize}
  172. \item preserves hard and symbolic links, file permissions and ownership, modification times, etc.
  173. \item network efficient.
  174. \item incremental backups.
  175. \item supports storage encryption with gpg.
  176. \item easy to use.
  177. \end{itemize}
  178. \end{exampleblock}
  179. \end{frame}
  180. \begin{frame}
  181. \frametitle{duplicity: usage}
  182. \begin{itemize}
  183. \item duplicity /home/user scp::/user@host//backup/directory
  184. \vfill
  185. \item duplicity [restore] scp://user@host//backup/directory /home/user
  186. \vfill
  187. \item duplicity full /home/user scp::/user@host//backup/directory
  188. \end{itemize}
  189. \end{frame}
  190. \begin{frame}
  191. \frametitle{duplicity: usage}
  192. \begin{itemize}
  193. \item duplicity list-current-files scp::/user@host//backup/directory
  194. \begin{itemize}
  195. \item list the files contained in the backup.
  196. \end{itemize}
  197. \vfill
  198. \item duplicity [restore] -t 3D scp://user@host//backup/directory /home/user
  199. \begin{itemize}
  200. \item specify the time from which to restore files.
  201. \end{itemize}
  202. \vfill
  203. \item duplicity remove-older-than 30D scp::/user@host//backup/directory
  204. \begin{itemize}
  205. \item remove from the backup full backups older than the specified period.
  206. \end{itemize}
  207. \end{itemize}
  208. \end{frame}
  209. \begin{frame}
  210. \end{frame}
  211. \begin{frame}
  212. \end{frame}
  213. \begin{frame}
  214. \frametitle{Demo}
  215. \begin{center}
  216. {\Huge Demo!}
  217. \end{center}
  218. \end{frame}
  219. \begin{frame}
  220. \frametitle{References}
  221. \begin{itemize}
  222. \item \url{https://wiki.archlinux.org/index.php/Full_system_backup_with_rsync}
  223. \item \url{https://wiki.archlinux.org/index.php/Duplicity}
  224. \item \url{http://duplicity.nongnu.org/}
  225. \item \url{https://www.digitalocean.com/community/tutorials/how-to-use-duplicity-with-gpg-to-securely-automate-backups-on-ubuntu}
  226. \end{itemize}
  227. \end{frame}
  228. \begin{frame}
  229. \frametitle{License}
  230. \begin{center}
  231. {\Huge Thank you!}
  232. \vfill
  233. \includesvg[height=1.5cm]{by-sa}\\
  234. {\footnotesize These slides are published under a Creative Commons Attribution-ShareAlike 4.0 license.}
  235. \end{center}
  236. \end{frame}
  237. \end{document}