Using rdiff-backup to correct a corrupted upload.
Scenario :
You have created an ISO file to distribute and uploaded it to a file server. However the file has been corrupted in the process. Can you distribute the correct file without needing to upload again, and again?
Answer :
Yes! You can accomplish this with a work-around using rsync-backup.
Process : –
You have 'yourfile.iso' locally in valid form and also 'yourfile.iso', corrupted, on-line.
In a Konsole window, do the following steps : --
-
Create a new directory and navigate to it.
mkdir /tmp/temp-iso && cd /tmp/temp-iso
-
Copy the correct version of the ISO file here.
cp /path-to/yourfile.iso ./
-
Create a temporary mirror directory and use it to mirror the /tmp/temp-iso directory.
mkdir /tmp/temp-mirror
-
Use rdiff-backup to back up the directory containing the correct version of the file to the temp-working directory.
Rdiff-backup ./ /tmp/temp-mirror
This will create a mirror of the current directory, and include a subdirectory with the meta-data, called 'rdiff-backup-data' which will also contain the incremental file, which it is safe to delete to save space and for later use.
-
Copy the corrupted version of the file into the temp-iso directory, over the top of the existing correct file.
-
Now repeat the rdiff-backup process. It will complain that you have deleted that incremental file, but this will not break the process.
Rdiff-backup ./ /path-to-/temp-iso/
-
You now have all the information needed in the 'rdiff-backup-data' directory to 'revert' to the 'earlier' version of 'yourfile.iso' file, which is the correct version, and assuming that you have the corrupt version already.
-
Gzip the 'rdiff-backup-data' directory and distribute this along with the corrupted version of the file to end-users.
-
End-users now repeat the last steps to 'restore' the correct version from the corrupted version that they have downloaded.
Just copy the corrupt version into a /tmp/temp-mirror directory, gunzip the 'rdiff-backup-data' into the same directory and run rdiff-backup in restore mode to 'restore' the corrupt file to the correct original.
Make sense?
Comments (0)
You don't have permission to comment on this page.