Solved

Recover Data from FreeBSD lost+found

Posted on 2008-11-02
4
1,587 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

From Coral's  "So You Want To Play With Computers" Series Preface: What follows is a tweaked reprint from 2005/06. This is a True Story. The names have been changed to protect the guilty. While this deals with a fairly simple, text file recovery…
Employees depend heavily on their PCs, and new threats like ransomware make it even more critical to protect their important data.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…

792 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