lost+found Restoration

1) After fsck -Cy /dev/sdaX

2) Mount the problem partition, then all problem file/folder will be fixed
like as #12345678 and stored in "lost+found"

3) Use combination command for the restoration:

## Find ALL files/directory/both recursively, But it consumed many many hours!!!
find /mnt/oldserver/lost+found -exec file {} \; > find-lostfound-all.txt &
find /mnt/oldserver/lost+found -type f -exec file {} \; > find-lostfound-file.txt &
find /mnt/oldserver/lost+found -type d -exec file {} \; > find-lostfound-dir.txt &

## find all #xxxxxx files in "lost+found" only
find /mnt/oldserver/lost+found -maxdepth 1 -type f -exec file {} \; |less
## find all #xxxxxx directory in "lost+found" only
find /mnt/oldserver/lost+found -maxdepth 1 -type d -exec file {} \; |less

## find all "INBOX" directory recursively (Exclude original INBOX folder is converted into #xxxxxx)
find /mnt/oldserver/lost+found -type d -exec file {} \; |grep "INBOX: directory" > /root/find-lostfind-INBOX.txt &

## find all #xxxxxx files in "lost+found" only which its context contain the keyword
find /opt/kerio/mailserver/ -maxdepth 1 -type f -exec grep -i -H 'MailboxLocation' {} \; |less

## find all #xxxxxx folders within 180 days in "lost+found" only
find /mnt/oldserver/lost+found -maxdepth 1 -type f -mtime -180 -exec file {} \; |less

## find all #xxxxxx "text" files within 180 days in "lost+found" only , then make it as the list
find /mnt/oldserver/lost+found -maxdepth 1 -type f -mtime -180 -exec file {} \; |grep text > /root/separate-noClarify-email-180.txt &
for i in `cat separate-noClarify-email-180.txt`; do mailpath=`echo $i | cut -d ':' -f1`; echo $mailpath; done |grep mnt > separate-noClarify-email-180-final.txt &
## make the sh to separate according above generated list:

for i in `cat /root/separate-noClarify-email-180-final.txt`; do
echo    mv $i /mnt/oldserver/recovery_email
#        mv $i /mnt/oldserver/recovery_email

## Change all recovery email from #xxxxxx to #xxxxxx.eml (For kerio)
cd /mnt/oldserver/recovery_email
find . -exec mv {} {}.eml \; &

## After separate All #xxxxxx file as "text" into other folder, you can make the list for those mapping with email address:
grep -irn -m1  "for "/mnt/oldserver/recovery_email |grep "@" > /root/recovery_email_list.txt &

Server is hosted by Alanstudio
Linux Operating System

Recommend screen resolution 1024 x 768 / IE / FireFox
Alan Studio © 2007 by Alan Cheung Hin Lun. All rights reserved.