2015-04-21 08:40:56 -04:00
|
|
|
---
|
2021-03-13 13:06:18 -05:00
|
|
|
lang: en
|
2015-04-21 08:40:56 -04:00
|
|
|
layout: doc
|
2015-10-28 18:14:40 -04:00
|
|
|
permalink: /doc/backup-emergency-restore-v2/
|
|
|
|
redirect_from:
|
|
|
|
- /en/doc/backup-emergency-restore-v2/
|
|
|
|
- /doc/BackupEmergencyRestoreV2/
|
2021-03-13 13:06:18 -05:00
|
|
|
ref: 207
|
2021-03-13 12:42:50 -05:00
|
|
|
title: Emergency Backup Recovery (v2)
|
2015-04-21 08:40:56 -04:00
|
|
|
---
|
|
|
|
|
2018-07-01 19:53:47 -04:00
|
|
|
Emergency Backup Recovery without Qubes (v2)
|
|
|
|
============================================
|
2015-04-21 08:40:56 -04:00
|
|
|
|
2018-06-30 20:56:40 -04:00
|
|
|
This page describes how to perform emergency restore of backup created on Qubes
|
|
|
|
R2 Beta3 or earlier (which uses backup format 2).
|
2015-04-21 08:40:56 -04:00
|
|
|
|
2018-06-30 20:56:40 -04:00
|
|
|
The Qubes backup system has been designed with emergency disaster recovery in
|
|
|
|
mind. No special Qubes-specific tools are required to access data backed up by
|
|
|
|
Qubes. In the event a Qubes system is unavailable, you can access your data on
|
|
|
|
any GNU/Linux system with the following procedure.
|
2015-04-21 08:40:56 -04:00
|
|
|
|
2018-06-30 20:56:40 -04:00
|
|
|
**Note:** In the following example, the backup file is assumed to be both
|
|
|
|
encrypted and compressed.
|
2015-04-21 08:40:56 -04:00
|
|
|
|
2021-03-13 12:03:23 -05:00
|
|
|
1. Untar the main backup file.
|
2015-04-21 08:40:56 -04:00
|
|
|
|
2015-09-26 19:00:33 -04:00
|
|
|
~~~
|
2015-04-21 08:40:56 -04:00
|
|
|
[user@restore ~]$ tar -i -xvf qubes-backup-2013-12-26-123456
|
|
|
|
backup-header
|
|
|
|
backup-header.hmac
|
|
|
|
qubes.xml.000
|
|
|
|
qubes.xml.000.hmac
|
|
|
|
vm1/private.img.000
|
|
|
|
vm1/private.img.000.hmac
|
|
|
|
vm1/icon.png.000
|
|
|
|
vm1/icon.png.000.hmac
|
|
|
|
vm1/firewall.xml.000
|
|
|
|
vm1/firewall.xml.000.hmac
|
|
|
|
vm1/whitelisted-appmenus.list.000
|
|
|
|
vm1/whitelisted-appmenus.list.000.hmac
|
|
|
|
dom0-home/dom0user.000
|
|
|
|
dom0-home/dom0user.000.hmac
|
2015-09-26 19:00:33 -04:00
|
|
|
~~~
|
2015-04-21 08:40:56 -04:00
|
|
|
|
2021-03-13 12:03:23 -05:00
|
|
|
2. Verify the integrity of the `private.img` file which houses your data.
|
2015-04-21 08:40:56 -04:00
|
|
|
|
2015-09-26 19:00:33 -04:00
|
|
|
~~~
|
2015-04-21 08:40:56 -04:00
|
|
|
[user@restore ~]$ cd vm1/
|
|
|
|
[user@restore vm1]$ openssl dgst -sha512 -hmac "your_passphrase" private.img.000
|
|
|
|
HMAC-SHA512(private.img.000)= cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e
|
2021-03-13 12:03:23 -05:00
|
|
|
[user@restore vm1]$ cat private.img.000.hmac
|
2015-04-21 08:40:56 -04:00
|
|
|
(stdin)= cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e
|
2015-09-26 19:00:33 -04:00
|
|
|
~~~
|
2015-04-21 08:40:56 -04:00
|
|
|
|
2018-06-30 20:56:40 -04:00
|
|
|
**Note:** The hash values should match. If they do not match, then the backup
|
|
|
|
file may have been tampered with, or there may have been a storage error.
|
2015-04-21 08:40:56 -04:00
|
|
|
|
2018-06-30 20:56:40 -04:00
|
|
|
**Note:** If your backup was hashed with a message digest algorithm other
|
|
|
|
than `sha512`, you must substitute the correct message digest command. A
|
|
|
|
complete list of supported message digest algorithms can be found with
|
|
|
|
`openssl list-message-digest-algorithms`.
|
2015-04-21 08:40:56 -04:00
|
|
|
|
2021-03-13 12:03:23 -05:00
|
|
|
3. Decrypt the `private.img` file.
|
2015-04-21 08:40:56 -04:00
|
|
|
|
2015-09-26 19:00:33 -04:00
|
|
|
~~~
|
2015-04-21 08:40:56 -04:00
|
|
|
[user@restore vm1]$ openssl enc -d -pass pass:your_passphrase -aes-256-cbc -in private.img.000 -out private.img.dec.000
|
2015-09-26 19:00:33 -04:00
|
|
|
~~~
|
2015-04-21 08:40:56 -04:00
|
|
|
|
|
|
|
**Note:** For multi-part files, a loop can be used:
|
2021-03-13 12:03:23 -05:00
|
|
|
|
2015-09-26 19:00:33 -04:00
|
|
|
~~~
|
2020-10-08 11:22:54 -04:00
|
|
|
find -name 'private.img.*' | sort -V | while read f; do
|
2015-04-21 08:40:56 -04:00
|
|
|
openssl enc -d -pass pass:your_passphrase -aes-256-cbc -in $f -out
|
|
|
|
${f/.img/.img.dec}
|
|
|
|
done
|
2015-09-26 19:00:33 -04:00
|
|
|
~~~
|
2015-04-21 08:40:56 -04:00
|
|
|
|
2018-06-30 20:56:40 -04:00
|
|
|
**Note:** If your backup was encrypted with a cipher algorithm other than
|
|
|
|
`aes-256-cbc`, you must substitute the correct cipher command. A complete
|
|
|
|
list of supported cipher algorithms can be found with `openssl
|
|
|
|
list-cipher-algorithms`.
|
2015-04-21 08:40:56 -04:00
|
|
|
|
2021-03-13 12:03:23 -05:00
|
|
|
4. Decompress the decrypted `private.img` file.
|
2015-04-21 08:40:56 -04:00
|
|
|
|
2015-09-26 19:00:33 -04:00
|
|
|
~~~
|
2015-04-21 08:40:56 -04:00
|
|
|
[user@restore vm1]$ zforce private.img.dec.*
|
|
|
|
[user@restore vm1]$ gunzip private.img.dec.000.gz
|
2015-09-26 19:00:33 -04:00
|
|
|
~~~
|
2015-04-21 08:40:56 -04:00
|
|
|
|
2018-06-30 20:56:40 -04:00
|
|
|
**Note:** If your backup was compressed with a program other than `gzip`, you
|
|
|
|
must substitute the correct compression program.
|
2015-04-21 08:40:56 -04:00
|
|
|
|
2021-03-13 12:03:23 -05:00
|
|
|
5. Untar the decrypted and decompressed `private.img` file.
|
2015-04-21 08:40:56 -04:00
|
|
|
|
2015-09-26 19:00:33 -04:00
|
|
|
~~~
|
2015-04-21 08:40:56 -04:00
|
|
|
[user@restore vm1]$ tar -M -xvf private.img.dec.000
|
|
|
|
vm1/private.img
|
2015-09-26 19:00:33 -04:00
|
|
|
~~~
|
2015-04-21 08:40:56 -04:00
|
|
|
|
|
|
|
**Note:** For multi-part files, a script is required:
|
|
|
|
|
2021-03-13 12:03:23 -05:00
|
|
|
1. Create a `new-volume-script`:
|
2015-04-21 08:40:56 -04:00
|
|
|
|
2015-09-26 19:00:33 -04:00
|
|
|
~~~
|
2015-04-21 08:40:56 -04:00
|
|
|
#!/bin/sh
|
|
|
|
name=`expr $TAR_ARCHIVE : '\(.*\)\..*'`
|
|
|
|
suffix=`printf %03d $[ $TAR_VOLUME - 1 ]`
|
|
|
|
echo $name.$suffix >&$TAR_FD
|
2015-09-26 19:00:33 -04:00
|
|
|
~~~
|
2015-04-21 08:40:56 -04:00
|
|
|
|
2021-03-13 12:03:23 -05:00
|
|
|
2. `chmod +x new-volume-script`.
|
|
|
|
3. `tar --new-volume-script=./new-volume-script -xvf private.img.dec.000`.
|
2018-06-30 20:56:40 -04:00
|
|
|
(The `--new-volume-script` option enables multi-volume untaring.)
|
2015-04-21 08:40:56 -04:00
|
|
|
|
2021-03-13 12:03:23 -05:00
|
|
|
6. Mount the private.img file and access your data.
|
2015-04-21 08:40:56 -04:00
|
|
|
|
2015-09-26 19:00:33 -04:00
|
|
|
~~~
|
2015-04-21 08:40:56 -04:00
|
|
|
[user@restore vm1]$ sudo mkdir /mnt/img
|
|
|
|
[user@restore vm1]$ sudo mount -o loop vm1/private.img /mnt/img/
|
|
|
|
[user@restore vm1]$ cat /mnt/img/home/user/your_data.txt
|
|
|
|
This data has been successfully recovered!
|
2015-09-26 19:00:33 -04:00
|
|
|
~~~
|
2015-04-21 08:40:56 -04:00
|
|
|
|
2018-06-30 20:56:40 -04:00
|
|
|
**Note:** You may wish to store a plain text copy of these instructions with
|
|
|
|
your Qubes backups in the event that you fail to recall the above procedure
|
|
|
|
while this web page is inaccessible. You may obtain a plaintext version of
|
2021-03-13 12:03:23 -05:00
|
|
|
this file in Git repository housing all the documentation on [Github](https://github.com/QubesOS/qubes-doc.git)
|