0

I'm using RSYNC to do periodic backups of my data into an external hard disk formatted in EXT4. I'm using the "hard link option", thus files that haven't changed from the previous backup are just hard linked instead of fully copied, which reduces the used disk space.

To guarantee that a power cut, a system hang, or other problem during backups doesn't pose a problem, I first do the backup into a temporary folder, run a SYNC to flush the disk cache, rename the temporary folder to the definitive name, and run another SYNC. This way I can guarantee that all the data is in the disk before committing the backup.

The point is that now I want to use a NAS, but I can't order a SYNC command (to flush the remote cache), neither through SFTP, nor NFS, which means that a problem in the middle of a backup can leave it in an intermediate state (like a file with only part of the data).

My question is: setting my NAS in "data=journal" mode would guarantee that there won't be incorrect data if I suffer a power loss, as long as I first do the backup in a temporary folder and then, after that, I rename it to the definitive name? Do other filesystems (like BTRFS or ReiserFS) have that mode and should it be set like in EXT4? And, of course, which NAS can you recommend me that allows to enable that mode?

6
  • Is this "temporary" folder kept on disk? If you regenerate it each time from zero, you will need to copy all data to it. Your connection to a NAS needn't be SFTP (if that is a problem). NFS would work, for example. Note that performing a 2-stage backup increases the number of points of failure. Commented Jun 12, 2021 at 21:45
  • Not exactly: it's really a temporary NAME for the folder. Each folder is stored with the backup date and time as its name, but when it is being done, it has a 'B' letter prepended. After having copied all the files (or made hard links to the previous backup for files that haven't changed), and ended the RSYNC operation, I just rename the folder to the final name and do another RSYNC. This way, if there is a failure while doing the backup and the system reboots or whatever, I know that I can just delete any folder starting with 'B' because it is an unfinished backup. Commented Jun 12, 2021 at 21:53
  • Also, AFAIK, NFS doesn't support RSYNC too. Commented Jun 12, 2021 at 21:56
  • I use a NFS connection to run RSYNC to a "so-called NAS" Commented Jun 12, 2021 at 22:00
  • 1
    Ops, my fault: where I said "RSYNC", I meant "SYNC", the command that flushes the data from the disk cache into the disk (well, except in the first case, where I was talking about the backup command). Sorry. I'll edit my comment. I don't know in what was I thinking... Commented Jun 12, 2021 at 23:15

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.