Problem
You want to create a new storage group to allow for more mailbox stores, faster backups, or a logical organization of mailboxes.
Solution
Using a graphical user interface
- Open the Exchange System Manager (ESM) snap-in.
- In the left pane, browse to the server that you want to create a new storage group for.
- Right-click on the server and select New Storage Group.
- Enter a name, transaction log location, system path location for storage of temporary and recovered files and click OK.
Using a command-line interface
First create an LDIF file called add_sg.ldf with the following contents:
dn: CN=<
Storage Group Name>,<ParentDN>
changetype: add
objectClass: msExchStorageGroup
cn: <
Storage Group Name>
showInAdvancedViewOnly: TRUE
systemFlags: 1610612736
msExchESEParamEnableIndexChecking: TRUE
msExchESEParamEnableOnlineDefrag: TRUE
msExchESEParamSystemPath: <Path to store system files>
msExchESEParamPageFragment: 8
msExchESEParamPageTempDBMin: 0
msExchRecovery: TRUE
msExchESEParamZeroDatabaseDuringBackup: 0
msExchESEParamBaseName: E01
msExchESEParamCircularLog: 0
msExchESEParamEventSource: MsExchangeIS
msExchESEParamCheckpointDepthMax: 20971520
msExchESEParamCommitDefault: 0
msExchESEParamLogFilePath: <Path to log files>
msExchESEParamDbExtensionSize: 256
msExchESEParamLogFileSize: 5120
Replace < Storage Group Name> with the name of the storage group, <ParentDN> with the distinguished named for storage groups container for the appropriate server, <Path to store system files> with the filesystem path where you want system files (temporary and recovered files), and <Path to log files> with the filesystem path where you want exchange log files. Then run the following command:
>ldifde -i -f add-sg.ldf
Using VBScript
‘ This code creates a Storage Group.
‘ —— SCRIPT CONFIGURATION ——
strServer = “<
Exchange Server>” ‘ e.g. ExchServer2
strName = “<Storage Group Name>” ‘ e.g. SG1
strPath = “<File Path>” & strName ‘ e.g. D:\Program Files\ExchSrvr
‘ —— END CONFIGURATION ———
‘ Create URL to Storage Group
Set objSrv = CreateObject(“CDOEXM.ExchangeServer”)
objSrv.DataSource.Open strServer
‘ This for loop is a bit of a hack to retrieve the first Storage Group
‘ in the collection. VBScript doesn’t let you access specific elements
‘ of a collection the way Jscript can.
for each strSg in objSrv.StorageGroups
strTemp = strSg
exit for
next
strTemp = mid(strTemp,instr(2,strTemp,”cn”,1))
strSGUrl = “LDAP://cn=” & strName & “,” & strTemp
‘ Create/configure
Storage Group and save it
set objSG = CreateObject(“CDOEXM.StorageGroup”)
objSG.MoveSystemFiles(strPath)
objSG.MoveLogFiles(strPath)
objSG.DataSource.SaveTo strSGUrl
Wscript.Echo “Successfully created storage group.”
Discussion
Storage groups are used for physically breaking your databases up into smaller management groups. This is done for several reasons. Chief among them are so you will have more numerous but smaller databases, a logical organization of mailboxes, or faster Exchange backups and restores since the Exchange Server can run one simultaneous backup for each storage group. For example, if you have four mailbox databases in a single storage group, you can only have one backup running for that storage group; if you spread those four mailbox databases across two storage groups, you can run two simultaneous backups. For more detailed information on Exchange backups and file structures, see the Exchange Server Cookbook by Paul Robichaux et al. (O’Reilly).
Depending on the version (Standard or Enterprise) of Exchange, you can have up to four storage groups per server and up to five mailbox stores per storage group. ESM enforces these limits, but it is possible to directly modify Active Directory to exceed them. If you create more databases or storage groups than allowed by your version, the additional databases will not mount. In Exchange 2003, Microsoft recommends that you spread your mailboxes across as many stores and storage groups as possible; this is because of memory management improvements since Exchange 2000.
Storage groups are represented in Active Directory by the msExchStorageGroup class. This class has several attributes that have fairly intuitive string values and names and can be matched up to the options in ESM. Unfortunately, the raw Active Directory objects and attributes and their valid values for Exchange are not well documented. You can experiment with their settings, but you should do so only in a lab environment.
Using a Command-Line Interface
One negative aspect of creating storage groups by direct Active Directory object manipulation is that you will not get warnings concerning the maximum number of storage groups allowed.
Using VBScript
The process of calling the CDOEXM interfaces to create storage groups is rather straightforward once you have the URL for the location of the object in Active Directory. In this solution, to get the distinguished name of the storage group container for the server, the script loops through all storage groups on the sever and sets strTemp to the URL value of the last storage group. This value is then parsed to get the parent container for the storage groups to build the new storage group URL.