Restoring A Mailbox Using a Backup and Exchange Recovery Storage Group

4 Comments

My environment is Exchange 2007. I had a user whose exchange folders all dissapeared, we tried to restore it from Veeam and it gave some error about a Domain Controller or something like that which after speaking with Veeam they told us we couldn’t restore it using their methods. I ended up going with the Exchange Recovery Group Method found here.

http://technet.microsoft.com/en-us/library/aa997694.aspx

A helpful discussion about this is located here:

http://www.experts-exchange.com/Software/Server_Software/Email_Servers/Exchange/Q_24860312.html

First I created a separate disk on the exchange server because I didn’t have enough space on the hard drive that my exchange install was located on (it was a VM so I just added a 200gb drive to it) I assigned F:\ to it.

I restored the EDB and log files from my backup to “F:\First Storage Group” initially. I copy these later into the RSG

Some helpful commands before you start to see what your databases are named and what storage groups you have setup. If you’re not used to using the powershell these commands will help you out.


[PS] C:\Windows\system32>get-mailboxdatabase

Name Server StorageGroup Recovery
—- —— ———— ——–
Mailbox Database FLEMAIL First Storage Group False
Mailbox Database FLEMAIL Recovery121013 True

[PS] C:\Windows\system32>get-storagegroup
Name Server Replicated Recovery
—- —— ———- ——–
Second Storage Group FLEMAIL None False
First Storage Group FLEMAIL None False
Recovery121013 FLEMAIL None True

If you look above, I called my recovery group ”Recovery121013” which I created in the steps below. My database is just the default of exchange called “Mailbox Database” if you’re wondering why there are 2, one is my current live exchange database and the other one is the one i created in the steps below which is why it already says recovery. My email server is called “FLEMAIL”

So to wrap it up here’s the parameters I’m going to enter into the commands below:

<Server_Name> = FLEMAIL
<path_to_logfiles> = F:\First Storage Group
<RSG_Name> = Recovery121013
<Database_Path> = F:\First Storage Group\RSG
<database_name> = Mailbox Database

Here are the steps I used to create the recovery group and database and then restore the mailbox:

  • First Create the RSG

Here’s the command syntax

new-storagegroup -Server <Server_Name> -LogFolderPath <path_to_Logfiles> -Name <RSG_Name> -SystemFolderPath <Database_Path> -Recovery

Here’s the command I ran. I’m basically creating the Recovery Storage Group in a folder called RSG. The Recovery Storage Group is called Recovery121013

new-storagegroup -Server FLEMAIL -LogFolderPath "F:\First Storage Group\RSG" -Name "Recovery121013" -SystemFolderPath "F:\First Storage Group\RSG" –Recovery

  • Now I copy my “Mailbox Database.EDB” file and all the log files into the RSG folder that it just created, located in “F:\First Storage Group”
  • Now I add a recovery database called “Mailbox Database” to the RSG using the following command

Here’s the command syntax:

new-mailboxdatabase -mailboxdatabasetorecover <Database_Name> -storagegroup <Server_Name>\<RSG_Name> -EDBFilePath <Database_Path>

Here’s the command I ran:

new-mailboxdatabase -mailboxdatabasetorecover "Mailbox Database" -storagegroup FLEMAIL\Recovery121013 -EDBFilePath "F:\First Storage Group\RSG\Mailbox Database.edb"

  • The next step was to check to see if the database was in a clean shutdown state. I ran this command to check to see if it was and it was dirty so I had to clean it up.

eseutil -mh "F:\First Storage Group\RSG\Mailbox Database.edb"

  • Since it was in a dirty state I had to run the eseutil on it:

eseutil /r E00 /l "F:\First Storage Group\RSG" /d "F:\First Storage Group\RSG"

  • Now you set your recovery databases to allow overwriting

Heres the syntax of the command:

set-mailboxdatabase -identity <Server_Name>\<RSG_Name>\<Database_Name> -AllowFileRestore:$True

Here’s the command I ran:

set-mailboxdatabase -identity "FLEMAIL\Recovery121013\Mailbox Database" -AllowFileRestore:$True

  • Now that you have a clean recovery database, you can mount it

Here’s the syntax of the command:

mount-database -identity <Server_Name>\<RSG_Name>\<Database_Name>

Here’s the command I ran:

mount-database -identity "FLEMAIL\Recovery121013\Mailbox Database"

  • Next I create a user called in the “live” exchange called “john smith temp” and restore the mailbox there. You can actually restore it to the original mailbox or whereever you would like (see link at the beginning of this article for different options), for my purposes I used a temporary mailbox. It basically created a folder called “John Smith Temp” with all the users data within the mailbox by the same name.

NOTE: I ended up getting this error message: “Error occurred in the step: Moving messages. This mailbox exceeded the maximum number of corrupted items specified for this move mailbox operation” so i had to add the BadItemLimit flag to the end of the command. I put 1000 just in case. After this it restored correctly

Here’s the syntax:

Restore-Mailbox -RSGMailbox 'John Smith' -RSGDatabase 'RSG\Mailbox Database' -id 'Allison Brown' -TargetFolder 'JSmith Email'

Restore-Mailbox -RSGMailbox 'John Smith' -RSGDatabase 'Recovery121013\Mailbox Database' -id 'John Smith Temp' -TargetFolder 'JsmithTemp Email' –BadItemLimit 1000

I haven’t removed anything yet, but I believe these are the commands to remove the database and RSG after your done with it. Please do more research on this as I have not completed it

Remove-MailboxDatabase -identity FLEMAIL\"Recovery Storage Group"\"Mailbox Database"

Remove-Storagegroup -identity FLEMAIL\"Recovery Storage Group"

Advertisements

Factory Restore From The Dell Recovery Partition When The Repair Option Does Not Work

53 Comments

Recently someone gave me their Dell Mini 1018 that didn’t work.  It was Windows 7, so, according to Dell, the instructions to perform a Factory Restore were to tap F8 when the Dell logo appears and click Repair Computer (BTW Windows XP is Ctl-F11 after you first turn on the computer).  This is great if the computer boots into the recovery partition, but if it doesn’t you’re almost out of luck.  There could be 2 reasons why your computer might not boot into the recovery partition, one is that you erased the recovery partition, in which case I think you may have to order the recovery CDs from dell and get an external CD drive or put the CD’s onto a bootable USB stick. The other one is that for whatever reason the partition is there but the computer cannot boot to it.

NOTE: These instructions will completely wipe out your data.  You should have someone who is familiar with installing and repairing operating systems. I take no responsibility for lost data or screwing up your computer any more than it already is.  I assume if you are performing these steps you are unable to even boot your computer into Safe Mode.  If you need to get your data (pics, music) off first, a good solution would be to boot from a Ubuntu Live CD, click Try Ubuntu, and then copy all your files to a USB stick. Or if you can boot into safe mode (it will give you the option if you keep hitting F8 after the dell logo disappears) you can get your files off with a USB stick, copying to a network folder, or maybe burning a disk I will try to create instructions on how to do this in the near future and put a link here.

One of the most important parts of this is to make sure that you have not wiped out your recovery partition. One way to figure out if you have the recovery partition is when you first go into the command prompt detailed in the instructions below, try typing in d:  and then type in dir.  it should say “Volume in drive D is RECOVERY” and display a couple of files. (if you want to see all files try dir /a)

You will need to boot into recovery mode in Windows, you can do this using a Windows CD or a bootable Windows 7 USB stick, and getting to a command prompt, by clicking on repair your computer, and going to recovery options.

I received these commands from the following site:

http://answers.microsoft.com/en-us/windows/forum/windows_vista-windows_install/dell-factory-image-restore-help/62fa4436-e2e0-4f8b-b9ab-f5b7f47be673

AGAIN THIS WILL ERASE EVERYTHING THAT”S CURRENTLY ON YOUR HARDDRIVE

  1. Boot into the Windows 7 Setup CD or USB stick by pressing F12 during the dell logo.
  2. After the CD loads choose your language, and then on the screen wher it says Install Now, on the bottom left there should be an option to “Repair Now” click this
  3. System Recovery Options now comes up and it will search for Windows Installations, when it’s finished make sure “use recoevery tools that can help fix problems…” is selected and click next
  4. You should now come up to a screen that has a bunch of selections, one of them being  “command prompt” click this
  5. Now it should come up with a prompt that says  X:\Sources. Type “diskpart”

X:>diskpart

  1. The prompt should change to DISKPART>, type “list disk”
    1. DISKPART>list disk
    2. You should then get something that looks like this:

DISK ###              STATUS                      SIZE                  FREE                      DYN       GPT
Disk 0                    Online                   232 GB                  0 B
Disk 1                    No Media                 0 B                     0 B

  1. Now you want to choose your disk. It will MOST LIKELY be the disk that is the largest, . In my case above it is “disk 0” at 232GB.  Yours may be different, for instance if you have an external drive attached or 2 hard drives or a USB stick plugged in.  Type the following at the DISKPART prompt replacing the disk that you have:
    1. DISKPART>select disk 0

It will say: Disk 0 is now the selected disk

  1. Now type “list partitions” to list the partitions on the selected disks
    1. DISKPART>list partitions
    2. You should get something that looks like this:

Partition ###                     Type                      Size               Offset
Partition 1                   OEM                      100 MB                 1024 KB
Partition 2                  Primary                    9 GB                  101 GB
Partition 3                   Primary                  223 GB                    9 GB

  1. If you look above, the obvious partition that stores all the files is Partition 3, because it is extremely large (223GB)  Again Be careful, if you have an external hard drive plugged in it may show up here and you could wipe it out.  I would suggest unplugging anything else beforehand just in case. Now type “select partition 3”
    1. DISKPART>select partition 3
    2. Now that you have selected the correct partition, you need to format it.  This step will wipe out your data and can take a very long time.  If you are not sure what you’re doing then type exit, if you want to continue then type “format”
      1. DISKPART>format

You are not done yet, all we did here was wipe out the data on your drive. Now that the data is wiped out, you need to apply the Dell Factory Restore image to the drive.  Here are the instructions for this.  I

  1. Type exit to leave the DISKPART> prompt  Your new prompt should look like this
    1. X:\Sources>
    2. You will now want to switch to your Recovery partition, which will most likely be drive D:\.  Type in the following 2 commands
      1. X:\Sources>d:
      2. D:\>dir
      3. You should see the following

Volume in drive D is RECOVERY
Volume Serial Number is 3ADB-70AC (this will vary)

04/18/2012                         4:54    AM                4,106     ADRInfos.xml
12/25/2010                         12:28 AM             <DIR>    Recovery
                                                  1 File(s)           4,106 bytes
                                                  1 Dir(s)    5,184,368,640 bytes free

If you see the “volume in Drive D is Recovery” then you are definitely in the right drive, if not you want to try to E: F: G: H:  etc and then do a dir until you are on the recovery drive.

  1. This is the part where you apply the image.  You will type the following:
    1. D:\>imagex /apply d:\dell\image\factory.wim 1 c:\
    2. The above command should apply the dell image to your C drive and restore your drive to factory defaults.
    3. After it’s done just type “Exit” to leave the command prompt and then click the restart button.
    4.   There could be a problem here. We’re assuming that c: is the drive that you are installing this to (check this by switching to c:, and performing a dir, there should be no data on it because we wiped it out before.
    5. Another problem (and I ran to this problem on mine) is that there is no imagex program. You will get the error message: “ ‘imagex’ is not recognized as an internal or external command, operable prgram or batch file”  In this case you will have to download the program “imagex” off of the internet (do a google search) and copy it to the D: drive.  What you can do is copy it to a USB stick, plug it into the computer.  Then figure out what directory the USB stick is named by trying the different letters E: F: G: H: I: J:, and doing a Dir to see if you see the file.  If after a dir you see it then just type xcopy imagex.exe d:’, switch back to the D drive, and run the command in step A again.  Mine happened to be located on drive H: but I also had an external CDROM plugged.

Another note is that I got the imagex program by downloading the file from Windows Automated Installation Toolkit If you need it for another OS just google it.

 

Yet Another Note: If you get an error 1812 (error restoring image, the specified image file did not contain a resource section), this may be due to dell splitting the image file into multiple files.  If you read Brian M. post below on Nov. 20th 2012 it will explain more, but please be careful, his recovery drive was C: and the drive that he wanted to apply the img file to was D:. If your setup is like mine, and your recovery was d: and the drive to apply it to was c: you will want to reverse the c and the d in the command that he has provided.

I hope this works flawlessly for you. If you’re familiar with Windows commands it should be relatively simple, if not you may have your tech savvy friend perform the steps for you.