bit-team / backintime

Back In Time - An easy-to-use backup tool for GNU/Linux using rsync in the back
https://backintime.readthedocs.io
GNU General Public License v2.0
2.13k stars 208 forks source link

snapshots may get written to empty mountpoint #1016

Open mokafolio opened 5 years ago

mokafolio commented 5 years ago

Hello,

I am experiencing some weirdness with my setup. I am backing up to an external hdd and it appears to work. The schedule is set to hourly and if the external hdd is connected everything works as expected and the snapshot list in back in time looks correct. If the hdd is not connected though, it shows another list of snapshots which I guess ran while the hdd was not connected. Why is that happening? I'd expect it to simply not take a snapshot if the external hdd is not connected. I am pretty sure its only diffing stuff without copying the backup anywhere in the latter case.

thank you!

EDIT: Related Debian Bug Ticket https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=995257

colinl commented 5 years ago

What do you see if you look in the mount point where the drive would be if it were connected?

mokafolio commented 5 years ago

Ah, that exactly is the problem. If the external HDD is not connected, it just uses the folder of the mount point to store the backups. Is there any way to disable that behavior? I'd like it to only create backups if the HDD is connected. Thanks!

colinl commented 5 years ago

How do you run BiT?

mokafolio commented 5 years ago

I am using the qt client (v. 1.2.0) with basically the default settings.

colinl commented 5 years ago

I believe there are hooks in BiT that let you run a script before a backup. You could check the drive is mounted in there. I haven't used the scripting but I assume it is documented somewhere. In the meantime if you empty the mount point folder (make sure the disc is not plugged in!) the it will be pretty obvious that something is wrong as there will be no snapshots shown.

mokafolio commented 5 years ago

where would I find those hooks in the gui version?

colinl commented 5 years ago

I don't know. Perhaps someone else can tell us how.

mokafolio commented 5 years ago

So I worked around this. Instead of using the mount point directly as the backup location, I created a folder to use that only exists when the extern HDD is mounted. This should work. Would be cool to find another way though! Thank for all the input!

buhtz commented 2 years ago

@mokafolio There is a new forming maintaining team and we do review all issues. Is this problem still relevant for you, can you reproduce it with a newer or the latest release? Did you find a solution?

Tag: Bug, Feedback, Documentation

Here again we have the problem when the destination is a mount point instead of a folder under the mount point.

emtiu commented 2 years ago

Yes, I've described the same workaround here: https://github.com/bit-team/backintime/issues/1230#issuecomment-1198018112

This is definitely something we need to look into.

buhtz commented 4 months ago

For my info, how to check if mounted on shell:

$ findmnt --no-headings --options TARGET <path>

Or with Python itself:

>>> import psutil
>>> psutil.disk_partitions(all=True)

But the easiest might be this and checking return code:

$ mountpoint <path>