Server Administration & Management

How to configure Postfix MTA for Mail Server

# vim /etc/postfix/main.cf

myhostname = unixserveradmin.com     ## line no 75 – uncomment and enter your host name
mydomain = unixserveradmin.com     ## line no 83 – uncomment and enter your domain name
myorigin = $mydomain     ## line no 99 – uncomment
inet_interfaces = all     ## line no 116 – change to all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain     ## line no 164 – add $domain at the end
mynetworks =,     ## line no 264 – uncomment and add your network range
home_mailbox = Maildir/     ## line no 419 – uncomment

July 31, 2013 Posted by | Mail, Uncategorized | , | Leave a comment

How to configure Dovecot in RHEL/CentOS 6 for Plain Login

1. Install Dovecot Package

# yum install dovecot

2. Open the dovecot config file /etc/dovecot/dovecot.conf and Find and uncomment the line as shown below.

# vim /etc/dovecot/dovecot.conf

protocols = imap pop3 lmtp

3. Open the file /etc/dovecot/conf.d/10-mail.conf and uncomment the line as shown below.

# vim /etc/dovecot/conf.d/10-mail.conf

mail_location = maildir:~/Maildir  ##line no 24 – uncomment

4. Open the /etc/dovecot/conf.d/10-auth.conf and edit as shown below.

# vim /etc/dovecot/conf.d/10-auth.conf

disable_plaintext_auth = no  ##line no 9 – uncomment and change from yes to no.
auth_mechanisms = plain login  ##line no 97 – add the text “login”

5. Open the /etc/dovecot/conf.d/10-master.conf and edit as shown below.

# vim /etc/dovecot/conf.d/10-master.conf

unix_listener auth-userdb {
    #mode = 0600
    user = postfix  ##line no 83 – uncomment and enter postfix
    group = postfix  ##line no 84 – uncomment and enter postfix

6. Start the dovecot service

# /etc/init.d/dovecot restart

July 26, 2013 Posted by | Mail | , | Leave a comment


# Stop unwanted services ################
# service_server.sh ####################
echo “Task Start Now !!!”
chkconfig cups off –level 24
chkconfig rhnsd off –level 24
chkconfig gssd off –level 24
chkconfig rpcgssd off –level 24
chkconfig rpcidmapd off –level 24
chkconfig idmapd off –level 24
chkconfig acpid off –level 24
chkconfig iscsi off –level 24
chkconfig iscsid off –level 24
chkconfig kdump off –level 24
chkconfig cpuspeed off –level 24
chkconfig mcstrans off –level 24
chkconfig mdmonitor off –level 24
chkconfig microcode_ctl off –level 24
chkconfig multipathd off –level 24
chkconfig ntpd off –level 24
chkconfig avahi-daemon off –level 24
chkconfig httpd off –level 24
chkconfig mysqld off –level 24
chkconfig sshd off –level 24
chkconfig ipsec off –level 24
chkconfig lm_sensors off –level 24
chkconfig irqbalance off –level 24
chkconfig restorecond off –level 24
chkconfig yum-updatesd off –level 24
chkconfig xinetd off –level 24
chkconfig isdn off
chkconfig anacron off
chkconfig sendmail off
chkconfig autofs off
chkconfig portmap off
chkconfig readahead_early off
chkconfig readahead_later off
chkconfig nfs off
chkconfig ip6tables off
chkconfig smartd off
chkconfig kudzu off
chkconfig netfs off
chkconfig nfslock off
chkconfig xfs off
chkconfig apmd off
chkconfig bluetooth off
chkconfig gpm off
chkconfig hidd off
chkconfig pcscd off
chkconfig setroubleshoot off
chkconfig dovecot off
chkconfig haldaemon off
chkconfig chargen off
chkconfig ypbind off
chkconfig atd off
chkconfig canna off
chkconfig FreeWnn off
chkconfig iiim off
chkconfig mDNSResponder off
chkconfig rpcimpad off
chkconfig acpi off
echo “Task Successful Done !!!”

July 21, 2013 Posted by | Security, Shell Script | , | Leave a comment

How to fix “Fatal Error C0000034…” Error during installation of Windows Se7en SP1

When applying SP1 for windows se7en there is a specific error that can happen during reboot. If you get this error “Fatal Error C0000034 Applying Update Operation 282 of…”, follow the steps below to fix the SP1 installation :-

1. Reboot your computer while it’s starting up.

2. When your computer starts up again, choose the option “Launch Startup Repair

If you do not have this module installed in the OS, you’ll need a Win7 install disc that is the same architecture (i.e. 32 or 64-bit) as the OS installed. Just boot to the CD and go from there.

3. When the Startup repair starts, click cancel.

4. After you click cancel it will show a box. Click “Don’t Send”, then click the link “View advanced options for recovery and support

5. In the new window click Command Prompt at the bottom.

6. In Command Prompt type this and press enter: %windir%\system32\notepad.exe

7. Notepad will open. In notepad go to File–>Open.

8. Change the type of files notepad views from .txt to All Files

9. Now in Notepad, go to C:\Windows\winsxs\ (or whichever drive Windows is installed on)

10. In that folder, find pending.xml and make a copy of it as pending_bak.xml

Just copy and paste it in the same folder, this is just in case something happens to the original so you don’t lose it.

11. Now open the original pending.xml

It will usually take a while to load because it’s a huge file.

12. Press CTRL+F and search for the following exactly: 0000000000000000.cdf-ms

That’s sixteen (16) zeroes ;)

13. Delete the following text (yours may be a little different):

<DeleteFile path=”\SystemRoot\WinSxS\FileMaps\_0000000000000000.cdf-ms”/>
<MoveFile source=”\SystemRoot\WinSxS\Temp\PendingRenames\

NOTE :- Your PC might not have all 3 sections of code (<Checkpoint>, <DeleteFile>, <MoveFile>). Just make sure you delete section “Checkpoint” and whatever other sections have “000000000000000.cdf-ms”. They will be right next to each other.

14. Save the file, close notepad, close command prompt, restart your computer.

Conclusion :- Once your computer starts up, do a normal startup (it may stall for 5-10 minutes at the “starting windows” screen, but leave it going) and the Service Pack will install some more stuff and restart a few times and then everything should be working! For some people, it reverts everything and cancels the service pack installation. For other people, the service pack installation completes. Either result is fine, the computer should be functioning normally now without any data loss.

July 16, 2013 Posted by | Windows | , | Leave a comment

How to remove a Partition Size Larger Than 2TB

Before removing a partition, unmount any partitions on the device and turn off any swap space on the device.

1. Start parted, where /dev/mapper/mpathbp is the device on which to remove the partition :-

# parted /dev/mapper/mpathbp

2. View the current partition table to determine the minor number of the partition to remove :-

(parted) print

3. Remove the partition with the command rm. For example, to remove the partition with minor number 3 :-

(parted) rm 3

4. The changes start taking place as soon as you press Enter, so review the command before committing to it. After removing the partition, use the print command to confirm that it is removed from the partition table. You should also view the output of

# cat /proc/partitions

to make sure the kernel knows the partition is removed. The last step is to remove it from the /etc/fstab file. Find the line that declares the removed partition, and remove it from the file.

July 11, 2013 Posted by | SAN, Tips & Tricks, Unix/Linux | , , , | Leave a comment

How to create a Partition Size Larger Than 2TB

We can’t create a Linux partition larger than 2 TB using the fdisk command. The fdisk won’t create partitions larger than 2 TB. This is fine for desktop and laptop users, but on server you need a large partition. For example, you can’t create 3TB or 4TB partition size (RAID based) using the fdisk command. It will not allow you to create a partition that is greater than 2TB.

To solve this problem use GNU parted command with GPT. It supports Intel EFI/GPT partition tables. Partition Table (GPT) is a standard for the layout of the partition table on a physical hard disk. It is a part of the Extensible Firmware Interface (EFI) standard proposed by Intel as a replacement for the outdated PC BIOS, one of the few remaining relics of the original IBM PC. EFI uses GPT where BIOS uses a Master Boot Record (MBR).

Linux GPT Kernel Support :- EFI GUID Partition support works on both 32bit and 64bit platforms. You must include GPT support in kernel in order to use GPT. If you don’t include GPT support in Linux kernel, after rebooting the server, the file system will no longer be mountable or the GPT table will get corrupted. By default RHEL/ CentOS comes with GPT kernel support. However, if you are using Debian or Ubuntu Linux, you need to recompile the kernel. Set CONFIG_EFI_PARTITION to y to compile this feature.

1. Find Out Current Disk Size, using the following command :-

# fdisk -l /dev/mapper/mpathbp

Sample outputs:
Disk /dev/mapper/mpathp: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

2. Linux Create 3TB partition size, To create a partition start GNU parted as follows :-

# parted /dev/mapper/mpathbp

GNU Parted 2.3
Using /dev/mapper/mpathbp
Welcome to GNU Parted! Type ‘help’ to view a list of commands.

3. Creates a new GPT disklabel i.e. partition table :-

(parted) mklabel gpt

Sample outputs:
Warning: The existing disk label on /dev/mapper/mpathbp will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes

4. Next, set the default unit to TB, enter:

(parted) unit TB

5. To create a 3TB partition size, enter:

(parted) mkpart primary 0 0


(parted) mkpart primary 0.00TB 3.00TB

6. To print the current partitions, enter:

(parted) print

Sample outputs:
Model: ATA ST33000651AS (scsi)
Disk /dev/mapper/mpathbp: 3.00TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number  Start   End     Size    File system  Name     Flags
 1      0.00TB  3.00TB  3.00TB  ext4         primary

Quit and save the changes, enter:

(parted) quit

Sample outputs:
Information: You may need to update /etc/fstab.

7. Use the mkfs.ext3 or mkfs.ext4 command to format the file system, enter :-

# mkfs.ext4 /dev/mapper/mpathbp1

8. Type the following commands to mount /dev/mapper/mpathbp1, enter :-

# mkdir /datasrv
# mount   /dev/mpathbp1   /datasrv
# df -hT

9. Edit in /etc/fstab file during Booting Process for Mounting.

# vim /etc/fstab

/dev/mapper/mpathbp1    /backup        ext4    defaults    1    0

Note :- Make sure you replace /dev/mapper/mpathbp1 with actual RAID or Disk name or Block Ethernet device such as /dev/etherd/e0.0. Do not forget to update /etc/fstab, if necessary. Also note that booting from a GPT volume requires support in your BIOS / firmware. This is not supported on non-EFI platforms. We suggest you, boot server from another disk such as IDE / SATA / SSD disk and store data on /datasrv.

July 6, 2013 Posted by | SAN, Tips & Tricks, Unix/Linux | , , , | 1 Comment

How to mount SAN Partition to HP DL580 G7 Server In Linux

Before setting up DM-Multipath on your system, ensure that your system has been updated & includes the device-mapper-multipath package.
You set up multipath with the mpathconf utility, which creates the multipath configuration file /etc/multipath.conf.

# mpathconf

a) If the /etc/multipath.conf file already exists, the mpathconf utility will edit it.
b) If the /etc/multipath.conf file does not exist, the mpathconf utility will use the /usr/share/doc/device-mapper-multipath-0.4.9/multipath.       conf file as the starting file.
c) If the /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf file does not exist the mpathconf utility will create the /etc/multipath.      conf file from scratch.

If you do not need to edit the /etc/multipath.conf file, you can set up DM-Multipath for a basic failover configuration by running the following command. This command enables the multipath configuration file and starts the multipathd daemon. If you need to edit the /etc/multipath. conf file before starting the multipathd daemon. use the following procedure to set up DM-Multipath for a basic failover configuration.

1. Run the mpathconf command with the –enable option specified:

# mpathconf –enable
# mpathconf –enable –with_multipathd y
# mpathconf –enable –find_multipaths y
# mpathconf –enable –user_friendly_names y
# /etc/init.d/multipathd reload
# service multipathd restart
#chkconfig multipathd on

Since the value of user_friendly_name is set to yes in the configuration file, the multipath devices will be created as /dev/mapper/mpathn.

If you do not set the find_multipaths configuration parameter to yes, can use the following procedure to modify the multipath configuration file to ignore the local disks when configuring multipath.

2. Determine which disks are the internal disks and mark them as the ones to blacklist. In this example, /dev/sda is the internal disk. Note that as originally configured in the default multipath configuration file, executing the multipath -v2 shows the local disk, /dev/sda, in the
multipath map.

3. Now Search the partition and format it.

# fdisk -l
# fdisk /dev/mapper/mpathbp1
# mkfs.ext4 /dev/mapper/mpathbp1
# mount /dev/mapper/mpathbp1 /backup

4. Edit in /etc/fstab file during Booting Process for Mounting.

# vim /etc/fstab

/dev/mapper/mpathbp1    /backup   ext4   defaults   1   0

5. Edit in /etc/rc.local file after Booting Process for Mounting.

# vim /etc/rc.local

mount /dev/mapper/mpathbp1 /backup

Note: If SAN Raw Partition not show properly, then add following for HP 3PAR SAN storage in /etc/multipath.conf file.

# vim /etc/multipath.conf

defaults {
    polling_interval 10
    max_fds 8192

devices {
    device {
        vendor “3PARdata”
        product “VV”
        no_path_retry 18
        features “0”
        hardware_handler “0”
        path_grouping_policy multibus
        getuid_callout “/lib/udev/scsi_id –whitelisted –device=/dev/%n”
        path_selector “round-robin 0”
        rr_weight uniform
        rr_min_io_rq 1
        path_checker tur
        failback immediate

July 1, 2013 Posted by | SAN, Tips & Tricks, Unix/Linux | , , , | Leave a comment