I've been having issues with a external hard drive staying mounted to a mount point. That's not the topic of this question, but background info.
The issue is with rsync. It doesn't seem to recognize when it is trying to sync to an immutable destination.
You see, when this drive is not properly mounted, all that is left is it's mount-point folder, which I've made immutable.
Instead of rsync realizing that it cannot transfer to this mount-point, it proceeds transferring several gigs to this remote destination. Instead of failing, it looks at the situation as though "hey, this destination doesn't have any of the files I've been told to sync here, so I better move all files as though it was a new first time transfer".
I wish rsync would error out, but instead it tries to write 100,000 files to this mount point, failing on each file.
Best Answer
I don't know if you have the freedom to decide your destination path, but if you have that, what you can use is the following trick.
Make a directory
xyz
in the mount-point folder and change the permissions usingchmod 000 xyz
. Then mount the drive on the mount-point and make directoryxyz
leaving the permissions normal. Adjust thersync
have as destination/your-mount-point/xyz/
and if the drive is not mountedrsync
will exit with an error:If the drive is mounted,
rsync
will just work fine.