-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comparing 2 snapshots can fill your disk if it includes a symlink to e.g. /
(doesn't copy symlink as symlink)
#1902
Comments
Hello Peter, Thank you for taking the time to report the bug and providing the I never understood why BIT is coping the snapshots before comparing it. I am not deep enough into this feature of BIT so I can not decide yet. But I am assuming that comparing (diff snapshot) can be achieved without copy the snapshot. IN this case your issue would be obsolete. If you have any more details to share, feel free to reach out. Not sure when we'll find the time to work on it. Please see the projects background information to get an idea about our workflow and priorities: Best regards, |
Hello Christian,
You're welcome!
According to backintime/qt/snapshotsdialog.py Lines 367 to 368 in 1100653
It would avoid this issue though it'd create the risk of modifying the (or both?) snapshot(s)? Though from reading the linked Python docs I'd expect it to also be fixed by simply adding
No worries. I've been reading a bit up on it the last few weeks already.
Regards, |
Mhm... I see. But if it is a 10 GB snapshot a lot things need to get copied. OK, OK, but I get it.
Sounds easy. Would you like to contribute a pull request? Regards, Christian |
When comparing snapshots, copy symlinks in the snapshots as symlinks, not as their target. The old behavior made the comparison not fully compare the actual snapshot data and, even worse, could fill up your entire disk (when having circular symlinks, e.g. a symlink to `/`, which copies `/` and eventually copies the original symlink which points to `/` which ...). Additionally fixes a crash when the compared snapshot(s) contain a symlink pointing to a nonexistent target. Fixes bit-team#1902.
When comparing snapshots, copy symlinks in the snapshots as symlinks, not as their target. The old behavior made the comparison not fully compare the actual snapshot data and, even worse, could fill up your entire disk (when having circular symlinks, e.g. a symlink to `/`, which copies `/` and eventually copies the original symlink which points to `/` which ...). Additionally fixes a crash when the compared snapshot(s) contain a symlink pointing to a nonexistent target. Fixes bit-team#1902.
When comparing snapshots, copy symlinks in the snapshots as symlinks, not as their target. The old behavior made the comparison not fully compare the actual snapshot data and, even worse, could fill up your entire disk (when having circular symlinks, e.g. a symlink to `/`, which copies `/` and eventually copies the original symlink which points to `/` which ...). Additionally fixes a crash when the compared snapshot(s) contain a symlink pointing to a nonexistent target. Fixes bit-team#1902.
When comparing snapshots, copy symlinks in the snapshots as symlinks, not as their target. The old behavior made the comparison not fully compare the actual snapshot data and, even worse, could fill up your entire disk (when having circular symlinks, e.g. a symlink to `/`, which copies `/` and eventually copies the original symlink which points to `/` which ...). Additionally fixes a crash when the compared snapshot(s) contain a symlink pointing to a nonexistent target. Fixes bit-team#1902.
Yeah, there's definitely downsides to it as well. Also as a user it wasn't clear to me a copy was going to be made in the first place. Maybe a longer term solution could be to let the user decide and choose between speed or risk? (though dialogs have their own downsides) Also just realized that these temp copies will have no deduplication on them. So a bad case when comparing full snapshots (assuming that when comparing only a part of a snapshot, only the relevant part gets copied from both snapshots) you might need twice the space of the original data available in a temp location just to host the 2 copies
Sure (had some other higher priority stuff to do first). I searched for unittests too but couldn't find anything. Searched for 'compare', case insensitive, in both Additionally, upon reading the Python |
Also, while on the subject, the names of the temp dirs are very generic and don't really indicate they're from Back in Time (the snapshot name is in there but as that's just a bunch of datetime stamps and a random(?) suffix it's hard to tell it's from BiT), e.g.: Would it make sense to add an explicit prefix to the temp dir as well? E.g. |
Thank you very much, I will need a bit time to have a deeper look into it. |
Back in Time will sometimes create a temp dir, to copy (parts of) a snapshot. These have a generic name, in the form of `tmpXXXXXXXX_SNAPSHOTID`, where `XXXXXXXX` are random characters and `SNAPSHOTID` is the snapshot id (e.g. `20241121-112648-601`). Only the latter gives a hint that these dirs are from Back in Time but it's hard to tell as they're just some numbers. This makes it tricky for the user to know if it's safe to delete these dirs if they're left around (Back in Time will remove them if it exits cleanly but that's not always possible, e.g. might hang if disk space gets full, like in bit-team#1902 or when comparing too large snapshots). Added an explicit `backintime_` prefix to the temp dir to make their origin more clear.
Back in Time will sometimes create a temp dir, to copy (parts of) a snapshot. These have a generic name, in the form of `tmpXXXXXXXX_SNAPSHOTID`, where `XXXXXXXX` are random characters and `SNAPSHOTID` is the snapshot id (e.g. `20241121-112648-601`). Only the latter gives a hint that these dirs are from Back in Time but it's hard to tell as they're just some numbers. This makes it tricky for the user to know if it's safe to delete these dirs if they're left around (Back in Time will remove them if it exits cleanly but that's not always possible, e.g. might hang if disk space gets full, like in bit-team#1902 or when comparing too large snapshots). Added an explicit `backintime_` prefix to the temp dir to make their origin more clear.
You're welcome, and no problem.
Yeah, was already planning on using a separate PR (but didn't mention it), I split up the 2 PRs for |
First of all thanks for the software, have been using it quite a bit through the years!
I was trying to compare 2 snapshots (one of <30GB with one of a few 100MB) and suddenly noticed my system acting weird due to what turned out to be my disk being full, even though nearly 1TB of 1.8TB was free beforehand...
Long story short, it turned out that symlinks in the snapshots were having their targets copied as a regular dir (instead of being copied as symlinks themselves) to the temp location BiT uses for comparing. The symlink's target included another symlink somewhere within, this one pointing to
/
(Proton install from Steam which has az:
drive/symlink pointing to/
). That resulted in an infinite dir structure being copied:/
includes~/.steam/root/steamapps/compatdata/ID/pfx/dosdevices/z:
which points to/
which includes~/.steam/root/steamapps/compatdata/ID/pfx/dosdevices/z:
which points to ...After digging into the source a bit it seems that BiT creates a copy of the snapshots its comparing (
backintime/qt/snapshotsdialog.py
Line 370 in 1100653
shutil.copytree
(backintime/qt/app.py
Line 1700 in 1100653
presumably causing the issue.
Easy reproduction of the base issue:
E.g.:
To probably reproduce the exact situation (NOT RECOMMENDED!), written from memory as I don't want to try it again to verify:
/
(e.g. Steam with a Proton install or a regular Wine environment)/
. The snapshot included my~/.steam
which has aroot -> /home/USER/.local/share/Steam
symlink but~/.local/share/Steam
itself is excluded from the snapshots (wouldn't matter here as the symlink uses an absolute path so it points to the live data, not the snapshot's)./home/USER/.local/share/Steam
includes content that has symlinks pointing to/
./tmp
./tmp
if not atmpfs
that disk should now be full/tmp
is atmpfs
(it is in my case), now fill up an actual disk:/tmp
is full, kill Back in Time/var/tmp
(presumably because/tmp
is now full so Python will pick something else for its temp location)/var/tmp
and enjoy the disk being full/tmp
and/var/tmp
to get a sane system again`backintime --diagnostics`
Original problem on openSUSE Tumbleweed (installed from the main repo, diagnostics included above), basic issue reproduced on Slackware (Back in Time 1.4.3, Python 3.11.10, installed via slackbuilds.org).
The text was updated successfully, but these errors were encountered: