extract a file from DAR
Friday, November 9th, 2007Gosh, you have remove a important file by error. Thus, you just need to restore it, not the rest of the full and differential backups.
a) First method:
We could as previously, try all archive starting from the full backup up to the most recent differential backup, and restore just the file if it is present in the archive:
dar -R / -x /zip/linux_full -g home/denis/my_precious_file
This would restore only the file /home/denis/my_precious_file from the full backup.
OK, now we would also have to restore from all differential backup the same way we did. Of course, this file may have changed since the full backup.
dar -R / -x /zip/linux_diff1 -g home/denis/my_precious_file
and so on, up to the last differential archive.
dar -R / -x /zip/linux_diff29 -g home/denis/my_precious_file
b) Second method (more efficient):
We will restore our lost file, starting from the most recent differential backup and *maybe* up to the full backup. Our file may or may not be present in the each differential archive as it may have changed or not since the previous version, thus we have to check if our file is restored, using the -v option (verbose):
dar -R / -x /zip/linux_diff29 -v -g home/denis/my_precious_file
If we can see a line like
restoring file: /home/denis/my_precious_file
The it stops here, because we got the most recent backup version of our lost file. We have to otherwise have to continue with the previous differential backup, up to the full backup if it is necessary. This method has an advantage over first one, which is not to have *in all case* the need to use all the backup done since the full backup.
If you are lazy on the other hand, have a look at dar_manager (at the end of the tutorial)
OK, now you have two files to restore. No problem, just do the second method but add -r option not to override any more recent file already restored in a previous step:
dar -x /zip/linux_diff29 -R / -r -v -g home/denis/my_precious_file -g etc/fstab
Check the output to see if one or both of your files got restored. If not, continue with the previous backup, up to the time you have seen for each file a line indicating it been restored. Note that the most recent version of each files may not be located in the same archive, thus you might get /etc/fstab restored from linux_diff28, and /home/denis/my_precious_file restored at linux_diff27. In the case /etc/fstab is also present in linux_diff27 it would not have been overwritten by an older version, thanks to the -r option.
This option is very important where restoring more than one file using the second method. Instead, in the first method (restoring first from the full backup, then from all the following differential backups), -r option is not so important as if overwriting occurs when you restore lost files, you would only overwrite an older version by a newer.
Same thing here, even if you are not lazy, dar_manager can help you lots here to automate the restoration of a set of file.
How much can you restore with dar_manager? As much as you can give to dar_manager as argument on command line or through included files (-B option).