Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Sep 2009 10:28:49 -0400
From:      Jerry McAllister <jerrymc@msu.edu>
To:        Chris Maness <chris@chrismaness.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Dump/Restore?
Message-ID:  <20090914142849.GA47054@gizmo.acns.msu.edu>
In-Reply-To: <b2e0a4330909131815k65cacd76k6a3900e05e6b4655@mail.gmail.com>
References:  <b2e0a4330909131815k65cacd76k6a3900e05e6b4655@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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
  extract

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.

////jerry

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090914142849.GA47054>