Source mount check?

What is the problem you are having with rclone?

rclone sync will purge destination if source unmounts while sync is running

What is your rclone version (output from rclone version)

rclone v1.50.2

  • os/arch: linux/amd64
  • go version: go1.13.6

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Ubuntu 20.04.2 LTS

rclone sync /mnt/Drive1 /mnt/Drive2

Hi,

I'm regularly running a cron job that triggers a rclone sync for backup purposes (been doing so flawlessly since a few years).

Recently, the source drive unmounted by itself for an unknown reason (maybe a prefail symptom).
By consequence the location of the source, that was like /mnt/drive1 became empty.
You imagine the rest.
rclone continued its task as rigorously as it always does, and proceeded to overwrite the backup as an empty folder... !!

Luckily I was monitoring, realized what was going on, and killed the process. Even more luckily the source drive had not unmounted because it had died... (And I also have a less regular 3rd backup sync to a remote location). I was able to recover all data and replicate it once more (≈10TB).

But the whole thing came as a shock.

I must find a way to check the mount status of the drive that is being backuped up... and get rclone to stop if it does...
Whether the drive is prefailing and needs replacement or not does not change that fact for the future.

The question is how ??

This might be more of a bash script question than specifically rclone, what do you think ?

Kind regards.
efftee.

Here are a few examples.

https://www.baeldung.com/linux/bash-is-directory-mounted

Hi ! :slight_smile:
Thanks for this.
I ran through it sideways and I have the feeling this would help me check if the drive is mounted before running rclone sync.
But what if it unmounts during the actual rclone sync ?... (usually lasts about 30minutes to 2 hours on average for my cron job).

Having a mount go away feels super strange.

You'd run a script to check for a mount and if the mount was not found, I'd assume you'd kill off the rclone process.

That would be a separate monitoring thing to do.

Why does the mount go away?

I know... it's not good. As I mentionned initialy it feels like a prefail symptom.
It has been running smoothly 24/7 for the past year. And appears to have unmounted several times recently.
The extended SMART check reports nothing, no bad sectors, nothing above thresholds. report is healthy. I just don't know.
I am of course considering to replace the drive.

But the experience still makes me want to solve this one :wink:
Also, by the time I solve what seems to be a hardware issue, does not mean I should stop backups, so...

The difficulty here is that I would litteraly need to check mount status between each synced file !...

What would you be solving? You are backing up from a failing hard so the data might be bad as well.

I'd replace the thing and move on as you are trying to solve something that should be fixed not solved :slight_smile:

Other than externally monitoring and killing the command, nothing else comes to mind from my side.

1 Like

You are so right. Thank you.
Fundamentally I am using rclone improperly.
Makes me realise how I've been using it to avoid the investment in a proper raid array...

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.