I'm attempting to backup a mounted drive on one system to another. In the past, we've used rsync which has mostly worked (but perhaps not always) but recently the source drive did not mount properly. When the rsync attempted the backup, it saw an empty directory and deleted all contents on the remote backup server. I'm wondering what the best way to handle this is? Perhaps our rsync command is not quite sufficient:
rsync -aqmz -e 'ssh -q' --delete /dir/ user@${DEST_IP}:/dir
The run of the above rsync command to the empty drive appears to hang and doesn't seem to be transferring any data.
The initial transfer is large (10-100s of GBs), but the subsequent deltas are not very large (100s of MBs).
We are using Ubuntu 20.04 on both systems.
--delete
wasn't a good idea. Likely what you see as a hang is it scaning the source directory. I don't know why rsync does that when the target is empty, but it does.