Hi. I've got a general question around file copying.
I've got a small backup script that I run that uses rsync to keep a backup of my media files up to date on a seperate (unassigned - aka not in the array or cache) hard drive in my Unraid server. Unconventional I know, and probably un-needed with the parity drive, but it's been more a case of playing around with the server, NAS, Linux etc. as this is all fairly new to me.
Anyway, the script runs, does the backup no problem, and once it's finished, I can see the write count on the backup disk still increments aftrwards (it seems to jump at the end - presumably when the unmount is done). Having done a little research in the past, I know write counts can go up after the action has seemingly completed due to the files being written to RAM first, and then copied to the disk, so there's (apparently) a delay between rsync thinking the file is copied, and the actual data blocks making it onto the hard drive. All perfectly normal and nothing to be worried about.
However...
As the backup drive is unassigned, and is a normal (non-NAS) hard drive, I don't necessarily want to keep it spinning and mounted after the backup has finished. To that end, my script originally utilised rc.unassigned umount after the rsync to unmount the drive. This worked fine, and the hard drive was unmounted. But it got me thinking - if the system is still copying files from RAM to the backup drive, and I issue the unmount command, is it going to mean the backup doesn't finish ? Is that jump in the writes at the end of the script due to the unmount being delayed until all the data blocks are written ? Should I put a delay in between the rsync and unmount ? Is there a better way to do it ? Am I talking complete rubbish ?
Tl;dr - if a file is being copied to a disk and the disk is unmounted, will the file still be copied in full before the unmount is actioned, or will it potentially abourt the write before completion ?