Solved

Recover Data from FreeBSD lost+found

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

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 61

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 61

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
VM backups can be lost due to a number of reasons: accidental backup deletion, backup file corruption, disk failure, lost or stolen hardware, malicious attack, or due to some other undesired and unpredicted event. Thus, having more than one copy of …
In this Micro Tutorial viewers will learn how to restore their server from Bare Metal Backup image created with Windows Server Backup feature. As an example Windows 2012R2 is used.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now