Jerry McAllister jerrymc at msu.edu
Mon Sep 14 14:33:57 UTC 2009

On Sun, Sep 13, 2009 at 06:15:55PM -0700, Chris Maness wrote:

> I level 0 dump of my server.  I lost a file that I need back.  Is it
> possible to use restore like tar and explode it into a directory
> instead of a pristine partition/mount?  Or even better, is it possible
> to just extract a single file without exploding the whole tape dump?

Yes, it is easily done. 
Just use the 'interactive' option.   

First, be clear where you want the restores file[s] to go.
The official way to do the interactive option is to cd in to
the bottom level of the filesystem it is in and do it from there.
Restore will then put the files in the directories where they
were when the dump was made.  So, if the file[s] were in /home/joes/files/
cd to /home and do the restore.   It will take care of knowing 
about the joes and files subdirectories and build them if they
are not there.

But, really the general recommended way (and the way I do it) to do 
an interactive restore is to create a designated directory for it
and cd in to that.   It can be anywhere there is room for the files.

So, for example, on some systems I have a large amount of extra space
in a filesystem I mount as /work.   Within that I create a directory
I can recover  (for lack of any more imaginative name).  I cd to
the /work/recover directory and do the interactive restore.

eg do:   

   cd /work/recover
   restore -if  dump_device/file

Then fish around amongst the directories.   When you find the one[s] you
need to restore, just do     
  add filename    
You can keep going and add several files and directories.  
When you have all that you want/need, then type

It will ask you what tape to start with.  If the dump is a file
or of there is only one tape or other device, type 1     If there are 
more than one tape, type in the number of the last tape.  It will
search backward through the list of tapes/devices until it finds the
files.  eg.   if there are 7 tapes in the level 0 dump set, start
with 7, then give it 6 and then 5, etc.   It will quit asking when
it finds the files.

Finally, it will ask if you want to set ownership of .
Say no unless you have a good reason for doing otherwise.

Now, if you have used a separate directory as I suggest above, 
tell restore to quit and then look at the file[s] to make sure
they are all right and then manually move then to whichever directory
you want.   You can then delete them from /work/recover but leave
that directory around for when you need it again.   

This is good for any circumstance when you want to pull just one
of a few files out of a dump (or a tar file).

I do a similar thing when I untar stuff I have moved over.
I make a  /work/unroll  directory and untar stuff in there
and move whay I want to where I want it.  

This may seem to be an extra unnecessary step, but it cuts down
on errors, in my handling directories and file locations.


> Sorry if the question seems stupid.
> Chris KQ6UP
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"

More information about the freebsd-questions mailing list