
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:
I plan to backup my collection of large hard drives using rsync and anticipate that it will take a few days. Is it safe to use the original hard drive (adding files) while rsync is working or it is better to leave the hard drives untouched until rsync is completely finished?
Is it safe to use a hard drive while rsync is running?
The Answer
SuperUser contributor Michael Kjorling has the answer for us:
As others have already pointed out, it is safe to read from the source disk or use the target disk outside of the target directory while rsync is running. It is also safe to read within the target directory, especially if the target directory is being populated exclusively by the rsync run.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).
Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users?
0 comments:
Post a Comment