If you have accidently deleted a needed file on your hard drive, paxbac you can restore them from the archives on your paxbac disk. Luckily, since paxbac appends to old archive, it will make a new version of your file in the pax archives as there are modifications of the file. If you backup my_file.txt on Monday, modify it on Tuesday, back it up again on Wednesday, modify it on Thursday, and again backup on Friday, there will be three copies in the pax archives, for Monday, Tuesday, and Thursday.
The procedure for linux and Mac restores are almost identical, with the exception that Mac has a few extra steps. See the Mac section below.
In order to restore a single file, first locate the disk it is on. Go to your paxbac home directory and enter into the important_info/logs directory. Open up the XML file corresponding to your backup set in a text editor and do a search for the file. Once you determine what disk it is on, put that disk in the drive. If you want just the copy of the file when last backed up, type:
pax -r -f <path_to_pax> '<filename>'
In this case, <path_to_pax> stands for the location of your pax file, and the <filename> stands for the name of your file. So on my linux system, if I want to restore a file originally located at /home/paul/my_file.txt, I would type:
pax -r -f /mnt/cdrom2/pax_2005_01_01_01_01_01.pax 'home/paul/my_file.txt'
The files will end up in the directory from which you type the command. It will probably overwrite any existing files, so beware!
Note how I type ’home/paul/my_file.txt’ without the first forward slash, since all files are stripped of the forward slash.
You can also use matching patterns to find files where you don’t know the full name, or when you don’t want to type in the full name.
pax -r -f /mnt/cdrom2/pax_2005_01_01_01_01_01.pax '*my_file*'
In this case, pax would unpack any files to the current directory that match “my_file”, which would include “/home/paul/my_file.txt” and /home/paul/Documents/my_file.txt“ and /home/paul/my_file.jpg”.
If you want to restore all versions of the file backed up rather than just the latest, use the interactive option and type:
pax -r -i -f <path_to_pax> '<filename>'
The pax utility will prompt you with a message each time it finds the pattern in <filename>. Give a different name to each file.
For a Macintosh system, you may have to do the extra steps of unpacking the resource forks. However, if the file does not have resource forks (as many files don’t), or if the resource forks aren’t important (as with MS Word file), you can skip this step altogether.
The resource forks have the same name as the file, with the addition of ’/..namedfork/rsrc’ or ’/..namedfork/finf’ at the end. Use patterns to match these extra paths.
If I had a file with the location of /home/paul/my_file, I could type:
pax -r -f /Volumes/CDROM/pax_2005_01_01_01_01_01.pax 'Users/paul/my_file*'
Since I ended my command with the “*”, the my_file would match, as would the my_file/..namedfork/rsrc and /my_file/..namedfork/finf pattern. Hence, by simply appending a “*” to the end of your pattern, you can insure that your resource forks get restored.
If you need to restore all versions of a particular file with the interactive option, you need to take a few extra steps. First, create two temporary directories and change to one of those directories. Type:
pax -r -i -f <path_to_pax> '<file_name>*'
A real life command of the above looks like:
pax -r -i -f /Volume/CDROM 'home/paul/my_file*'
You will first be given the name of the file itself and prompted to provide a file name. Simply press ENTER. Next you will be given the names of each resource fork. Press ENTER for each.
At this point, you want to open up another terminal and move to the same directory, leaving pax in the background. The idea is to copy the file to the other temporary directory so you can continue the process with pax without worrying about overwriting the same file.
Type:
ditto <name_of_file> <name_of_other_temp_dir/new_file_name>
rm <name_of_file>
The ditto command will copy the resource forks, so you only have to issue the command once, with the name of the actual file. Make sure you give a unique name to each file in the temporary directory so that you won’t overwrite each file you unpack.
A real-life translation of the above commands is:
ditto my_file temp_dir2/my_file_version1
rm my_file
Now that you have moved the file, go to terminal one and continue the steps for each file.
A partial restore is one in which you need to restore only certain directories. It contrasts with a full restore, in which you restore a dead hard drive with everything from the pax archives.
The method you use depends on whether you want to allow pax to overwrite files that have the same path.
If you can allow overwriting, simply mount the first disk from your set. Change to the root directory and type:
pax -r -f <path_to_pax>
For each pax archive on your disk. Keep putting in disks until you are done.
If you cannot over-write files, you have to create a temporary directory. Change to this temporary directory and type:
pax -r -f <path_to_pax>
This unpacks the latest version of each file. Now you need to move these files to the right place. Type:
pax -k -pe -rw . /
This second command tells pax to copy everything in the current directory to the root directory, but the -k tells pax to not overwrite any existing files. (Note that you can’t use the pax with the -k flag directly, as in ’eg: pax -r -k -f <path_to_pax>’ . Since paxbac creates archives that are appended to, this command would only write the first, rather than the last file.)
Repeat with every archive on every disk, always working backwards, from newest to latest.
A full restore is on in which your hard drive has died. You install a new hard drive, unpack the pax archives, and reboot.
In this case YOU ARE ON YOUR OWN!
Doing such a restore is a bit complicated and each system will have its own methods. Basically, I believe there will be one method for the Macintosh and one for linux systems, but even here I am not sure.
For linux systems I would suggest you look at bare-metal . (A text copy of this page is also present on each paxbac backup disk.)
For such a restore, you need to know certain fdisk information. paxbac creates this information for you each time you backup. You will find all this vital information in the emergency_info directory on each disk you create.
I don’t know how to do a full restore on a Mac, but my understanding is that you would boot up from you System CD, use the utility commands to format your new hard drive, and then unpack the pax archives on to this hard drive.
Note that you would need an extra CD device to do such an install, since the System CD would be in your main CD. You may be able to get away with a plug in USB CD.
Alternatively, you could do a minimum system install on your new hard drive. You could then boot up from that hard drive, and do a so-called partial install as outlined above, in which you would unpack all the pax archives, overwriting any files that already exist. In effect, this would be the same as transferring data from the pax archives on to your hard drive without the hassle of having to do so from a boot disk.
If your backup set is old, it will contain many old files you no longer want on your hard drive. Luckily, there is an easy way to get rid of them.
Each paxbac disk contains a file called “stale_files”. The most recent version of this file will be found on your last CD.
Copy this file to your hard drive, or to the temporary memory if you are doing an emergency install.
Type:
sed -e 's/^/rm -f /' stale_list > remove.sh
This creates a simple bash script in which each line becomes a command to remove that file.
Now type:
bash remove.sh
You may get a lot of messages telling you that it cannot find so and so file. Ignore them.
Your old, stale files are now removed.