Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Recover Data from FreeBSD lost+found

Posted on 2008-11-02
4
Medium Priority
?
1,653 Views
Last Modified: 2013-12-06
Over the weekend, I had an email server RAID5 array fail. After bringing the array back online and running fsck, the entire /usr now how has 1 directory, lost+found. Inside the lost+found are hundreds of directories, of which very few contain anything. df - h still reveals /usr as having 24GB used. However most of this data does not appear to be visible. I would really like to recover these emails for my customers, but I do not know where to go from here, assuming it is even possible. I would appreciate any direction or advice.

Sample directory listing of /usr/lost+found

#05274997       #05648578       #05956413       #06287585       #06929083
#05274998       #05648580       #05956416       #06287586       #06929084

All of the directories look like this except for these 3:

Makefile
patch-ad
pkg-plist
0
Comment
Question by:FusionNetworks
  • 3
4 Comments
 
LVL 62

Expert Comment

by:gheist
ID: 22865273
file * */*

If /usr did not contain mail spool you can reinstall -

csup all sources to RELENG_6_3
buildworld + installworld base system

record output of pkg_info

do pkg_delete -a and pkg_add -r packages one by one

That should more or less recover content of /usr

0
 
LVL 62

Expert Comment

by:gheist
ID: 22865280
You can try installing a system aside on some working but soon-to-recommision workstation while reinstalling server with 7.0
0
 

Accepted Solution

by:
FusionNetworks earned 0 total points
ID: 22866589
Sorry gheist, I may not have been perfectly clear on what I needed help with. But I greatly appreciate your responses. I was trying to recover 24GB of email directories and message in /usr/local/virtual when the entire /usr slice was corrupted.

I was able to resolve this. Here is what I did.
1. Installed FreeBSD on a second drive array in the server. Which could then access the old drive array.
2. Copied the corrupted slice from the original drive array to a file on the new drive array using DD. (dd if=/dev/SOURCE of=/dev/DEST bs-8192)
3. Mounted the image file.
       mdconfig -a -t vnode -f /IMAGEFILE -u 0
       mount /dev/md0 /mnt
4. Moved the lost+found directory from the newly out of the newly mounted image file
5. Umounted the image file (umount /mnt)
6. ran fsck on the unmounted image file (fsck -t ufs -fy /IMAGEFILE)

This created a new lost+found directory. Inside of which, among other folders was a 23GB folder (#04945920) which appears to be my old /usr/local with all of the subdirectories listed. Specifically the virtual folder that contains all of my customers maildirs and emails. Upon closer inspection all maildirs and messages are intact. Woohoo!

0
 
LVL 62

Expert Comment

by:gheist
ID: 22867170
I clearly did not get the essence of your request.
Glad you fixed it.

dd conv=noerr,notrunc does go over bad blocks if you ever run into problem again

Now you noticed softupdates in action - ./local was unlinked because of excess activity below it. Let me recommend using separate system for fast changing data... (like /var)

0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Facing problems with you memory card? Cannot access your memory card? All stored data, images, videos are lost? If these are your questions...than this small article might help you out in retrieving your lost or inaccessible data.
Many businesses neglect disaster recovery and treat it as an after-thought. I can tell you first hand that data will be lost, hard drives die, servers will be hacked, and careless (or malicious) employees can ruin your data.
In this Micro Tutorial viewers will learn how to restore single file or folder from Bare Metal backup image of their system. Tutorial shows how to restore files and folders from system backup. Often it is not needed to restore entire system when onl…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question