<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-License-Identifier: CC-BY-SA-4.0
SPDX-FileCopyrightText: Michael Terry
-->
<page xmlns="http://projectmallard.org/1.0/" xmlns:its="http://www.w3.org/2005/11/its" its:version="2.0" type="topic" style="task" id="restore-worst-case" xml:lang="it">
<info>
  <desc>Cosa fare se non è possibile ripristinare i file</desc>
  <link type="guide" xref="index#restore"/>
  <credit type="author" its:translate="no">
    <name>Michael Terry</name>
  </credit>
  <license href="http://creativecommons.org/licenses/by-sa/4.0/"><p>Creative Commons Attribution-Share Alike 4.0 Unported License</p></license>

    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Calogero Bonasia</mal:name>
      <mal:email>https://launchpad.net/~0disse0</mal:email>
      <mal:years/>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Claudio Arseni</mal:name>
      <mal:email>https://launchpad.net/~claudio.arseni</mal:email>
      <mal:years/>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Francesco</mal:name>
      <mal:email>https://launchpad.net/~ceskobassman</mal:email>
      <mal:years/>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Francesco</mal:name>
      <mal:email>https://launchpad.net/~fcapano</mal:email>
      <mal:years/>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Gianmarco Brocchi</mal:name>
      <mal:email>https://launchpad.net/~gimmy</mal:email>
      <mal:years/>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Ivan Guido Martucci</mal:name>
      <mal:email>https://launchpad.net/~kymya</mal:email>
      <mal:years/>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>LoReNicolò</mal:name>
      <mal:email>https://launchpad.net/~god121-p-l</mal:email>
      <mal:years/>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Marco Ciampa</mal:name>
      <mal:email>https://launchpad.net/~ciampix</mal:email>
      <mal:years/>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>albano</mal:name>
      <mal:email>https://launchpad.net/~albano-battistella</mal:email>
      <mal:years/>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>enubuntu</mal:name>
      <mal:email>https://launchpad.net/~mr.tennents</mal:email>
      <mal:years/>
    </mal:credit>
  </info>

<title>Quando tutti i tentativi falliscono</title>

<p><app>Déjà Dup</app> may fail.  Maybe it crashes or gives you an error when you try to restore.  When you really need your data back, the last thing you want do deal with is a bug.  Consider filing a <link href="https://gitlab.gnome.org/World/deja-dup/-/issues/new">help request</link> but in the meantime, here are some approaches to workaround a misbehaving <app>Déjà Dup</app> and get your data back.</p>

<note><p>Questa è una parte molto tecnica. Se qualcosa sembra senza senso, è possibile <link xref="support">chiedere aiuto</link>.</p></note>

<note><p>These instructions assume you are have a command line available. Open a <app>Terminal</app> window first.</p></note>

<section id="which-backend">
<title>Restic or Duplicity?</title>

<p>Over time, <app>Déjà Dup</app> has used different backup tools under the covers. Originally, it used <app>Duplicity</app>. Nowadays, it uses <app>Restic</app>.</p>
<p>Your backup might be in either format, depending on when you created it.</p>
<p>Look in the folder where your backup is kept:</p>
<list>
  <item><p>If the filenames all start with <cmd its:translate="no">duplicity-</cmd>, then it's a <app>Duplicity</app> backup. Read the <app>Duplicity</app> sections below.</p></item>
  <item><p>If you see a <cmd its:translate="no">config</cmd> file and a few folders like <cmd its:translate="no">keys</cmd>, then it's a <app>Restic</app> backup. Read the <app>Restic</app> sections below.</p></item>
</list>
</section>

<section id="restic">
<title>Restoring with Restic</title>

<p>On the assumption that <app>Déjà Dup</app> is just not working for you right now, let’s use the command line tool <app>Restic</app> that is used by <app>Déjà Dup</app> behind the scenes to back up and restore your files.</p>

<note style="advanced"><p>If you want more information about <app>Restic</app> than presented here, run <cmd its:translate="no">restic --help</cmd>.</p></note>

<p>La prima cosa che si tenterà di fare sarà di ripristinare tutti i dati. Presupponendo che i file siano su un dispositivo esterno montato come <file its:translate="no">/media/backup</file>  e si scelga di eseguire un backup cifrato, provare:</p>
<screen its:translate="no">restic restore --repo=/media/backup --target=/tmp/restore latest</screen>

<p>Se non si vuole cifrare il backup, aggiungere <cmd its:translate="no">--insecure-no-password</cmd> al comando.</p>

<p>If you need to do more advanced debugging, read their <link href="https://restic.readthedocs.io/en/stable/077_troubleshooting.html">troubleshooting guide</link>.</p>
</section>

<section id="duplicity">
<title>Ripristino con Duplicity</title>

<p>On the assumption that <app>Déjà Dup</app> is just not working for you right now, let’s use the command line tool <app>duplicity</app> that is used by <app>Déjà Dup</app> behind the scenes to back up and restore your files.</p>

<note style="advanced"><p>If you want more information about <app>Duplicity</app> than presented here, read <link href="http://duplicity.gitlab.io/docs.html">its online documentation</link>.</p></note>

<p>La prima cosa che si tenterà di fare sarà di ripristinare tutti i dati. Presupponendo che i file siano su un dispositivo esterno montato come <file its:translate="no">/media/backup</file>  e si scelga di eseguire un backup cifrato, provare:</p>
<screen its:translate="no">duplicity restore file:///media/backup /tmp/restore</screen>

<p>Se non si vuole cifrare il backup, aggiungere <cmd its:translate="no">--no-encryption</cmd> al comando.</p>

<section id="duplicity-locations">
<title>Other Storage Locations</title>
<p>If you backed up to a remote or cloud server, the syntax you use with <app>Duplicity</app> will be different than the external drive example above.</p>
<p>Read the <app>Duplicity</app> documentation for instructions on how to connect to your server, or try downloading all the <app>Duplicity</app> files yourself to a local folder and following the simpler example above.</p>
</section>

<section id="duplicity-by-hand">
<title>Restoring Duplicity Files by Hand</title>

<p>Se anche <app>duplicity</app>non sta funzionando correttamente, ci può essere poca speranza. Il formato del file di backup è complesso e non è semplice manipolarlo. Ma se non si può fare a meno di recuperare i dati, vale la pena provare.</p>

<p>Se si utilizza un server remoto o cloud per archiviare i backup, prima di tutto scaricare tutti i file <app>duplicity</app> e posizionarli in una cartella sul proprio computer. Quindi accedere alla cartella utilizzando un terminale.</p>

<p><app>Duplicity</app> archivia i dati in piccole parti chiamate volumi. Alcuni volumi fanno parte di backup completi o del primo backup eseguito, altri fanno parte dei backup incrementali. Partendo dal primo dei volumi di un backup completo, sarà necessario ripristinare i file un volume per volta.</p>

<p>Se si hanno backup cifrati, prima si deve decifrare il volume con <cmd its:translate="no">gpg</cmd>. Supponiamo sia presente <file its:translate="no">duplicity-full.20110127T131352Z.vol1.difftar.gpg</file>:</p>
<screen its:translate="no">gpg --output duplicity-full.20110127T131352Z.vol1.difftar --decrypt duplicity-full.20110127T131352Z.vol1.difftar.gpg</screen>

<p>Oppure tutti contemporaneamente (assicurarsi di avere abbastanza spazio.):</p>
<screen its:translate="no">gpg --multifile --decrypt duplicity-full.20110127T131352Z.*.difftar.gpg</screen>

<p>Ora si ha o un volume <file its:translate="no">.difftar</file> o un volume <file its:translate="no">.difftar.gz</file> (a seconda che fosse da decifrare o meno). Usare <cmd its:translate="no">tar</cmd> su ognuno dei file per estrarre il singolo file patch:</p>
<screen its:translate="no">tar xf duplicity-full.20110127T131352Z.vol1.difftar</screen>

<p>O ancora, tutti contemporaneamente:</p>
<screen its:translate="no">for t in duplicity-full.20110127T131352Z.*.difftar; do tar xf $t; done</screen>

<p>Ora i file patch saranno nelle cartelle <file its:translate="no">multivolume_snapshot</file> e<file its:translate="no">snapshot</file>. Ogni file che era diviso in più volumi ora sarà in <file its:translate="no">multivolume_snapshot</file>. Supponendo che sia stato eseguito il backup di <file its:translate="no">/home/jane/essay.txt</file>:</p>
<screen its:translate="no">cd multivolume_snapshot/home/jane/essay.txt
cat * &gt; essay.txt</screen>

<p>Per ripristinare i dati dai backup incrementali, usare <cmd its:translate="no">rdiff</cmd> per unire i file insieme. Consultare <cmd its:translate="no">man rdiff</cmd> per l'utilizzo.</p>

</section>
</section>

</page>
