I have a question about file access in Linux that I cannot sum it up completely.

Consider that I have a home directory that I backup it using rsync triggered via cron. My home directory is on an EXT4 file system and I'm logged in during the rsync run.

My question is what happens if a file is modified during mid-backup (while rsync is reading it). AFAIK EXT fs family doesn't have any measures against it and that will corrupt (or render it meaningless) the backup of the file I just took.

Is my theory correct or am I missing a small locking mechanism which guarantees sound backups.

  • As @jordanm answers, there is no guarantee, but especially for your (presumably not wildly active) home directory this shouldn't be a problem in practice. Having multiple backups, rotated in some fashion will reduce the likelihood of having no good version as close to zero as your space affords.
    – msw
    Jul 26, 2013 at 14:08
  • /home was for example. I'll do a full system backup in reality. My home is already backed up by rdiff but root directory is another thing, I think.
    – bayindirh
    Jul 26, 2013 at 14:09
  • 1
    And if you're backing up source files that you have created on the machine to be backed up, they should be under version control anyway which would reduce the likelihood of corruption greatly.
    – msw
    Jul 26, 2013 at 14:10
  • I always use local (and a remote one if possible and necessary) git.
    – bayindirh
    Jul 26, 2013 at 14:12

1 Answer 1


Using plain rsync files are read the same way any application would read a file. This can lead to copies with inconsistent data. The best way to prevent inconsistent copies is using LVM snapshots, which will prevent changes to the data while copying.

From my experience, getting inconsistent data is rare, likely due to the way the the kernel buffers writes. Only very heavily written files, such as database files, result in corruption.

  • I have an 8 year old Debian testing installation which I want to backup regularly, but the possibility scares me a bit. I don't want to move to LVM because of a combination of spare time, system layout, disaster recovery issues and cowardness.
    – bayindirh
    Jul 26, 2013 at 13:41
  • +1 and of course, databases should be backed up using their own mechanisms
    – msw
    Jul 26, 2013 at 14:04
  • 1
    kernel buffering does enter the picture here since it's all user space applications. Jul 26, 2013 at 14:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .