Copyright © 2010 Frank's Blog.
Windows 2008 Direct Server Return not working
If you are having issues with getting Windows 2008 to work with DSR (Direct Server Return), chances are you have disabled your firewall and had no luck with it working, but after the commands below are executed you should be up and running.
netsh interface ipv4 set interface “net” weakhostreceive=enabled
netsh interface ipv4 set interface “loopback” weakhostreceive=enabled
netsh interface ipv4 set interface “loopback” weakhostsend=enabled
Exchange 2007 has the feature of reinstalling a server the exact way it was when it was operational. I ran into an issue in my development environment where I had to reinstall the server from scratch because it would not uninstall exchange 2007 or upgrade to Service Pack 2. Because this was a dev server I simply reinstalled the server from scratch. Installed Windows updates, I should also mention the server has to be the exact name it had before and was rejoined to the domain.
The first step I performed was putting in the Exchange 2007 CD and open up a command prompt
Change directory to CD drive, in my case the CDROM is D drive.
Type in the following command
setup /mode:recoverserver
In my case, I was missing patches that were needed by exchange installation. I visited Microsoft website plugged in all Error ID’s and download the needed software, but as you can see from the output it knows the exact way this server setup before.
After installing needed patches, I begain to run the command setup /mode:recoverserver again. As you can see from the output screen still no luck.
I searched for a bit on Google and had no luck with fixing this issue, so I decided to go to Plan B, I would force remove the server from active directory and reinstall exchange.
I Lunched ASEDIT, and added Configuration
I Click on Plus sign next to Configuration, CN=Services, CN=Microsoft Exchange, CN=DomainName, CN=Exchange Administraive Groups, CN=Servers
Here I delete the server having issues.
I got a prompt and clicked on Yes to continue
I got a warning stating you will be deleting the container and everything in it. I clicked on yes to continue.
I notice exchange wrote that my server was in recover mode because when I ran the installation again it told me I had to do a server recovery. I went to control panel and clicked on add remove programs and notice exchange installation was presient. I click on remove and uninstalled it. After this I check registry on the server and notice the registry and was still there, so I decided to remove it.
I Launched Regedit
Navigate to
+HKEY_LOCAL_MACHINE
+SOFTWARE
+MICROSOFT
Here I deleted the +EXCHANGE folder
After this I had to reboot my server because exchange was complaining that it has to reboot before starting any new installation.
Now I ran into a weird installation issue, my Default Offline Address Book was corrupted. Got this error during installation
I proceeded to delete it and recreate it with the following power shell commands.
C:\>Remove-OfflineAddressBook "Default offline address book"
Confirm
Are you sure you want to perform this action?
Removing Offline Address Book "Default offline address book".
Help
(default is "Y"):y
Confirm
The offline address book that you selected for removal is the default offline
address book. If you continue, Outlook users may not be able to access their
offline address books. Are you sure you want to delete Default offline address
book?
Help
(default is "Y"):y
C:\>New-OfflineAddressBook "default offline address list" -AddressLists "default global address list" -Server exmbx01
After this, I was finally able to install exchange successfully.
Configuring IPHONE with Exchange 2007 Active Sync
From your IPhone navigate to settings menu and select Mail, Contacts, Calendars
Now fill in the following box as follows
Email: Your email address
Username : your email address
Password: your password
After verification you would be brought to this screen.
Under server box input the OWA URL
For example: mail.example.com
After clicking on next the setup will complete and you will be brought to what you would like to sync, after selecting what you would like to sync click on save to complete wizard.
Managing your Active Sync Device from Outlook Web Access in Exchange 2007 SP1
In Exchange 2007, Outlook Web Access (OWA) offers a portal for users to manage their Exchange Active Sync (EAS) devices.
How to access that information?
Here is what the page looks like:
Note: If ActiveSync is not enabled for the Exchange user, "Mobile Device" tab won’t be shown. You can run the PowerShell command to check the status. Here is the result from a test server for example:
D:\Documents and Settings\ Administrator >Get-CASMailbox -Identity:test |fl ActiveSyncEnabled
ActiveSyncEnabled : True
What can the page do for you?
Note: The following includes the Exchange 2007 and Service Pack 1 (SP1) features:
1) Device status
As shown in the snapshot, the page will list all the Active Sync devices that the Exchange user has ever synced. Each device will be identified with its Type, Last-Sync-Time, and Status, which contains detailed device information, such as First-Sync-Time, User-Agent, etc.
Note: Exchange has provided the protocol support to let the device send up the device-related data (e.g. Friendly Name, OS, Phone number, etc) to the server. But not all devices implement that part of protocol. Therefore, it’s possible that you won’t see all the data shown in the screenshot.
On the server side, the Exchange administrator can use the following PowerShell command to get the same data.
D:\Documents and Settings\Administrator>Get-ActiveSyncDeviceStatistics -mailbox:test
FirstSyncTime : 5/11/2007 10:07:47 PM
LastPolicyUpdateTime :
LastSyncAttemptTime : 5/11/2007 10:07:56 PM
LastSuccessSync : 5/11/2007 10:07:56 PM
DeviceType : PocketPC
DeviceID : v120Device
DeviceUserAgent : NSync
DeviceWipeSentTime :
DeviceWipeRequestTime :
DeviceWipeAckTime :
LastPingHeartbeat :
RecoveryPassword : ********
DeviceModel :
DeviceIMEI :
DeviceFriendlyName :
DeviceOS :
DeviceOSLanguage :
DevicePhoneNumber :
Identity : test@contoso.com\AirSync-PocketPC-v120Device
2) Remote Wipe
This is a very handy feature that was only available to Exchange administrators in Exchange 2003. Now an EAS user can wipe his/her device, primarily in case of device loss. Once the link is clicked and confirmed, the wipe command will be issued to the server and the link will change to "Cancel Wipe Request". (SP1 feature)
As you can infer, there is still a chance for the EAS user to cancel a wipe request if he/she initiated it by accident or subsequently found the device. But the courtesy time is short – once the device initiates a sync to the server and picks up the wipe command, it will be too late to undo the request.
Right before the device clears its data, it will send a last notice to the server. Accordingly, the server will be very friendly to send the device owner a "Remote Device Wipe Confirmation" email, telling you the device is cleared. (SP1 feature)
Note: After the remote wipe, if you luckily find your lost device and want to re-sync it, you must remove it from the OWA device list (refer to "Remove mobile device" section for more info). Otherwise, it will keep on re-wiping itself. This is a security feature by-design.
The following shows how to wipe and cancel wipe with corresponding PowerShell command:
D:\Documents and Settings\Administrator>Clear-ActiveSyncDevice -Identity:test@contoso.com\AirSync-PocketPC-v120Device
Confirm
Are you sure you want to perform this action?
Clearing Mobile Device
"test@contoso.com\AirSync-PocketPC-v120Device". All the data on the device will be permanently deleted.
Help
(default is "Y"):y
D:\Documents and Settings\Administrator>Clear-ActiveSyncDevice -Identity:test@blah- dom.blah.com\AirSync-PocketPC-v120Device -Cancel:$true
3) Remove mobile device partnership
This is the first link above the device table. Basically what it does is to clean up the sync state data of the selected device on the server. It’s useful in several situations:
a. Clean up data: if you switch to a new device, the legacy data of the old device will still hang around occupying your mailbox space. You can find the device and clean it out.
b. Terminate remote wipe: as being said, if you want to re-sync your device after a remote-wipe, you have to come to here to remove it first.
c. Start from scratch: well, theoretically this wouldn’t happen, but it might in the real life – if you feel your device is not working properly and want to start a fresh sync from the scratch, you can remove the device partnership from the server (i.e. here) and the device, then get fresh restart.
The corresponding PowerShell command for the admin is as following:
D:\Documents and Settings\Administrator>Remove-ActiveSyncDevice -Identity:test@contoso.com\AirSync-PocketPC-v120Device
Confirm
Are you sure you want to perform this action?
Removing mobile device
"test@contoso.com\AirSync-PocketPC-v120Device". All dataabout the device will be removed. The device must be re-synchronized.
Help
(default is "Y"):y
4) Pin Recovery
This is a nice feature to give the EAS user a chance to unlock the device if he/she forgets the device PIN. Clicking the "Display Recovery Password" will show a pop-up dialog bearing the Recovery Password. Here, I’d like to call out that the recovery password is NEITHER the same as the device PIN and, for example on Windows Mobile (WM) devices, NOR used in the same way. Actually its usage is sort of tricky: Menu, then Reset Password, <type in new password> then <type in Recovery Password>.
There is no related PowerShell command for an Exchange administrator to get this info due to security reasons.
5) Retrieve Log
Starting with Exchange 2007, we provide a light-weight server logging to track details of the last 15 (configurable) requests/responses and possible errors for problem diagnosis. By default, the logging is off. It can be turned on and tweaked easily from web.config:
<add key="MailboxLoggingEnabled" value="true"></add>
<add key="NumOfQueuedMailboxLogEntries" value="15"></add>
<add key="MaxSizeOfMailboxLog" value="8000"></add>
After the Exchange administrator turns on the logging and device starts syncing, a "Retrieve Log…" link will show on the OWA device page to let the device owner grab the log, which will be dropped into the Inbox as an attachment of an Action email, titled as "Log retrieved for device: XXXXXX". The log can be very useful to Microsoft support personnel in diagnosing EAS issues.
Re-installing the Cluster nodes in an Exchange 2007 CCR-based Mailbox Server Setup
Re-Installing the first CCR Node
The very first thing you’ll want to do is to logon to one of the CCR nodes. Then ensure the Windows cluster resources and the clustered mailbox server is owned by the opposite node than the one you’re going to reinstall first. To see which node owns the Windows Cluster resources, open the Windows Cluster Administrator console, then select the Groups node as shown in Figure 1 below. As you can see in the right pane the owner for both the Windows Cluster Group and the CMS is revealed.
Figure 1: Cluster Administrator Console
Note:
You can also see which node owns the CMS by typing Get-ClusteredMailboxServer | FL in the Exchange Management Shell (EMS). If you’re running Exchange 2007 SP1, you can even use the Exchange Management Console (EMC) to check this. This is done under the Server Configuration work center, where you open the Property page for the CMS and then click the Clustered Mailbox Server tab).
If the resources are owned by the node you planned on reinstalling first, you must move them to the other node. As you probably had the CMS running in production for quite some time, I shouldn’t need to tell you this but remember that it’s only supported to move the Windows Cluster Group using the Windows Cluster Administrator. The CMS must be moved using either the Move-ClusteredMailboxServer cmdlet (Figure 2) or if you’re using Exchange Server 2007 SP1 by using the Manage Clustered Mailbox Server wizard in the EMC (Figure 3).
Figure 2: Moving the clustered mailbox server using the Exchange Management Shell
Figure 3: Moving the clustered mailbox server using the Exchange 2007 SP1 Management Console
When the Windows Cluster Group and CMS have been moved to the other node, we can begin uninstalling the Mailbox server role. To do so, open the Control Panel and then Add/Remove Programs. Select Microsoft Exchange and click Remove (Figure 4). This will launch the Exchange 2007 Setup wizard.
Figure 4: Clicking Remove in Add or Remove Programs
On the Exchange 2007 Setup wizard maintenance mode page, click Next then untick Passive Clustered Mailbox Role and Management Tools. Click Next again.
Figure 5: Removing the Passive Clustered Mailbox Role
Let the readiness checks complete then click Uninstall (Figure 6).
Figure 6: Readiness Checks completed successfully
When the passive clustered mailbox role have been uninstalled, click Finish (Figure 7).
Figure 7: Exchange 2007 Passive Mailbox role and Management Tools removed successfully
With the passive clustered mailbox server role uninstalled, we can evict the node from the Windows cluster. To do so, open the Cluster Administrator console, then right-click on the respective node and select Stop Cluster Service in the context menu as shown in Figure 8.
Figure 8: Stopping the cluster service
When the cluster service has been stopped, we are able to evict the node. Do so by right-clicking on the node that’s now offline then select Evict Node (Figure 9).
Figure 9: Evicting the cluster node
We’ll get a warning message like the one shown in Figure 10, click Yes.
Figure 10: Warning message
We have now removed the node from the Windows cluster (Figure 11).
Figure 11: Cluster Administrator with one node
We can begin to re-install the operating system, but before you do so please make sure you have the NetBIOS name, IP addresses, LUNs etc. documented, so you know how to configure these things when Windows Server 2003 has been reinstalled. Before we re-add the node to the Active Directory domain, we must also make sure the computer account is reset. To do so open the Active Directory Users & Computer MMC snap-in, then select the respective computer account object, right-click on it and select Reset Account on the context menu (Figure 12).
Figure 12: Resetting the Active Directory Computer account
When the cluster node has been reinstalled and you have configured the NetBIOS name, IP addresses, and LUNs as well as added the node to the Active Directory domain, the next task is to re-add the node to the Windows Server cluster. To do so, open the Cluster Administrator console and then right-click somewhere in the left pane. In the context menu, select New > Node as shown in Figure 13 below.
Figure 13: Adding a new node to the Windows Server 2003 cluster
On the Add Notes Wizard welcome page, click Next, then enter the NetBIOS name of the node you’re re-adding to the cluster and click Add (Figure 14). Click Next.
Figure 14: Entering the NetBIOS name of the node to be re-added to the cluster
The cluster wizard will now analyze the cluster configuration (Figure 15). When finished click Next.
Figure 15: Cluster configuration wizard analyzes the cluster configuration
We now need to enter the password for the cluster service account (Figure 16). When you have done so, click Next.
Note:
Although I use the Administrator account as the cluster service account in my lab, you should always create a dedicated cluster service account for the cluster when dealing with production environments.
Figure 16: Specifying the password for the Cluster Service Account
Now verify you want to add the node to the proposed cluster configuration and click Next (Figure 17).
Figure 17: Proposed Cluster Configuration
Wait for the cluster to be configured and when possible click Next and finally Finish to exit the Cluster setup wizard (Figure 18).
Figure 18: Cluster is configured
The clustered mailbox server in the lab I’m using for the purpose of this article is running Exchange 2007 SP1, which is why I use the Exchange Server 2007 SP1 binaries to re-install the passive Mailbox role. If you’re CMS haven’t yet been upgraded to Exchange 2007 SP1, it’s important you use the Exchange 2007 RTM binaries to re-install the passive Mailbox role.
Figure 2.1: Exchange Server 2007 SP1 splash screen
On Introduction page, click Next > accept the License Agreement and click Next. Decide whether or not you want to enable error reporting, and then click Next once again.
On the Exchange 2007 Setup Installation Type page, select Custom Exchange Server Installation and click Next (Figure 2.2).
Figure 2.2: Selecting a Custom Exchange Server Installation
Now tick Passive Clustered Mailbox Role. If you installed the Exchange 2007 binaries at another location than the default, this is also the page on which you change the installation path (Figure 2.3). Click Next.
Figure 2.3: Selecting Passive Clustered Mailbox Role and specifying the Installation path
The readiness checks will now be performed. This will normally complete without any issues or errors, but if you like me forgot to remove the database and log files from the Database or Log file LUNs, you’ll receive an error similar to the one shown in Figure 2.4.
Figure 2.4: Readiness Check error as databases are present on the database LUN
When removed, you should see a Readiness Checks page like the one in Figure x (of course without the 32-bit version warning). Click Install.
Figure 2.5: Readiness Checks Completed Successfully
The installation process will now begin and after a few minutes you should get a completion page as shown below (Figure 2.6).
Figure 2.6: Installation of Passive Clustered Mailbox Role installed successfully
Now that the Exchange 2007 SP1 binaries have been installed, we must reboot the node before continuing with the next steps.
Next step is to reseed the storage group copies, so that the CCR node gets up to date replicas of each the active databases. This can be done using the Exchange Management Shell and when speaking Exchange 2007 SP1 the Exchange Management Console (EMC) UI. In this article, we’ll use the EMC UI, so launch the EMC. In the EMC, select the clustered mailbox server under the Server Configuration work center. As we can see in Figure 2.7 below, the copy status is currently in a failed mode, which is expected.
Figure 2.7: Copy status is currently in a Failed state
If we open the Property page for one of the storage groups and click on the Cluster Continuous Replication tab, we can also see that no logs have been copied to the newly installed CCR node.
Start the replication
You will need to run following power shell commands to start the replication. You will be running this exchange shell commands on the node you have reinstalled. Locate Exchange Management Shell and fire it up.
Suspend-StorageGroupCopy -Identity “exmbx01\first storage group”
Now on the node you have reinstalled go to the directory that contains log files for the storage group, in my example it is located on
C:\MountPoints\Clusterdisk1\FirstStorageGroup\Logs\
Remove any files located in this directory.
Now we need to reseed storage group to new node. Open up Exchange Management Shell and run the following command.
Update-StorageGroupcopy –Identity “exmbx01\first storage group”
Depending on the database size, it can take a bit of time.
After you should see that the status is healthy
System Center Data Protection Manager 2007
In this post, I explain how you can use System Center Data Protection Manager 2007 (hereafter DPM) to recover a single Exchange Server 2007 mailbox to a Recovery Storage Group (hereafter RSG) and ‘merge’ the restore with the actual mailbox.
On our production environment, we have Exchange Server 2007 SP1 SCC running on a Windows Server 2008 failover cluster.
Before continuing, make sure you have created a Recovery Storage Group on your Exchange 2007 mailbox server for the mailbox database that you want to restore to. This can be done via GUI (Toolbox > Database Recovery Management) or via Powershell.
new-storagegroup -Server <Server_Name> -LogFolderPath path_to_Logfiles> -Name <RSG_Name> -SystemFolderPath <Database_Path> -Recovery
On the DPM server, click on the Recovery tab, and navigate through the hierarchy and locate the storage group that contains the mailbox that you want to recover. Double clicking on the mailbox database, shows a list of mailboxes. Right click on the mailbox you want to restore and click Recover. You can also select a date and time of the recovery point from which you would like to restore.
In the Recovery Wizard, review the recovery information click Next and select the recovery type. Click browse to select your mailbox server. You will have to manually type the Storage Group Name (specify your Recovery Storage Group name here) and your Database Name (the mailbox database name inside your RSG).
Click Next, review the options and begin the restoration process.
Once the recovery process is complete, go back to the Exchange 2007 mailbox server. Open Exchange Management Console –> Toolbox –> Database Recovery Management.
Mount the Mailbox database that you just restored in the Recovery Storage Group. This shouldn’t require more explanation.
After mounting the database, come back to the above menu and select Merge or copy mailbox contents.
Select the mailbox database that contains the mailbox you want to recover and click Gather Merge information. On the next screen, review the merge options and click Perform pre-merge tasks.
Select your mailbox and click Perform Merge actions. Once the process completes, review the result.
The restored mailbox on the RSG database is now merged with the production database.
Continue Reading »
Exchange 2007 Recovery Storage Group With NTBACKUP
Exchange 2007 Recovery Storage Group : utilizing power shell
Microsoft introduced the Recovery Storage Group with Exchange 2003 which added some nice recovery functionality; we no longer needed a recovery AD forest to restore items to mailboxes or a single mailbox. Exchange 2007 has kept this feature however has drastically changed the interface and added the ability to use power shell for recovery.
For this article I am going to focus on using power shell only to recover mailboxes and messages to a mailbox. One big change is that even when a RSG is created you will not see it with the gui (EMC) and it can only been see via power shell.
First let’s start by logging onto a mailbox and seeing the content
As you can see we have 3 new messages in Jodie’s mailbox
Now we can use NTBackup to backup our Exchange servers database
1. Launch NTBackup from the system tools
2. Select next on the backup/restore wizard
3. Choose the radius button to backup files and settings
4. Select the radius button “Let me choose what to backup”
5. I am only going to backup the first storage group since that is the location of mymailboxes
6. Specify the location of the backup (D:\backup)
7. Click finish to start the backup
Here we can see our backup file has been created.
Now that we have a current backup I am going to delete the messages from Jodie’s mailbox so that we can then use a recovery storage group to recover the data .
Lets create a new RSG and take a look in the gui and then the command line.
To create an RSG we use the new-storagegroup commad but add the -Recover switch
new-storagegroup -Server vmmbx1 -LogFolderPath d:\rsg\logs -Name ExchangeGenie
-SystemFolderPath d:\rsg\data -Recovery
now that we have created our RSG let see if we get any info from EMC
As you can see the RSG does not show up
but if we do a get-storgegroup fl our new RSG will be shown
notice the recovery option is set to true
Now that we have created an RSG we need to add the database we want to recover
new-mailboxdatabase -mailboxdatabasetorecover “Mailbox Database” -storagegroup Vmmbx1\ExchangeGenie -edbfilepath “D:\RSG\Data\mailbox database.edb”
We do not need to set this database can be overwritten since that is enabled by default.
Now that we have created our RSG and added the appropriate database to the RSG we now have to restore the data from backup.
1. Launch NTBackup
2. Click Next
3. Select the backup we want to restore
4. input a temp location for the patch file and Check “Last Restore”
**since this is a full backup and no other logs are to be restored the last restore check box is marked”***
5. Click Next to start the restore
6. Click close after the restore completes
You can see we now have data restored to our recovery database location.
Now that the data has been restored from our backup we need to mount the recovery database
mount-database -identity ‘vmmbx1\exchangegenie\mailbox database’
Now that we have created our RSG, added a recovery database, and restored our data from backup we can now recover data to our users mailbox.
I will perform 3 different recoveries
1. Merge data back into a users mailbox
2. Merge data back into a sub folder in the users mailbox
3. Merge data to another users mailbox into a subfolder
Merge Data back to the original location
The following command will merge the data from our recovery database back to the original live mailbox.
Restore-Mailbox -id ‘Jodie Bartos’ -RSGDatabase ‘ExchangeGenie\Mailbox Database’
You can see that all our messages have been brought back to the original location
Merge data into a sub folder in a users mailbox
Restore-Mailbox -RSGMailbox ‘Jodie Bartos’ -RSGDatabase ‘ExchangeGenie\Mailbox Database’ -id ‘Jodie.Bartos’ -targetfolder ‘RestoredMail’
You can see we have a new folder called RestoredMail which has a copy of the user inbox
Merge data to another users mailbox into a subfolder
Restore-Mailbox -RSGMailbo ‘Jodie Bartos’ -RSGDatabase ‘ExchangeGenie\Mailbox Database’ -id ‘Brian.Tirch’-targetfolder ‘JodiesMbx’
You can see my mailbox now has a subfolder called JodiesMbx with a copy of all her data
There are a number of recovery options that I did not mention in this blog i.e datarate,keywords, etc… that allow a more flexable recovery
After we completed our recover we need to remove the RSG, this is an item that you should not keep unless you are utilizing it.
First we need to dismount the database
Dismount-database -identity ‘vmmbx1\exchangegenie\mailbox database’
Now that we have dismounted the database we need to remove it
Remove-MailboxDatabase -identity ‘vmmbx1\ExchangeGenie\Mailbox Database’
**Note this will not delete the files from the drive, you must manually delete the restored database ***
The last step we need to remove the Recovery Storage Group
Remove-StorageGroup -identity ‘Vmmbx1\ExchangeGenie’
To validate our RSG is gone we need to use the Get-StorageGroup command
Continue Reading »
Downloading Exmerge
Visit URL http://microsoft.com and search for exmerge
After download is complete, extract emerge files to C:\Program Files\Exchsrvr\bin ( This would be the directory where your exchange installation files are located)
Running Exmerge
Open Command Prompt
Change directorys to C:\Program Files\Exchsrvr\bin
cd C:\Program Files\Exchsrvr\bin
Now type in exmerge
Now Exmerge welcome wizard comes up click on Next button to continue
Leave default Rxtract or Import (Two Step Procedure) select and click on Next
Leave default Step 1: Extract data from an Exchange Server Mailbox
Fill in Microsoft Exchange Server Name and Domain Controller (DC) Name: and click on Next
Select Mailbox Database you would like to extract mail from and click on Next
Now Select users you would like to extract mail from and click on Next
Leave Default locale to English (US) and click on Next
Create a directory for PST files to be extract to and click on Change Folder button and select folder, once done click on Next
Save Settings page click on Next to continue
Once extracting is complete click on Finish wizard
Continue Reading »Creating an ext3 File System
If you are adding a new disk drive to a Linux system and want to utilize the
ext3 file system, you must first partition the hard disk with a program such
as fdisk and then format the file system.
Partitioning with fdisk
To use fdisk, open a shell prompt and log in as the root user. The fdisk command
requires you to specify the device you are partitioning as an argument to the
command. In the following examples, the device will be /dev/hdb, which corresponds
to the second device on the primary IDE channel. To begin, type:
/sbin/fdisk /dev/hdb
The following table provides the most common fdisk commands.
Table 5-1. fdisk commands
Command What it Does
m
displays help
p
displays the current partition table
d
deletes a partition
n
creates a new partition
w
writes the partition table to disk
t
sets the anticipated file system type for the partition
l
displays the list of file system types for partitions
q
quits fdisk without altering the disk
Tip: If you need to exit the program at any time without altering your disk,
type q.
Now that you are in the fdisk program, type n to create a new partition. The
program will ask you to choose a partition type, choose e for an extended and
p for a primary partition.
Before choosing the partition type, be aware Linux only allows up to four primary
partitions per disk. If you wish to create more than that, one (and only one)
of the four primary poartitions may be an extended partition, which acts as
a container for one or more logical partitions. Since it acts as a container,
the extended partition must be at least as large as the total size of all the
logical partitions it is to contain. For more information on disk partitions,
see the Appendix called An Introduction to Disk Partitions in the Official Linux
Installation Guide.
After choosing the partition type and the number for that partition, choose
which cylinder head you would like the partition to start on. You can type
to except the default value.
Next, specify the size. The easiest way to do this is to type +sizeM, where
size is the size of the partition in megabytes. If you press without
entering a value, fdisk will use the remainder of the disk.
Repeat this process until you have created your desired partitioning scheme.
Tip: It is a good idea to write down which partitions (for
example, /dev/hdb2) are meant for which file systems (for example, /home/username)
as you create each partition.
Next, you will need to specify what type of file system you intend to put on
the disk because fdisk creates partitions of type unknown by default.
To do this, type t followed by a partition number. Next enter the hex value
for the file system type you intend to install on the partition. For Linux swap
partitions. the hex value is 82. For Linux ext2 or ext3 partitions, the hex
value is 83. For other partition types, use the l command to see a list of file
system types and their hex values. Repeat this for each partition you created.
When you are finished making partitions, type w to save your changes and quit.
Warning: By typing w, you are permanently destroying any data that currently
exists on the device. If you need wish to preserve any data, type q to exit
the program without altering the disk and back up your data.
Formating ext3 File Systems with mkfs
Once you have created partitions on the disk drive using a partitioning program
such as fdisk, you should use mkfs to create an ext3 file system on each partition.
To do this, log in as root and type:
/sbin/mkfs -t ext3 /dev/hdbX
In the above command, replace hdb with the drive letter and X with the partition
number.
Warning
Using mkfs to format a disk partition will permanently destroy any data that
currently exists on the partition.
Assigning a Label with e2label
Once you have created and formated a partition, you should assign it a label
using the e2label command. This allows you to add the partition to /etc/fstab
using a label instead of using a device path, thereby making the system more
robust. To add a label to a partition, type the following command as root:
/sbin/e2label /dev/hdbX /mount/point
Where hdb is the drive letter, X is the partition number, and /mount/point
is the mount point you intend to use for the partition.
Once you have assigned each partition a label, add the partitions to /etc/fstab.
To do this, log in as root and type:
pico -w /etc/fstab
Then add a line to /etc/fstab for each labeled partition similar to this:
LABEL=/mount/point /mount/point ext3 defaults 1 2
In the above entry in /etc/fstab, replace each occurrence of /mount/point with
the mount point you intend to use for the partition.
If you need more information on the various options available to you in /etc/fstab,
type man fstab.
If there are partitions whose label you are unsure of, type the following command:
/sbin/tune2fs -l /dev/hdbX |grep volume
In the above command, replace hdb with the drive letter and X with the partition
number.
This will return something similar to the output below:
Filesystem volume name: /mount/point
In this output, /mount/point is the volume label.
After completing the above steps, you will have successfully added a new ext3
disk to the system. The next section demonstrates how to convert an ext2 disk
partition to an ext3 partition.
Reverse Proxy Server
Written by: Frank Mancuso
Website: http://frankmancuso
In this document, I will show you how to use Apache 2 to server as a front end to different internal web server. You will be able to serve over one internet IP address a bunch of back bone web servers.
Compiling Apache2
http://httpd.apache.org/ ( download the latest version of Apache 2 )
In this document, I will use version 2.0.59.
mkdir /usr/local/www
mkdir /usr/local/www/src
cd /usr/local/www/src
wget http://apache.oregonstate.edu/httpd/httpd-2.0.59.tar.gz
tar –xzvf httpd-2.0.59.tar.gz
cd httpd-2.0.59
./configure –prefix=/usr/local/www/proxy \
–with-mpm=worker –enable-suexec –with-suexec-caller=proxy \
–with-suexec-userdir=/usr/local/www/proxy/htdocs \
–enable-rewrite –enable-mime-magic –disable-charset-lite \
–disable-include –disable-status –disable-autoindex \
–disable-cgid –disable-cgi –disable-negotiation –disable-imap \
–disable-userdir –disable-asis –enable-alias –enable-so \
–enable-headers –enable-logio –enable-proxy –enable-proxy-http \
–enable-http
make
make install
groupadd proxy
useradd -g proxy -d /dev/null -s /bin/false proxy
Putting it into action
This is a sample of my httpd.conf file.
## Proxy Server Config
ServerRoot “/usr/local/www/proxy”
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
Listen 80
User proxy
Group proxy
ServerAdmin root@localhost
UseCanonicalName Off
DocumentRoot “/usr/local/www/proxy/htdocs”
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory “/usr/local/www/proxy/htdocs”>
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
DirectoryIndex index.html
<FilesMatch “^\.ht”>
Order allow,deny
Deny from all
</FilesMatch>
TypesConfig conf/mime.types
DefaultType text/plain
<IfModule mod_mime_magic.c>
MIMEMagicFile conf/magic
</IfModule>
HostnameLookups Off
ErrorLog logs/error_log
LogLevel warn
LogFormat “%h %l %u %t \”%r\” %>s %b \”%{Referer}i\” \”%{User-Agent}i\”" combined
LogFormat “%h %l %u %t \”%r\” %>s %b” common
LogFormat “%{Referer}i -> %U” referer
LogFormat “%{User-agent}i” agent
CustomLog logs/access_log common
ServerTokens Prod
ServerSignature Off
NameVirtualHost 10.0.0.1 # Note: replace 10.0.0.1 with your external ip address
# This first virtual host, I will forward http requests to a server running on the local class #A ip address.
<VirtualHost 10.0.0.1>
ServerAdmin root@localhost
ServerName example.local
ServerAlias www.example.local
ProxyPass / http://10.0.0.3/example/
ProxyPassReverse / http://10.0.0.3/example/
</VirtualHost>
# This example, I can use a sub directory on a different host Let says I just wanted to host # a directory on my main web site that was written in ASP or JSP, so I would forward it a # internet web server.
<VirtualHost 10.0.0.1>
ServerAdmin root@localhost
ServerName example.local
ServerAlias www.example.local
ProxyPass /pdf http://10.0.0.4/pdf/
ProxyPassReverse /pdf http://10.0.0.4/pdf/
</VirtualHost>
# Now when someone visited http://example.local/pdf/ it would be reversed to #10.0.0.4/pdf/
After playing around in your test lab, you should get an idea how easy Apache 2 can be used as a reverse proxy server.
Continue Reading »