mirror of
https://github.com/QubesOS/qubes-doc.git
synced 2025-01-13 08:19:43 -05:00
Update Emergency Backup Recovery - format version 4
- Clarify language and fix typos - Improve formatting - Include example for bzip2 compression - Wrap lines (This file is an exception to the normal line wrapping rule, since it is specifically intended to be read as plain text.)
This commit is contained in:
parent
99d43ef5ec
commit
bb26173089
@ -10,20 +10,28 @@ redirect_from:
|
||||
Emergency Backup Recovery without Qubes - format version 4
|
||||
==========================================================
|
||||
|
||||
This page describes how to perform an emergency restore of a backup created on Qubes R4.0 or later (which uses backup format version 4).
|
||||
This page describes how to perform an emergency restore of a backup created on
|
||||
Qubes R4.0 or later (which uses backup format version 4).
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
**Note:** In the following example, the backup file is both *encrypted* and *compressed*.
|
||||
**Note:** The backup content is encrypted and integrity-protected with the
|
||||
[`scrypt` utility](https://www.tarsnap.com/scrypt.html). You will need a copy
|
||||
of this utility in order to access your data. For this reason, it is strongly
|
||||
recommended that you store a copy of this utility with your backups. If your
|
||||
distribution has `scrypt` packaged (e.g., Debian), you can install the package
|
||||
in the standard way using your distribution's package manager. Otherwise,
|
||||
you'll need to download a compiled binary or compile the program from source
|
||||
yourself. (Don't forget to [verify signatures](/security/verifying-signatures)
|
||||
first!) Note that versions of `scrypt` up to 1.2.0 (inclusive) do not support
|
||||
the `-P` option for easier scripting, which means you'll need to enter the
|
||||
passphrase for each file separately, instead of using `echo ... | scrypt`.
|
||||
|
||||
1. Backup content is encrypted and integrity protected using [scrypt
|
||||
utility](https://www.tarsnap.com/scrypt.html). You need to obtain it to
|
||||
restore your data. If your distribution have it packaged (like on Debian),
|
||||
install the package standard way, otherwise you need to compile it yourself
|
||||
(verify its signature first!).
|
||||
Versions up to 1.2.0 (inclusive) do not support `-P` option for easier
|
||||
scripting - which means you'll need to enter the passphrase for each file
|
||||
separately, instead of using `echo ... | scrypt`.
|
||||
**Note:** In the following example, the backup file is both *encrypted* and
|
||||
*compressed*.
|
||||
|
||||
2. Untar the main backup file.
|
||||
|
||||
@ -39,13 +47,20 @@ The Qubes backup system has been designed with emergency disaster recovery in mi
|
||||
vm1/whitelisted-appmenus.list.000.enc
|
||||
dom0-home/dom0user.000.enc
|
||||
|
||||
**Note:** Each VM in the backup file has its path listed in `qubes.xml.000.enc` (search for the `backup-path` property). You can extract only the files necessary for your VM (vmX) with `tar -i -xvf qubes-backup-2015-06-05T123456 backup-header backup-header.hmac vmX/`.
|
||||
**Note:** Each VM in the backup file has its path listed in
|
||||
`qubes.xml.000.enc` (search for the `backup-path` property). You can
|
||||
extract only the files necessary for your VM (`vmX`) with `tar -i -xvf
|
||||
qubes-backup-2015-06-05T123456 backup-header backup-header.hmac vmX/`.
|
||||
|
||||
3. Set backup passhprase environment variable. While this isn't strictly required, it will be handy later and will avoid saving the passphrase into shell history.
|
||||
3. Set the backup passhprase environment variable. While this isn't strictly
|
||||
required, it will be handy later and will avoid saving the passphrase in
|
||||
the shell's history.
|
||||
|
||||
read backup_pass
|
||||
|
||||
4. Verify integrity of `backup-header`. For compatibility reasons `backup-header.hmac` is in fact is an encrypted *and integrity protected* version of `backup-header`.
|
||||
4. Verify the integrity of `backup-header`. For compatibility reasons,
|
||||
`backup-header.hmac` is an encrypted *and integrity protected*
|
||||
version of `backup-header`.
|
||||
|
||||
[user@restore ~]$ set +H
|
||||
[user@restore ~]$ echo "backup-header!$backup_pass" |\
|
||||
@ -53,14 +68,15 @@ The Qubes backup system has been designed with emergency disaster recovery in mi
|
||||
diff -qs backup-header backup-header.verified
|
||||
Files backup-header and backup-header.verified are identical
|
||||
|
||||
**Note:** If the above fail, it may be either mean that backup was tampered
|
||||
with, or it is in different format (see point 3 above). In that case, look into
|
||||
`backup-header`, at `version` field. If it contains anything else than
|
||||
`version=4`, go to other version of instruction: [Emergency Backup Recovery -
|
||||
format version 2](/doc/backup-emergency-restore-v2/), [Emergency Backup
|
||||
Recovery - format version 3](/doc/backup-emergency-restore-v3/)
|
||||
**Note:** If this command fails, it may be that the backup was tampered
|
||||
with or is in a different format. In the latter case, look inside
|
||||
`backup-header` at the `version` field. If it contains a value other than
|
||||
`version=4`, go to the instructions for that format version:
|
||||
- [Emergency Backup Recovery - format version 2](/doc/backup-emergency-restore-v2/)
|
||||
- [Emergency Backup Recovery - format version 3](/doc/backup-emergency-restore-v3/)
|
||||
|
||||
5. Read the `backup-header`. You'll need some of this information later. The file will look similar to this:
|
||||
5. Read `backup-header`. You'll need some of this information later. The
|
||||
file will look similar to this:
|
||||
|
||||
[user@restore ~]$ cat backup-header
|
||||
version=4
|
||||
@ -69,7 +85,8 @@ Recovery - format version 3](/doc/backup-emergency-restore-v3/)
|
||||
compression-filter=gzip
|
||||
backup_id=20161020T123455-1234
|
||||
|
||||
6. Verify the integrity and decrypt the `private.img` file which houses your data.
|
||||
6. Verify the integrity of and decrypt the `private.img` file that houses your
|
||||
data.
|
||||
|
||||
[user@restore ~]$ backup_id=20161020T123455-1234 # see backup-header above
|
||||
[user@restore ~]$ for f_enc in vm1/private.img.???.enc; do \
|
||||
@ -77,14 +94,21 @@ Recovery - format version 3](/doc/backup-emergency-restore-v3/)
|
||||
echo "$backup_id!$f_dec!$backup_pass" | scrypt dec -P $f_enc $f_dec || break; \
|
||||
done
|
||||
|
||||
**Note:** If the above fail, most likely your backup is corrupted, or been tampered with.
|
||||
**Note:** If this command fails, it is likely that the backup is corrupted
|
||||
or has been tampered with.
|
||||
|
||||
7. Decompress and untar the decrypted `private.img` file.
|
||||
|
||||
[user@restore ~]$ cat vm1/private.img.??? | gzip -d | tar -xv
|
||||
vm1/private.img
|
||||
|
||||
**Note:** If your backup was compressed with a program other than `gzip`, you must substitute the correct compression program. This information is contained in the `backup-header` file (see step 3).
|
||||
**Note:** If your backup was compressed with a program other than `gzip`,
|
||||
you must substitute the correct compression program. This information is
|
||||
contained in the `backup-header` file (see step 3). For example, if you
|
||||
used `bzip2`, then you should do this:
|
||||
|
||||
[user@restore vm1]$ mv private.img.dec private.img.dec.bz2
|
||||
[user@restore vm1]$ bunzip2 private.img.dec.bz2
|
||||
|
||||
8. Mount the private.img file and access your data.
|
||||
|
||||
@ -93,9 +117,14 @@ Recovery - format version 3](/doc/backup-emergency-restore-v3/)
|
||||
[user@restore vm1]$ cat /mnt/img/home/user/your_data.txt
|
||||
This data has been successfully recovered!
|
||||
|
||||
9. Success! If you wish to recover data from more than one VM in your backup, simply repeat steps 5--8 for each additional VM.
|
||||
9. Success! If you wish to recover data from more than one VM in your backup,
|
||||
simply repeat steps 6--8 for each additional VM.
|
||||
|
||||
**Note:** You may wish to store a 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. All Qubes documentation, including this page, is available in plain text format in the following Git repository:
|
||||
**Note:** You may wish to store a 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. All Qubes documentation, including
|
||||
this page, is available in plain text format in the following Git
|
||||
repository:
|
||||
|
||||
https://github.com/QubesOS/qubes-doc.git
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user