This Blog is to share our knowledge and expertise on Linux System Administration and VMware Administration

Wednesday, November 4, 2015

Explain about the dmsetup Command in Linux?

Wednesday, November 04, 2015 0
The dmsetup command is a command line wrapper for communication with the Device Mapper. For general system information about LVM devices, you may find the info, ls, status, and deps options of the dmsetup command to be useful, as described in the following subsections.

The dmsetup info Command

The dmsetup info device command provides summary information about Device Mapper devices. If you do not specify a device name, the output is information about all of the currently configured Device Mapper devices.
If you specify a device, then this command yields information for that device only.
The dmsetup info command provides information in the following categories:

Name:
The name of  the device. An LVM device is expressed as the volume group name and the logical volume name separated   by a hyphen. A hyphen in the original name is translated to two hyphens. During standard LVM operations, you should not use the name of an LVM device in this format to specify an LVM device directly, but instead you should  use the vg/lv alternative.

State:
Possible device states are SUSPENDED, ACTIVE, and READ-ONLY. The dmsetup suspend command sets a device state to SUSPENDED.
When a device is suspended, all I/O operations to that device stop. The dmsetup resume command restores a device state to ACTIVE.

Read Ahead:
The number of data blocks that the system reads ahead for any open file on which read operations are ongoing. By default, the kernel chooses a suitable value automatically. You can change this value with the --readahead option of the dmsetup command.

Tables present:
Possible states for this category are LIVE and INACTIVE. An INACTIVE state indicates that a table has been loaded which will be swapped in when a dmsetup resume command restores a device state to ACTIVE, at which point the table's state becomes LIVE. For information, see the dmsetup man page.

Open count:
    The open reference count indicates how many times the device is opened. A mount command opens a device.

Event number:
The current number of events received. Issuing a dmsetup wait n command allows the user to wait for the n'th event, blocking the call until it is received.

Major, minor
    Major and minor device number

Number of targets
    The number of frag ments that make up a device. For example, a linear device spanning 3 disks would have 3 targets. A linear      device composed of the beginning and end of a disk, but not the middle would have 2 targets.      

UUID
    UUID of the device.

The following example shows partial output for the dmsetup info command.

[root@testserver ~]# dmsetup info
Name:                       VolGroup00-LogVol01
State:                         ACTIVE
Read Ahead:             256
Tables present:          LIVE
Open count:              2
Event number:          0
Major, minor:            252, 1
Number of targets:    1
UUID: LVM-ZfQCQ1suTcykV9TwvNACpBXcEMNuWlnELoJOLg5TDC5ityl5a6qLJ5fujuoRRzWb

Name:                     VolGroup00-LogVol00
State:                      ACTIVE
Read Ahead:          256
Tables present:       LIVE
Open count:           1
Event number:       0
Major, minor:          252, 0
Number of targets: 1
UUID: LVM-ZfQCQ1suTcykV9TwvNACpBXcEMNuWlnESWOjo1qFZZCztYCSXbzQdXpwRHjDNI3o

Remediating an ESXi 5.x and 6.0 host with Update Manager fails with the error: There was an error checking file system on altbootbank

Wednesday, November 04, 2015 0
To resolve the issue, repair the altbootbank partition.

To repair the altbootbank partition:

    Run this command to determine the device for /altbootbank:
    vmkfstools -P /altbootbank

    You see output similar to:
    mpx.vmhba32:C0:T0:L0:5

    Run this command to repair the altbootbank filesystem:
    dosfsck -a -w /dev/disks/device_name
For example:
    dosfsck -a -w /dev/disks/mpx.vmhba32:C0:T0:L0:5

    If remediation fails at this stage, reboot the host.

Red Hat Enterprise Virtualization Manager (RHEVM) minimum hardware requirements.

Wednesday, November 04, 2015 0
Red Hat Enterprise Virtualization Manager servers must run Red Hat Enterprise Linux 6. A number  of additional hardware requirements must also be met.

Item                   Limitations
RAM                  A minimum of 3 GB of RAM is required.
PCI Devices      At least one network controller with a minimum bandwidth of 1 Gbps (Rec)

Storage             A minimum of 3 GB of available local disk space is recommended.

Monday, November 2, 2015

How to Manage Software with YUM in Linux Server?

Monday, November 02, 2015 0
Use the yum utility to modify the software on your system in four ways:

    To install new software from package repositories
    To install new software from an individual package file
    To update existing software on your system
    To remove unwanted software from your system

[Important]            Installing Software from a Package File


To use yum, specify a function and one or more packages or package groups. Each section below gives some examples.

For each operation, yum downloads the latest package information from the configured repositories.

The yum utility searches these data files to determine the best set of actions to produce the required result, and displays the transaction for you to approve. The transaction may include the installation, update, or removal of additional packages, in order to resolve software dependencies.

This is an example of the transaction for installing tsclient:
==================================================================
 Package                 Arch       Version          Repository        Size
==================================================================
Installing:
 tsclient                   i386       0.132-4          base              247 k
Installing for dependencies:
 rdesktop                i386       1.3.1-5            base              107 k
Transaction Summary
==================================================================
Install      2 Package(s)
Update       0 Package(s)
Remove       0 Package(s)
Total download size: 355 k

Is this ok [y/N]:
Format of YUM Transaction Reports:
Review the list of changes, and then press y to accept and begin the process. If you press N or Enter, yum does not download or change any packages.

Package Versions
 The yum utility only displays and uses the newest version of each package, unless you specify an older version.
The yum utility also imports the repository public key if it is not already installed on the rpm keying.

This is an example of the public key import:

warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 443E1821
public key not available for tsclient-0.132-4.i386.rpm
Retrieving GPG key from http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-4
Importing GPG key 0x443E1821 "CentOS-4 Key<centos-4key@centos.org>"
Is this ok [y/N]:

Format of yum Public Key Import

 Check the public key, and then press y to import the key and authorize the key for use. If you press N or Enter, yum stops without installing any packages.
To ensure that downloaded packages are genuine, yum verifies the digital signature of each package against the public key of the provider. Once all of the packages required for the transaction are successfully downloaded and verified, yum applies them to your system.

Downloads are Cached

The yum utility keeps downloaded data files and packages for reuse. You may copy packages from the repository cache directories under /var/cache/yum/, and use them elsewhere if you wish. If you remove a package from the cache, you do not affect the copy of the software installed on your system.

Installing New Software with YUM:

 To install the package tsclient, enter the command:
 yum install tsclient

To install the package group MySQL Database, enter the command:
yum groupinstall "MySQL Database"

Updating Software with YUM:
yum update tsclient

Note: New Software Versions Require Reloading

If a piece of software is in use when you update it, the old version remains active until the application or service is restarted. Kernel updates take effect when you reboot the system.

To update all of the packages in the package group MySQL Database, enter the command:
yum groupupdate "MySQL Database"

Removing Software with YUM:

To remove software, yum examines your system for both the specified software, and any software which claims it as a dependency. The transaction to remove the software deletes both the software and the dependencies.
yum remove tsclient

To remove all of the packages in the package group MySQL Database, enter the command:
yum groupremove "MySQL Database"

Searching for Packages with YUM:
Use the search features of yum to find software that is available from the configured repositories, or already installed on your system. Searches automatically include both installed and available packages.

The format of the results depends upon the option. If the query produces no information, there are no packages matching the criteria.

Searching by Package Name and Attributes
yum list tsclient

To make your queries more precise, specify packages with a name that include other attributes, such as version or hardware architecture. To search for version 0.132 of the application, use the command:
yum list tsclient-0.132

Advanced Searches:

If you do not know the name of the package, use the search or provides options. Alternatively, use wild cards or regular expressions with any yum search option to broaden the search criteria.

The search option checks the names, descriptions, summaries and listed package maintainers of all of the available packages to find those that match. For example, to search for all packages that relate to PalmPilots, type:
yum search PalmPilot

This provides function checks both the files included in the packages and the functions that the software provides. This option requires yum to download and read much larger index files than with the search option.

To search for all packages that include files called libneon, type:
yum provides libneon

To search for all packages that either provides a MTA (Mail Transport Agent) service, or includes files with mta in their name:
yum provides MTA

Use the standard wildcard characters to run any search option with a partial word or name: ? to represent any one character, and * to mean zero or more characters. Always add the escape character (\) before wildcards.

To list all packages with names that begin with tsc, type:
yum list tsc\*

Understanding Matches
 Searches with yum show all of the packages that match your criteria. Packages must meet the terms of the search exactly to be  considered matches,  unless you use wildcards or a regular expression.

For example, a search query for shadowutils or shadow-util would not produce the package shadow-utils. This package would match and be shown if the query was shadow-util\?, or shadow\*.
Updating Your System with yum

Use the update option to upgrade all of your system software to the latest version with one operation.
yum update

Automatically Updating Your System
/sbin/chkconfig --level 345 yum on; /sbin/service yum start

How Daily Updates are Run

There is no separate yum service that runs on your system. The command given above enables the control script /etc/rc.d/init.d/yum.
This control script activates the script /etc/cron.daily/yum.cron, which causes the cron service to perform the system update  automatically at 4am each day.

Maintaining YUM
The yum system does not require any routine maintenance. To ensure that yum operations are carried out at optimal speed, disable or remove repository definitions which you no longer require. You may also clear the files from the yum caches in order to recover disk space.

Disabling or Removing Package Sources
 Set enable=0 in a definition file to prevent yum from using that repository. The yum utility ignores any definition file with this setting.

To completely remove access to a repository:
    Delete the relevant file from /etc/yum.repos.d/.
    Delete the cache directory from /var/cache/yum/.

Clearing the yum Caches

By default, yum retains the packages and package data files that it downloads, so that they may be reused in future operations without being downloaded again. To purge the package data files, use this command:
yum clean headers

Run this command to remove all of the packages held in the caches:
yum clean packages

For CentOS-4 users, to clean the metadata files use this command:
yum clean metadata

Purging cached files causes those files to downloaded again the next time that they are required. This increases the amount of time required to complete the operation.

Difference Between RHEL 5, 6, AND 7 - JOBS & SERVICES

Monday, November 02, 2015 0
Difference Between RHEL 5, 6, AND 7 - JOBS & SERVICES




Difference Between RHEL 5, 6, AND 7 - NETWORKING

Monday, November 02, 2015 0
Difference Between RHEL 5, 6, AND 7 - NETWORKING

How to resolve the Insufficient Free Extents for a Logical Volume in Linux Server?

Monday, November 02, 2015 0
 You may get the error message "Insufficient free extents" when creating a logical volume when you think you have enough extents based on the output of the vgdisplay or vgs commands. This is because this commands round figures to 2 decimal places to provide human-readable output. To specify exact size, use free physical extent count instead of some multiple of bytes to determine the size of the logical volume.

The vgdisplay command, by default, includes this line of output that indicates the free physical extents.

# vgdisplay
  --- Volume group ---
  ...
  Free  PE / Size       8780 / 34.30 GB

Alternately, you can use the vg_free_count and vg_extent_count arguments of the vgs command to display the free extents
and the total number of extents.

[root@tng3-1 ~]# vgs -o +vg_free_count,vg_extent_count
  VG     #PV #LV #SN Attr   VSize   VFree   Free #Ext
  testvg   2       0    0 wz--n- 34.30G 34.30G 8780 8780

With 8780 free physical extents, you can run the following command, using the lower-case l argument to use extents instead of bytes:

# lvcreate -l8780 -n testlv testvg

This uses all the free extents in the volume group.

# vgs -o +vg_free_count,vg_extent_count
  VG     #PV #LV #SN Attr   VSize  VFree Free #Ext
  testvg   2      1      0 wz--n- 34.30G    0     0 8780

Alternately, you can extend the logical volume to use a percentage of the remaining free space in the volume group by using the -l argument of the lvcreate command.

How to Recover from LVM Mirror Failure in Linux Server?

Monday, November 02, 2015 0
This section provides an example of recovering from a situation where one leg of an LVM mirrored volume fails because the underlying device for a physical volume goes down. When a mirror leg fails, LVM converts the mirrored volume into a linear volume, which continues to operate as before but without the mirrored redundancy. At that point, you can add a new disk device to the system to use as a replacement physical device and rebuild the mirror.

The following command creates the physical volumes which will be used for the mirror.

[root@test ~]# pvcreate /dev/sd[abcdef][12]
  Physical volume "/dev/sda1" successfully created
  Physical volume "/dev/sda2" successfully created
  Physical volume "/dev/sdb1" successfully created
  Physical volume "/dev/sdb2" successfully created
  Physical volume "/dev/sdc1" successfully created
  Physical volume "/dev/sdc2" successfully created
  Physical volume "/dev/sdd1" successfully created
  Physical volume "/dev/sdd2" successfully created
  Physical volume "/dev/sde1" successfully created
  Physical volume "/dev/sde2" successfully created
  Physical volume "/dev/sdf1" successfully created
  Physical volume "/dev/sdf2" successfully created

The following commands creates the volume group vg and the mirrored volume lvgroupfs

[root@test ~]# vgcreate vg /dev/sd[abcdef][12]
  Volume group "vg" successfully created


[root@test ~]# lvcreate -L 750M -n lvgroupfs -m 1 vg /dev/sda1 /dev/sdb1 /dev/sdc1
  Rounding up size to full physical extent 752.00 MB
  Logical volume "lvgroupfs" created

We can use lvs command to verify the layout of the mirrored volume and the underlying devices for the mirror leg and the mirror log. Note that in the first example the mirror is not yet completely synced; you should wait until the Copy% field displays 100.00 before continuing.

[root@test ~]# lvs -a -o +devices
  LV                                  VG   Attr   LSize   Origin Snap%  Move Log          Copy% Devices
  lvgroupfs                        vg   mwi-a- 752.00M                  lvgroupfs_mlog 21.28 lvgroupfs_mimage_0(0),lvgroupfs_mimage_1(0)
  [lvgroupfs_mimage_0]   vg   iwi-ao 752.00M                                       /dev/sda1(0)
  [lvgroupfs_mimage_1]   vg   iwi-ao 752.00M                                       /dev/sdb1(0)
  [lvgroupfs_mlog]            vg   lwi-ao   4.00M                                       /dev/sdc1(0)

[root@test ~]# lvs -a -o +devices
  LV                                VG   Attr   LSize   Origin Snap%  Move Log          Copy%  Devices
  lvgroupfs                      vg   mwi-a- 752.00M                  lvgroupfs_mlog 100.00  lvgroupfs_mimage_0(0),lvgroupfs_mimage_1(0)
  [lvgroupfs_mimage_0] vg   iwi-ao 752.00M                                        /dev/sda1(0)
  [lvgroupfs_mimage_1] vg   iwi-ao 752.00M                                        /dev/sdb1(0)
  [lvgroupfs_mlog]          vg   lwi-ao   4.00M     i                                  /dev/sdc1(0)

In this example, the primary leg of the mirror /dev/sda1 fails. Any write activity to the mirrored volume causes LVM to detect the failed mirror. When this occurs, LVM converts the mirror into a single linear volume. In this case, to trigger the conversion, we execute a dd command

[root@test ~]# dd if=/dev/zero of=/dev/vg/lvgroupfs count=10
10+0 records in
10+0 records out

You can use the lvs command to verify that the device is now a linear device. Because of the failed disk, I/O errors occur.

[root@test ~]# lvs -a -o +devices
  /dev/sda1: read failed after 0 of 2048 at 0: Input/output error
  /dev/sda2: read failed after 0 of 2048 at 0: Input/output error
  LV                     VG   Attr   LSize   Origin Snap%  Move Log Copy%  Devices
  lvgroupfs           vg   -wi-a- 752.00M                               /dev/sdb1(0)

 At this point you should still be able to use the logical volume, but there will be no mirror redundancy.

To rebuild the mirrored volume, you replace the broken drive and recreate the physical volume. If you use the same disk rather than replacing it with a new one, you will see "inconsistent" warnings when you run the pvcreate command.

[root@test ~]# pvcreate /dev/sda[12]
  Physical volume "/dev/sda1" successfully created
  Physical volume "/dev/sda2" successfully created

[root@test ~]# pvscan
  PV /dev/sdb1   VG vg   lvm2 [67.83 GB / 67.10 GB free]
  PV /dev/sdb2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdc1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdc2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdd1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdd2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sde1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sde2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdf1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdf2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sda1              lvm2 [603.94 GB]
  PV /dev/sda2              lvm2 [603.94 GB]

Next you extend the original volume group with the new physical volume.

[root@test ~]# vgextend vg /dev/sda[12]
  Volume group "vg" successfully extended

[root@test ~]# pvscan
  PV /dev/sdb1   VG vg   lvm2 [67.83 GB / 67.10 GB free]
  PV /dev/sdb2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdc1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdc2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdd1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdd2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sde1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sde2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdf1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdf2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sda1   VG vg   lvm2 [603.93 GB / 603.93 GB free]
  PV /dev/sda2   VG vg   lvm2 [603.93 GB / 603.93 GB free]

Convert the linear volume back to its original mirrored state.

[root@test ~]# lvconvert -m 1 /dev/vg/lvgroupfs /dev/sda1 /dev/sdb1 /dev/sdc1
  Logical volume mirror converted.

You can use the lvs command to verify that the mirror is restored.

[root@test ~]# lvs -a -o +devices
  LV                                   VG   Attr   LSize   Origin Snap%  Move Log          Copy% Devices
  lvgroupfs                         vg   mwi-a- 752.00M                  lvgroupfs_mlog 68.62 lvgroupfs_mimage_0(0),lvgroupfs_mimage_1(0)
  [lvgroupfs_mimage_0]    vg   iwi-ao 752.00M                                       /dev/sdb1(0)
  [lvgroupfs_mimage_1]     vg   iwi-ao 752.00M                                       /dev/sda1(0)
  [lvgroupfs_mlog]             vg   lwi-ao   4.00M                                       /dev/sdc1(0)