LVM [Logical Volume Manager]

Description:


LVM is a tool for logical volume management, which includes allocating disks, striping, mirroring and resizing logical volumes. LVM allow you to manage disk space more effectively. With LVM, we can create logical partitions that can span across one or more physical hard drives. First, the hard drives are divided into physical volumes, then those physical volumes are combined together to create the volume group and finally the logical volumes are created from volume group.

Configure Logical Volume:


First create three partitions using fdisk or gdisk. In this example I have create 3 partition /dev/sda5, /dev/sdb1 and /dev/sdc1
After create partition need to convert to physical volume using below command:
        # pvcreate /dev/sda5 /dev/sdb1 /dev/sdc1
            Physical volume “/dev/sda5” successfully created
            Physical volume “/dev/sdb1” successfully created
            Physical volume “/dev/sdc1” successfully created
Once physical volume created you need to create volume group of all three partition using below command:
       # vgcreate vg0 /dev/sda5 /dev/sdb1 /dev/sdc1
           Volume group “vg0” successfully created
           You can use the vgs command to display the attributes of the new volume group
Now you can create logical volume  from volume group using below command:
      # lvcreate –L  100 G –n lv0 vg0
          Logical volume “lv0” created
          Note :  lv0 is logical volume name
Create a file system on the logical volume using below command
      # mkfs –t ext4 /dev/vg0/lv0
Mount logical volume to directory
      # mount /dev/vg0/lv0 /storage

Extending a logical volume:

Extend logical volume using below command.
     # lvextend -L12G /dev/vg0/lv0
        lvextend — extending logical volume “/dev/vg0/lv0” to 12 GB
        lvextend — doing automatic backup of volume group “vg0”
        lvextend — logical volume “/dev/vg0/lv0” successfully extended
    # lvextend -L+1G /dev/vg0/lv0
       lvextend — extending logical volume “/dev/vg0/lv0” to 13 GB
       lvextend — doing automatic backup of volume group “vg0”
       lvextend — logical volume “/dev/vg0/lv0” successfully extended
After you have extended the logical volume, it is necessary to increase the file system size to match.
     # umount /dev/vg0/lv0
     # resize2fs /dev/vg0/lv0
     # mount /dev/vg0/lv0 /storage

Reducing a Logical Volume:

First, unmount partition using below command
# umount /storage
Check file system for error using e2fsck command
# e2fsck –f /dev/vg0/lv0
Note: In the above command e2fsck, we use the option ‘-f’ to forcefully check the file system, even if the file system is clean.
Reduce or Shrink the size of /storage to desire size
# resize2fs /dev/vg0/lv0 10G
Now reduce the size using lvreduce command.
# lvreduce -L 10G /dev/vg0/lv0
For the safer side, now check the reduced file system for errors
# e2fsck -f /dev/vg0/lv0
Mount the file system and verify its size.
# mount /dev/vg0/lv0 /storage

LVM [Logical Volume Manager]

Description:


LVM is a tool for logical volume management, which includes allocating disks, striping, mirroring and resizing logical volumes. LVM allow you to manage disk space more effectively. With LVM, we can create logical partitions that can span across one or more physical hard drives. First, the hard drives are divided into physical volumes, then those physical volumes are combined together to create the volume group and finally the logical volumes are created from volume group.

Configure Logical Volume:


First create three partitions using fdisk or gdisk. In this example I have create 3 partition /dev/sda5, /dev/sdb1 and /dev/sdc1
After create partition need to convert to physical volume using below command:
        # pvcreate /dev/sda5 /dev/sdb1 /dev/sdc1
            Physical volume “/dev/sda5” successfully created
            Physical volume “/dev/sdb1” successfully created
            Physical volume “/dev/sdc1” successfully created
Once physical volume created you need to create volume group of all three partition using below command:
       # vgcreate vg0 /dev/sda5 /dev/sdb1 /dev/sdc1
           Volume group “vg0” successfully created
           You can use the vgs command to display the attributes of the new volume group
Now you can create logical volume  from volume group using below command:
      # lvcreate –L  100 G –n lv0 vg0
          Logical volume “lv0” created
          Note :  lv0 is logical volume name
Create a file system on the logical volume using below command
      # mkfs –t ext4 /dev/vg0/lv0
Mount logical volume to directory
      # mount /dev/vg0/lv0 /storage

Extending a logical volume:

Extend logical volume using below command.
     # lvextend -L12G /dev/vg0/lv0
        lvextend — extending logical volume “/dev/vg0/lv0” to 12 GB
        lvextend — doing automatic backup of volume group “vg0”
        lvextend — logical volume “/dev/vg0/lv0” successfully extended
    # lvextend -L+1G /dev/vg0/lv0
       lvextend — extending logical volume “/dev/vg0/lv0” to 13 GB
       lvextend — doing automatic backup of volume group “vg0”
       lvextend — logical volume “/dev/vg0/lv0” successfully extended
After you have extended the logical volume, it is necessary to increase the file system size to match.
     # umount /dev/vg0/lv0
     # resize2fs /dev/vg0/lv0
     # mount /dev/vg0/lv0 /storage

Reducing a Logical Volume:

First, unmount partition using below command
# umount /storage
Check file system for error using e2fsck command
# e2fsck –f /dev/vg0/lv0
Note: In the above command e2fsck, we use the option ‘-f’ to forcefully check the file system, even if the file system is clean.
Reduce or Shrink the size of /storage to desire size
# resize2fs /dev/vg0/lv0 10G
Now reduce the size using lvreduce command.
# lvreduce -L 10G /dev/vg0/lv0
For the safer side, now check the reduced file system for errors
# e2fsck -f /dev/vg0/lv0
Mount the file system and verify its size.
# mount /dev/vg0/lv0 /storage

IP Rotation for EXIM in WHM/CPanel

Description: There are no native features that would allow you to rotate the IP addresses used for sending out email. The option included with CPanel/WHM only allow for the permanent change of the IP addresses used for sending. Below code is use to configure IP rotation.

#!/bin/bash

# Exim Outgoing IP address rotator
# The cPanel Admin 24/10/2017
# Files: /etc/mailipaddrpool: list of IP addresses to use for mail
ipfile=/etc/mailipaddrpool
curip=$(grep "*:" /etc/mailips |awk '{print $2}')
if [[ "$curip" == "" ]] || ! grep $curip $ipfile >/dev/null ; then
curip=$(tail -1 $ipfile)
fi
nextipct=$(cat $ipfile |grep -A 1 $curip |wc -l)
if [ "$nextipct" == "1" ];then
nextip=$(head -1 $ipfile)
else
nextip=$(cat $ipfile |grep -A 1 $curip | tail -1)
fi
sed '/*:/d' -i /etc/mailips
sed '/^$/d' -i /etc/mailips
echo "*: $nextip" >> /etc/mailips


Note: /etc/mailipaddrpool file contains all your IP Addresses as given example:
192.168.0.1
192.168.0.2
192.168.0.3
192.168.0.4
  • Then setup a cron job with the above script to run as your requirement. As it is kind of bash command and mailips file will be written on every cron action, set up the crontab as superuser root by command line with following commands
#crontab -e (this command will open/create crontab file in edit mode to enter add/edit/remove cron task)
/bin/bash /etc/scripts/yourscriptfile
  • Prior to run bash command, change file permission to execution like chmod filename 777

IP Rotation for EXIM in WHM/CPanel

Description: There are no native features that would allow you to rotate the IP addresses used for sending out email. The option included with CPanel/WHM only allow for the permanent change of the IP addresses used for sending. Below code is use to configure IP rotation.

#!/bin/bash

# Exim Outgoing IP address rotator
# The cPanel Admin 24/10/2017
# Files: /etc/mailipaddrpool: list of IP addresses to use for mail
ipfile=/etc/mailipaddrpool
curip=$(grep "*:" /etc/mailips |awk '{print $2}')
if [[ "$curip" == "" ]] || ! grep $curip $ipfile >/dev/null ; then
curip=$(tail -1 $ipfile)
fi
nextipct=$(cat $ipfile |grep -A 1 $curip |wc -l)
if [ "$nextipct" == "1" ];then
nextip=$(head -1 $ipfile)
else
nextip=$(cat $ipfile |grep -A 1 $curip | tail -1)
fi
sed '/*:/d' -i /etc/mailips
sed '/^$/d' -i /etc/mailips
echo "*: $nextip" >> /etc/mailips


Note: /etc/mailipaddrpool file contains all your IP Addresses as given example:
192.168.0.1
192.168.0.2
192.168.0.3
192.168.0.4
  • Then setup a cron job with the above script to run as your requirement. As it is kind of bash command and mailips file will be written on every cron action, set up the crontab as superuser root by command line with following commands
#crontab -e (this command will open/create crontab file in edit mode to enter add/edit/remove cron task)
/bin/bash /etc/scripts/yourscriptfile
  • Prior to run bash command, change file permission to execution like chmod filename 777

Migrate Mailbox from Cpanel to Zimbra

Procedure

  • First step to find list of mail accounts, to find lists you need to install firebug addins in Firefox
  • After install firebug Open Cpanel and select Email Accounts tab in Firefox Browser as showing in screen shot
  • Select Result per page maximum you can select 100 as given in screen shot. If result more than 100 you need to below exercise multiple time.

  • Open Firebug in the website and go into Console>Show command editor, and paste the next code in the right window, and press run.
   var rows = $(“#table_email_accts tr.dt_info_row”),
   returnString = “”;
   rows.each(function(i, item){
   var tdList = [];
   $(item).find(‘td:eq(0)’).each(function(s, subItem){
   tdList.push($(subItem).text());
   });
   returnString += tdList + “\n”;
   });
   console.log(returnString);

  • After paste above code in firebug you need to select result per page to 100 you will get result all mail accounts you need to copy it to notepad. Please keep it for we will use in future reference.

Creating the  XML files

Account migration tool in Zimbra server work on two .xml files for bulk migrate accounts.
  1. The first xml is for the Account provision
  2. The second xml is for the IMAP data import

First xml is for account provision,  Which used to provision multiple email account without importing email

Sample
Sam
Sam Sample
ssample@example.com
test123
TRUE
Zackry
Zak
Zak Zackry
zzackry@example.com
test123
TRUE

Save this xml file as Cpanel-IMAP-User.xml
The second xml is for import emails.
imap.gmail.com
143
cleartext
0
Sample
Sam
Sam Sample
sam@example.comsam@example.comtest123
Zackry
Zak
Zak Zackry
zzackry@example.comsam@example.comtest123

Note: Instead of imap.gmail.com you need to set server address of Domain mail server in above script

After save both xml files open account migration tool from Zimbra admin console from Home>Tools>Migration>Account Migration
  • After completed this it shows like this if any error not occurred

Migrate Mailbox from Cpanel to Zimbra

Procedure

  • First step to find list of mail accounts, to find lists you need to install firebug addins in Firefox
  • After install firebug Open Cpanel and select Email Accounts tab in Firefox Browser as showing in screen shot
  • Select Result per page maximum you can select 100 as given in screen shot. If result more than 100 you need to below exercise multiple time.

  • Open Firebug in the website and go into Console>Show command editor, and paste the next code in the right window, and press run.
   var rows = $(“#table_email_accts tr.dt_info_row”),
   returnString = “”;
   rows.each(function(i, item){
   var tdList = [];
   $(item).find(‘td:eq(0)’).each(function(s, subItem){
   tdList.push($(subItem).text());
   });
   returnString += tdList + “\n”;
   });
   console.log(returnString);

  • After paste above code in firebug you need to select result per page to 100 you will get result all mail accounts you need to copy it to notepad. Please keep it for we will use in future reference.

Creating the  XML files

Account migration tool in Zimbra server work on two .xml files for bulk migrate accounts.
  1. The first xml is for the Account provision
  2. The second xml is for the IMAP data import

First xml is for account provision,  Which used to provision multiple email account without importing email

Sample
Sam
Sam Sample
ssample@example.com
test123
TRUE
Zackry
Zak
Zak Zackry
zzackry@example.com
test123
TRUE

Save this xml file as Cpanel-IMAP-User.xml
The second xml is for import emails.
imap.gmail.com
143
cleartext
0
Sample
Sam
Sam Sample
sam@example.comsam@example.comtest123
Zackry
Zak
Zak Zackry
zzackry@example.comsam@example.comtest123

Note: Instead of imap.gmail.com you need to set server address of Domain mail server in above script

After save both xml files open account migration tool from Zimbra admin console from Home>Tools>Migration>Account Migration
  • After completed this it shows like this if any error not occurred

Microsoft Dynamics AX 2012 Data Import/Export Framework standalone version for AX 2012 R2 without installing full CU7

Before you begin: 

  • Download the CU7 hotfix package [KB2885603] and extract it to a local folder
  • Download the hotfix package for KB 3018235, and extract it to a local folder.

Install the AX 2012 R2 CU7 Data import/export framework for use with SQL Server 2014 Integration Services:

  • Copy MSI files of DIXF_Service_x64 and DIXF_Service_x86 CU7 hotfix extracted folder to Import export hotfix MSI folder.
  • Open PowerShell Run as administrator and Navigate to the Support folder of the hotfix package run following script
Install-DIXFService.ps1.
  • You will be ask to locate the Data Import/Export Framework service MSI from Microsoft Dynamics AX 2012 R2 CU7. This file can found in the MSI\DIXF_Service_x64 or MSI\DIXF_Service_x86 folder. If the script is unable to locate the corresponding MSP, you will be asked to locate it. The MSP can found in the MSI\DIXF_Service_x64 or MSI\DIXF_Service_x86 folder in the hotfix package folder (KB 3018235). You will ask if you want the Data Import/Export Framework Service to install under the Network Service account. If you answer No, you will asked to enter the username (DOMAIN\username format) and password to run the service. Installation should start.
  • Once Service installation done start KB 3018235 to install and apply DIXF update to all Dynamics AX components.
  • After update installation completed. Run Cumulative Update 7 [CU7] setup and update Data import Export AOS and Client Components.
  • After installation add system service account to Microsoft Dynamics AX Data Import Export Framework Service Users group and restart AOS and data import export services.

Microsoft Dynamics AX 2012 Data Import/Export Framework standalone version for AX 2012 R2 without installing full CU7

Before you begin: 

  • Download the CU7 hotfix package [KB2885603] and extract it to a local folder
  • Download the hotfix package for KB 3018235, and extract it to a local folder.

Install the AX 2012 R2 CU7 Data import/export framework for use with SQL Server 2014 Integration Services:

  • Copy MSI files of DIXF_Service_x64 and DIXF_Service_x86 CU7 hotfix extracted folder to Import export hotfix MSI folder.
  • Open PowerShell Run as administrator and Navigate to the Support folder of the hotfix package run following script
Install-DIXFService.ps1.
  • You will be ask to locate the Data Import/Export Framework service MSI from Microsoft Dynamics AX 2012 R2 CU7. This file can found in the MSI\DIXF_Service_x64 or MSI\DIXF_Service_x86 folder. If the script is unable to locate the corresponding MSP, you will be asked to locate it. The MSP can found in the MSI\DIXF_Service_x64 or MSI\DIXF_Service_x86 folder in the hotfix package folder (KB 3018235). You will ask if you want the Data Import/Export Framework Service to install under the Network Service account. If you answer No, you will asked to enter the username (DOMAIN\username format) and password to run the service. Installation should start.
  • Once Service installation done start KB 3018235 to install and apply DIXF update to all Dynamics AX components.
  • After update installation completed. Run Cumulative Update 7 [CU7] setup and update Data import Export AOS and Client Components.
  • After installation add system service account to Microsoft Dynamics AX Data Import Export Framework Service Users group and restart AOS and data import export services.