Search code examples
rsync

rsync: how to ignore remote file that is locked - Device or resource busy (16)


I'm using rsync to copy files, and use --delete. rsync is trying to delete an .nfs file, and fails as follows:

rsync: delete_file: unlink(/path/.nfs0000083729d3947392020000099) failed: Device or resource busy (16)

This is expected because rsync should not attempt to delete nfs files. But how to tell rsync to ignore this file?

My rsync command is

sync -avzq -e 'ssh -i /ssh/key' origin_dir myuser@myhost:/destination_dir --delete

Solution

  • Add the following to command line:

     --filter '-_.nfs*'
    

    Actually, I included -C in order to also ignore some files that are unuseful at destination:

    -C --filter '-_.nfs*
    

    The options above are described in... the place I should have started... the man page! https://linux.die.net/man/1/rsync