Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upqvm-backup-restore is slow #2986
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marmarek
Aug 7, 2017
Member
It does this only when you connect backup source directly to dom0, which you shouldn't do.
|
It does this only when you connect backup source directly to dom0, which you shouldn't do. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marmarek
Aug 7, 2017
Member
And for the dom0 case, this is limitation of tar. If you find a way tell tar to stop reading the archive, when all the files mentioned on command line are found, that would greatly improve the situation. Otherwise, alternative, hacky, solution is to keep track of restored files in python and kill the tar process when it get all requested files - something I'd like to avoid.
As for your idea - it isn't that simple, because you know what files to expect (including qubes.xml + qubes.xml.hmac vs qubes.xml.enc) only after retrieving backup header.
|
And for the dom0 case, this is limitation of tar. If you find a way tell tar to stop reading the archive, when all the files mentioned on command line are found, that would greatly improve the situation. Otherwise, alternative, hacky, solution is to keep track of restored files in python and kill the tar process when it get all requested files - something I'd like to avoid. As for your idea - it isn't that simple, because you know what files to expect (including qubes.xml + qubes.xml.hmac vs qubes.xml.enc) only after retrieving backup header. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
woju
Aug 7, 2017
Member
I did it from separate VM, granting it (unsuccessfully at first, that's how I know) necessary Admin API permissions. I felt it does three passes.
For some ideas how to do that, I'd rewrite it using tarfile and I'd forget about the part of spec that says the file that counts is the last one in the archive.
I probably know nothing about corner cases, but this doesn't take 2.5 hours:
import tarfile
t = tarfile.open('qubes-backup', ignore_zeros=True)
ti = t.next()
assert ti.name == 'backup-header'
backup_header = t.extractfile(ti).read()
ti = t.next()
assert ti.name == 'backup-header.hmac'
backup_header_hmac = t.extractfile(ti).read()|
I did it from separate VM, granting it (unsuccessfully at first, that's how I know) necessary Admin API permissions. I felt it does three passes. For some ideas how to do that, I'd rewrite it using I probably know nothing about corner cases, but this doesn't take 2.5 hours: import tarfile
t = tarfile.open('qubes-backup', ignore_zeros=True)
ti = t.next()
assert ti.name == 'backup-header'
backup_header = t.extractfile(ti).read()
ti = t.next()
assert ti.name == 'backup-header.hmac'
backup_header_hmac = t.extractfile(ti).read() |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marmarek
Aug 7, 2017
Member
While this may work for backup header, loading actual backup data into RAM is REALLY BAD IDEA (you've mentioned 1TB, no?). And having two different methods for extracting and verifying backup header and backup data is asking for bug in either of them.
|
While this may work for backup header, loading actual backup data into RAM is REALLY BAD IDEA (you've mentioned 1TB, no?). And having two different methods for extracting and verifying backup header and backup data is asking for bug in either of them. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
woju
Aug 7, 2017
Member
Hmmm.
Process Process-2:2:
Traceback (most recent call last):
...
File "/usr/lib/python3/dist-packages/qubesadmin/backup/restore.py", line 1698, in _handle_appmenus_list
stdin=stream)
...
FileNotFoundError: [Errno 2] No such file or directory: 'qvm-appmenus'
qubesadmin.backup.extract: Error while processing ...
and the same for all vms.
Looks like another 6 hours till I get back.
|
Hmmm.
and the same for all vms. Looks like another 6 hours till I get back. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
It's not into RAM. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marmarek
Aug 7, 2017
Member
Running qvm-backup-restore in dedicated VM = paranoid restore mode. Not supporting appmenus is somehow intentional missing feature.
|
Running qvm-backup-restore in dedicated VM = paranoid restore mode. Not supporting appmenus is somehow intentional missing feature. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Does it even work at all? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
You tell me... |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
I tell you it doesn't. Just don't tell Joanna... |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marmarek
Aug 7, 2017
Member
It's not into RAM. t.extractfile gives a file-like object.
Ah, so you're seeking solution for performance related issues, by passing the whole blob through python?
Ah, so you're seeking solution for performance related issues, by passing the whole blob through python? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
woju
Aug 7, 2017
Member
No. I'm seeking solutions for performance-related issues by intentionally forgetting about relevant parts of tar file specification. If it takes python to misimplement it, so be it, if the alternative is to do it in C.
|
No. I'm seeking solutions for performance-related issues by intentionally forgetting about relevant parts of tar file specification. If it takes python to misimplement it, so be it, if the alternative is to do it in C. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marmarek
Aug 7, 2017
Member
In theory, tar --seek should also greatly improve performance (it should simply seek through all ignored files). But in also in theory it should be automatically enabled...
|
In theory, |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
woju
Aug 7, 2017
Member
No, it won't. According to python's tarfile module documentation, the file that counts under a given path is the last one in the archive (I think it this is that way to be able to do incremental backups on tape by simply appending new files). So you have to seek whole file anyway, especially with -i. GNU tar works with this assumption. I say we break that and hereby declare header and HMAC to be the first two files in the archive.
|
No, it won't. According to python's |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marmarek
Aug 7, 2017
Member
But seeking through the whole archive (just reading file headers) also should be much faster, even for 1TB archive.
I'm checking tar --occurrence option right now, which should do exactly what we want.
|
But seeking through the whole archive (just reading file headers) also should be much faster, even for 1TB archive. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marmarek
Aug 7, 2017
Member
For simple archive it helps. If you're brave enough, try adding --occurrence=1 to https://github.com/QubesOS/qubes-core-admin-client/blob/master/qubesadmin/backup/restore.py#L870
|
For simple archive it helps. If you're brave enough, try adding |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Me? Not brave enough? Just hold me my beer... |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
You should get backup summary in seconds. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
It got better! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
woju
Aug 7, 2017
Member
Hmmm. Manpage says default for that option is 1.
Maybe the truth is "avaiable in the texinfo format".
|
Hmmm. Manpage says default for that option is 1. Maybe the truth is "avaiable in the texinfo format". |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marmarek
Aug 7, 2017
Member
That was also my understanding, but now I think --occurrence[=N] means "The default N is 1, if you specify --occurrence without N".
|
That was also my understanding, but now I think |
andrewdavidwong
added
C: core
enhancement
labels
Aug 8, 2017
andrewdavidwong
added this to the Release 4.0 milestone
Aug 8, 2017
woju
self-assigned this
Aug 8, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
woju
Aug 8, 2017
Member
Guys, I'm going to fix the issue about --occurence, but it leaves the bug around qvm-appmenus, so I'm going to file another ticket for that.
|
Guys, I'm going to fix the issue about |
woju
referenced this issue
Aug 8, 2017
Closed
qvm-backup-restore from appvm (e.g. in paranoid mode) fails on qvm-appmenus #2991
added a commit
to marmarek/qubes-core-admin-client
that referenced
this issue
Aug 30, 2017
marmarek
referenced this issue
in QubesOS/qubes-core-admin-client
Aug 30, 2017
Merged
Two fixes for qvm-backup-restore #26
marmarek
closed this
in
QubesOS/qubes-core-admin-client#26
Aug 30, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
qubesos-bot
Sep 14, 2017
Automated announcement from builder-github
The package python2-qubesadmin-4.0.6-0.1.fc25 has been pushed to the r4.0 testing repository for dom0.
To test this update, please install it with the following command:
sudo qubes-dom0-update --enablerepo=qubes-dom0-current-testing
qubesos-bot
commented
Sep 14, 2017
|
Automated announcement from builder-github The package
|
qubesos-bot
added
the
r4.0-dom0-cur-test
label
Sep 14, 2017
qubesos-bot
referenced this issue
in QubesOS/updates-status
Sep 14, 2017
Closed
core-admin-client v4.0.6 (r4.0) #208
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
qubesos-bot
Sep 14, 2017
Automated announcement from builder-github
The package python2-qubesadmin-4.0.6-0.1.fc24 has been pushed to the r4.0 testing repository for the Fedora fc24 template.
To test this update, please install it with the following command:
sudo yum update --enablerepo=qubes-vm-r4.0-current-testing
qubesos-bot
commented
Sep 14, 2017
|
Automated announcement from builder-github The package
|
qubesos-bot
added
the
r4.0-fc24-cur-test
label
Sep 14, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
qubesos-bot
Sep 14, 2017
Automated announcement from builder-github
The package qubes-core-admin-client_4.0.6-1+deb8u1 has been pushed to the r4.0 testing repository for the Debian jessie template.
To test this update, first enable the testing repository in /etc/apt/sources.list.d/qubes-*.list by uncommenting the line containing jessie-testing, then use the standard update command:
sudo apt-get update && sudo apt-get dist-upgrade
qubesos-bot
commented
Sep 14, 2017
|
Automated announcement from builder-github The package
|
qubesos-bot
added
the
r4.0-jessie-cur-test
label
Sep 14, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
qubesos-bot
Sep 14, 2017
Automated announcement from builder-github
The package python2-qubesadmin-4.0.6-0.1.fc25 has been pushed to the r4.0 testing repository for the Fedora fc25 template.
To test this update, please install it with the following command:
sudo yum update --enablerepo=qubes-vm-r4.0-current-testing
qubesos-bot
commented
Sep 14, 2017
|
Automated announcement from builder-github The package
|
qubesos-bot
added
the
r4.0-fc25-cur-test
label
Sep 14, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
qubesos-bot
Sep 14, 2017
Automated announcement from builder-github
The package qubes-core-admin-client_4.0.6-1+deb9u1 has been pushed to the r4.0 testing repository for the Debian stretch template.
To test this update, first enable the testing repository in /etc/apt/sources.list.d/qubes-*.list by uncommenting the line containing stretch-testing, then use the standard update command:
sudo apt-get update && sudo apt-get dist-upgrade
qubesos-bot
commented
Sep 14, 2017
|
Automated announcement from builder-github The package
|
qubesos-bot
added
the
r4.0-stretch-cur-test
label
Sep 14, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
qubesos-bot
Oct 30, 2017
Automated announcement from builder-github
The package qubes-core-admin-client_4.0.9-1+deb8u1 has been pushed to the r4.0 stable repository for the Debian jessie template.
To install this update, please use the standard update command:
sudo apt-get update && sudo apt-get dist-upgrade
qubesos-bot
commented
Oct 30, 2017
|
Automated announcement from builder-github The package
|
qubesos-bot
added
r4.0-jessie-stable
and removed
r4.0-jessie-cur-test
labels
Oct 30, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
qubesos-bot
Oct 30, 2017
Automated announcement from builder-github
The package qubes-core-admin-client_4.0.9-1+deb9u1 has been pushed to the r4.0 stable repository for the Debian stretch template.
To install this update, please use the standard update command:
sudo apt-get update && sudo apt-get dist-upgrade
qubesos-bot
commented
Oct 30, 2017
|
Automated announcement from builder-github The package
|
qubesos-bot
added
r4.0-stretch-stable
and removed
r4.0-stretch-cur-test
labels
Oct 30, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
qubesos-bot
Oct 30, 2017
Automated announcement from builder-github
The package python2-qubesadmin-4.0.9-0.1.fc24 has been pushed to the r4.0 stable repository for the Fedora fc24 template.
To install this update, please use the standard update command:
sudo yum update
qubesos-bot
commented
Oct 30, 2017
|
Automated announcement from builder-github The package
|
qubesos-bot
added
r4.0-fc24-stable
and removed
r4.0-fc24-cur-test
labels
Oct 30, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
qubesos-bot
Oct 30, 2017
Automated announcement from builder-github
The package python2-qubesadmin-4.0.9-0.1.fc25 has been pushed to the r4.0 stable repository for the Fedora fc25 template.
To install this update, please use the standard update command:
sudo yum update
qubesos-bot
commented
Oct 30, 2017
|
Automated announcement from builder-github The package
|
qubesos-bot
added
r4.0-fc25-stable
and removed
r4.0-fc25-cur-test
labels
Oct 30, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
qubesos-bot
Oct 30, 2017
Automated announcement from builder-github
The package python2-qubesadmin-4.0.9-0.1.fc25 has been pushed to the r4.0 stable repository for dom0.
To install this update, please use the standard update command:
sudo qubes-dom0-update
Or update dom0 via Qubes Manager.
qubesos-bot
commented
Oct 30, 2017
|
Automated announcement from builder-github The package
Or update dom0 via Qubes Manager. |
woju commentedAug 7, 2017
Qubes OS version (e.g.,
R3.2): R4.0qvm-backup-restorepipes internally whole backup tarfile at least three times (header, qubes.xml, data). This is painful on big backups and frustrating if something goes wrong at a later stage for large (~1TB) backups. (cf. bliviet)Ideally reading should be streamlined to at most two passes: 1) header + hmac check; 2) the rest. Tarfile layout should explicitly support this, if it does not already.
Cc: @marmarek