If you are just getting started with rsync for the first time and have multiple large hard drives to make backups of, is it safe to actually use one or more of them during the long process? Today’s SuperUser Q&A post has the answer to a worried reader’s question.

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

The Question

SuperUser reader All wants to know if it is safe to use a hard drive while rsync is running:

Is it safe to use a hard drive while rsync is running?

The Answer

SuperUser contributor Michael Kjorling has the answer for us:

Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.

What is not generally safe, however, is to write within the source directory while rsync is running. “Write” is anything that modifies the content of the source directory or any subdirectory thereof, so that includes file updates, deletions, creation, etc.

Doing so will not actually break anything, but the change may or may not actually get picked up by rsync for copying to the target location. That depends on the type of change, whether rsync has scanned that particular directory yet, and whether rsync has copied the file or directory in question yet.

There is an easy way around that, however. Once rsync has finished, run it again with the same parameters (unless you have some funky deletion parameter; if you do, then be a bit more careful). Doing so will cause rsync to re-scan the source and transfer any differences that were not picked up during the original run.

The second run should transfer only differences that happened during the previous rsync run, and as such, will be completed much faster. Thus, you can feel free to use the computer normally during the first run, but should avoid making any changes as much as possible to the source during the second run. If you can, strongly consider remounting the source file system as read-only before starting the second rsync run (something like mount -o ro,remount /media/source should do).

Image Credit: Linux Screenshots (Flickr)