Data Recovery

Jerry McAllister jerrymc at msu.edu
Thu Nov 30 08:25:04 PST 2006


On Thu, Nov 30, 2006 at 03:29:39AM -0800, Rachel Florentine wrote:

> Hi;
> Is there a data recovery utility anywhere available? Not one that loads 
> into Windoze, but straight into FBSD. I tried the following command to 
> back up my working HD to my new 1/2 teraflop HD:
> 
> cp -R /* /ad2
> 
> and I managed to crash the system (recovered easily) and fry some important 
> files on ad2. 

That won't really get what you want anyway.  It doesn't handle hard links
the way you want and I don't really think it will get other file systems
mounted in root (/), though I haven't tried that.   Also, I think you would
need a trailing '/' on ad2 in your command to come even close.

How about using dump(8) and restore(8).
They handle everything correctly.

You can either leave everything in the dump file[s] on your big disk
just in case you need it [them] in the event of a failure on you
main working disk or build file systems on the big disk and restore 
everything in to them so the file systems are mountable from the big
disk.  The first choice probably makes most sense as a backup/recovery
method.

This is not a ghost type sector-by-sector backup (which is mostly useless)
but a file-by-file backup (including all directory structures and links).
So, you need to run dump for each filesystem you want to back up.
First, create one large slice on ad2 using fdisk.
Then create at least one partition in that slice using bsdlabel.
Then create filesystems in the partitions using newfs.
Then you can write to that disk with regular commands such as cp, tar or dump.
Then, presuming one slice (1) and one partition (a), 
mount that big partition as something - lets say '/stash'
  eg  mkdir /stash
      mount /dev/ad2s1a /stash
Now use dump
  dump 0af /stash/rootdump /
  dump 0af /stash/usrdump /usr
etc

If you create separate file systems to make mountable images of each
file system, then mount them as something sensible - say /bakroot and /bakusr
Then to use dump/restore, do:

  cd /bakroot
  dump 0af - / | restore -r -
  cd /bakusr
  dump 0af - /usr | restore -r -

This will get you working copies of those two file systems including
links - which will still point to the real locations, not the copies,
of course.

Anyway, regardless of what you do, you must fully create at least
one file system on the big disk and them mount it to write to it.   
You cannot write directly to the unprepared device as ad2.  
Of course, you could create that partition as above doing fdisk, 
bsdlabel and newfs and then create a mount point called /ad2 and
mount it as such.   But, I would shy away from that, just because
it can create confusion.  I would recommend using mount point names
that represent what is to be written there as I have done above.

////jerry



> TIA,
> Rachel
> 
> __________________________________________________________________________
> Yahoo! Music Unlimited
> Access over 1 million songs.
> http://music.yahoo.com/unlimited
> _______________________________________________
> 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