Wednesday, May 10, 2017

How to add a disk on AIX Logical Volume Manager (LVM)

In the last post of AIX, I had explained that how we create a logical volume manager on AIX operating system. In this post, I will explain to you how to add a disk on AIX logical volume manager.

LVM (Logical Volume Manager) is a tool for logical volume management which includes allocating disks, striping, mirroring and resizing logical volumes.With LVM, a hard drive or set of hard drives is allocated to one or more physical volumes.

LVM allows users to create partitions from more than one disk and allows them to extend the filesystem size online within few seconds.

Step by step method to add a disk on LVM.

1. In the first step we will add the physical or virtual disk to the logical partition. Once the new disk is added on the logical partition then we can able to go for next step.

2. Now, rescan your system hardware so that the Operating system can find which new hard disk is add on the server. For this please use the below command to scan the hardware on AIX operating system.

aix:/> cfgmgr

3. In this step, we will check the disk. For example, let’s assume that the new disk is hdisk1, so please run the below command to check the disk.

aix:/> lsdev -Cc disk
hdisk0  Available  Virtual SCSI Disk Drive
hdisk1  Available  Virtual SCSI Disk Drive

aix:/> lspv
hdisk0      00f68f03d1e42951       rootvg          active
hdisk1      00f68f03d20beafd       vstorage        active
hdisk2      00f68f03d20ceb37       vstorage        active

if you see the above both output, you can found that hdisk1 is available to add on Voulme group.

4. In this step, now you need to create a new group and move the new disk hdisk1 in there. Let's assume the new group named is "rootvg". So please find the below command to create a new group and add the disk in it.

aix:/> mkvg -y rootvg hdisk1

5. Now you can look at the size of hdisk1. Please run the below command , you can found the below output regarding the disk space of your disk and this command would not work if it is not associated with the volume group.

aix:/> lspv hdisk1
PHYSICAL VOLUME:    hdisk1                   VOLUME GROUP:     rootvg
PV IDENTIFIER:      00f68f03d1e42951 VG IDENTIFIER     00f68f0300004c0000000153d1e429c1
PV STATE:           active
STALE PARTITIONS:   0                        ALLOCATABLE:      yes
PP SIZE:            128 megabyte(s)          LOGICAL VOLUMES:  17
TOTAL PPs:          799 (102272 megabytes)   VG DESCRIPTORS:   2
FREE PPs:           118 (15104 megabytes)    HOT SPARE:        no
USED PPs:           681 (87168 megabytes)    MAX REQUEST:      256 kilobytes
FREE DISTRIBUTION:  11..00..00..00..107
USED DISTRIBUTION:  149..160..159..160..53
MIRROR POOL:        None

6. In this step , now we will create a log logical volume for jfs2 file system and this needs to be part of vloume group "rootvg".

aix:/> mklv -t jfs2log rootvg 1

As i can not paste the my machine output as I am already add it, You can add at your end , if any issue occur on this stage please comment on the post.

7. Now, we will check the new logical volume (lv) and you can used the below command to check the new logical volume present on the AIX server.Normally on AIX server we are used "loglv00" logical name, as on my machine I used the same name.

aix:/> lsvg
rootvg

aix:/> lsvg -l rootvg
rootvg:
LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
hd5                 boot       1       1       1    closed/syncd  N/A
hd6                 paging     404     404     1    open/syncd    N/A
loglv00             jfs2log    1       1       1    open/syncd    N/A
hd4                 jfs2       4       4       1    open/syncd    /

If you see the above both the output, you can find that "rootvg" is voulme group present and in rootvg, you can find the logical volume "loglv00".

8. In this, we will create a logical volume and fixed their size , lets assume we will used 30GB size and used the logical volume name lglv_test.

aix:/> lsvg rootvg
aix:/> mklv -t jfs2 -y lglv_test rootvg 30G
aix:/> mkfs -o log=/dev/loglv00 -V jfs2 /dev/lglv_test

9. In the seconf last step we will mount the newly created file system on the AIX operating system.

aix:/> mkdir /test
aix:/> mount -o log=/dev/loglv00 /dev/lglv_test /test

In this example , we will create a "/test" file system and mount the file system on this folder.

10. In the final step we will make a permament entry of this file system in "/etc/filesystems file so once you take a reboot of AIX server, file system will mount permamently, otherwise you need to mount again if you not made an entry in /etc/filesystems.

Hope this post is useful for you, as this step by step method you can not found in other sites, In case still you are facing any issue related to this topic, please comment on this post, I will revert to you with solution.

Monday, May 8, 2017

How to find the console IP address in HP-UX Servers

In this post, I will guide you to how to find the console IP address in HP-UX operating system if we lost or forgotten. So here, I will provide you the simple steps to get back the console IP address of HP-UX system.

For Itanium systems running 11.31 version only we can use smh and the cprop command. These both method works to recover the forgotten password.

cprop is what the smh webpage uses to retrieve the IP address. Run the smh webpage (hostname:hpx)

Home -> System -> Management Processor

It is show you the IP address of console port. Also please find the below "cprop" command usage, how to we run this command.


hpx:/>/opt/propplus/bin/cprop -summary -c “Management Processor”

[Component]: Management Processor
[Table]: Management Processor
——————————————————-
****************************************************
                   [Hash ID]: Management Processor:11a64d1ax41eed6da
                    [Status]: OK
                 [IPAddress]: 192.168.1.23
                       [URL]: https://192.168.1.23
                     [State]: Enabled
****************************************************

For PARISC boxes and Itanium models running 11.23 or earlier, you must use the serial port on the back of the box. The commands will be:

ctrl-a (to get the attention of the console interface)
<login> typically Admin and Admin
CM (to get to the command menu)
LC
MA (to exit the CM menu)
X  (to exit the GSP or MP menu)

You need to connect a serial cable on Serial port of the HP-UX server and connected to own laptop. Once you will get the ssh or telnet session from serial connection, you need to run the above command to get the IP address of HP-UX console.

Sometimes the serial port is not working then in this case you need to login in serial management port of the server and recover the IP address again.

Please revert back if you are encounter any issue related to this post.

How to find the boot disk from HP-UX operating system

In this article , I would explain to you how we find which disk are used to boot the running HP-UX operating system. This is a bit tricky because its depending on the version of HP-UX, and whether it is using LVM or the less common choice.

For LVM disk layouts:

For 11.11 and earlier, use the below command to check which disk is in used.

# echo “boot_string/S” | adb -k /stand/vmunix /dev/kmem
    boot_string:
    boot_string:    disk(0/0/2/0.6.0.0.0.0.0;0)/stand/vmunix

For 11.23, there are different ways for PARISC versus IA64:

PARISC:

# echo “boot_string/S” | adb -o /stand/vmunix /dev/kmem
    boot_string:
    boot_string:    disk(1/0/0/3/0.6.0.0.0.0.0;0)/stand/vmunix

IA64 (Itanium/Integrity):

# echo “bootdev/x” | adb -n /stand/vmunix /dev/kmem
    bootdev:
        0x100001c

Now to find the actual path, you’ll have to match the 0x100001c value to a minor number in the /dev/disk directory. Compare only the last 6 digits of the number (00001c) to find the device file. Then by using lssf, you can decode the hardware path:

    # DSK=$(ll /dev/disk | awk ‘/00001c/{print $NF}’)
    # echo $DSK
    disk11_p2

    # HWPATH=$(lssf /dev/disk/$DSK | awk ‘{print $(NF-1)}’)
    # echo “$DSK path = $HWPATH”
    disk11_p2 path = 64000/0xfa00/0xa

You can also use ioscan -m dsf to map agile device file names to legacy (CTD) style.

For VxVM disk layouts:

# echo “raw_root/X” | adb -o /stand/vmunix /dev/kmem
     raw_root:
     raw_root:       0x3000002

This value is the minor number for the disk that was used to boot the current system. The minor number is found in the /dev/vx/dmp directory.

     # DSK=$(ll /dev/vx/dmp | awk ‘/000002/{print $NF}’)
     # echo $DSK
    c2t1d0s2

     # HWPATH=$(lssf /dev/dsk/$DSK | awk ‘{print $(NF-1)}’)
     # echo “$DSK path = $HWPATH”
     c2t1d0s2 path = 0/1/1/0.1.0

For completeness, I should mention that 11.31 will report the boot disk path in syslog.log (LVM or VxVM) like this:

vmunix: Boot device’s HP-UX HW path is: 0/1/1/0.0×1.0x0

However, syslog.log is a catch-all for a lot of items and often needs to be truncated when it grows too large. As a result, it can’t be relied on to always contain the current boot disk.

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

Hello Friends,

In this post, I would explain to you how to resolve one of the most intreseting issue on linux servers "Kernel Panic". I think the linux lovers much awaited such issue while they are working on Unix troubleshooting part.

As everyone knows Kernel are most importent part of any operating system and if it is crashed that's means your system crashed.

Normally kernel panic occur when you upgrade the server or upgrade the packages on the server. Here, you can find one of the Kernel panic issue as describe below.

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
Pid: 1, comm: swapper Not tainted 2.6.32-502.el6.x86_64 #1
Call Trace:
 [<ffffffff815292bc>] ? panic+0xa7/0x16f
 [<ffffffff81c2b432>] ? mount_block_root+0x216/0x2cb
 [<ffffffff81002930>] ? bstat+0x2b0/0x980
 [<ffffffff81c2b53d>] ? mount_root+0x56/0x5a
 [<ffffffff81c2b6b1>] ? prepare_namespace+0x170/0x1a9
 [<ffffffff81c2a92a>] ? kernel_init+0x2e1/0x2f7
 [<ffffffff8100c20a>] ? child_rip+0xa/0x20
 [<ffffffff81c2a649>] ? kernel_init+0x0/0x2f7
 [<ffffffff8100c200>] ? child_rip+0x0/0x20


Solution : Normally this issue occur while you upgrade your server using yum and after reboot server is not boot due to kernel panic problem. This problem occur while kernel version has not been changed properly.

You can boot your linux server in grup mode and check the kernel and initrd paramtere. Match both the parameter if they are using same kernel version. During upgrade the initrd version normally not changed so you can manually change the correct kernel version entry in this file.

Once you modified the initrd files boot the server and make a same changes in grub.conf file too, otherwise once you take a reboot or shutdown the machine same kerenl panic error will occur.

[root@localhost]# vi /etc/grub.conf

#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS 6 (2.6.32-504.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-504.el6.x86_64 ro root=/dev/mapper/vstorage-root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=vstorage/root  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
        initrd /initramfs-2.6.32-504.el6.x86_64.img

In above example, the default value 0 identifies the first title option to be used as default, the corresponding kernel version in title option line as 2.6.32-504.el6.x86_64 and the initramfs image file as initramfs-2.6.32-504.el6.x86_64.img. 

Before changing thing please take a backup of grub.conf file. now you can rename the kernel version in the initrd line and matched the same version at both the line and reboot the server, after reboot your linux machine will boot normally.

Hope your kernel panic issue will be resolved after reading this post. Please let me know if you are still facing this issue, I would try to help you.

How To Fix “Device eth0 does not seem to be present, delaying initialization” Error

This Ethernet card error is normally occur on Linux operating system like CentOS, Red Hat Linux etc. When you try to up the Ethernet card it is showing you the above topic error.

So in this post, we will provide you the step by step solutions and troubleshoot all the issue related this error.

In the initial step, you will check which Ethernet card is down , for this you can run the "ifconfig -a" command. Using this command you can check how many internet card is present on the server and on which Ethernet card used IP address.

Let's suppose you are using eth0 on your machine, and if this Ethernet card not taking any ip address and now show on your device that means it is down right now, so please try to start Eth0 device as given below command.

[root@localhost]# ifup eth0
Device eth0 does not seem to be present, delaying initialization

If your internet card show such issue that means you have an issue with MAC address. So in this post I would explain you how to resolve such issue.

1. In this step, please check the MAC Addresses are set correctly or not. For checking this you need to go the network card directory "/etc/sysconfig/network-scripts"

[root@localhost]# cd /etc/sysconfig/network-scripts

[root@localhost]# cat ifcfg-eth0

HWADDR=”00:15:5D:00:91:91”

In the configuration file, you can see the current hardware address of eth0 card, I have show you only HWADDR entry of my eth0 file. In this directory you can see if other Ethernet card is present or not. In my Linux machine i have two Ethernet card , please find the below second Ethernet card MAC address.

[root@localhost]# cat ifcfg-eth1

HWADDR=”00:15:5D:00:91:90”

2. Now we will see which link is present on the system currently and which is not active, for this you can use the below command to check the status.

[root@localhost]# ip -o link

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN \    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

2: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000\    link/ether 00:15:5D:00:91:90 brd ff:ff:ff:ff:ff:ff

3: eth2: mtu 1500 qdisc   pfifo_fast state UP qlen 1000\ link/ether 00:15:5D:00:91:91 brd ff:ff:ff:ff:ff:ff

Here, no eth1 but there is an eth2 present on the system, so might be problem is that the eth0 is renamed to eth2 but we will confirm with below command.

[root@localhost]# dmesg | grep eth0

udev: renamed network interface eth0 to eth2
udev: renamed network interface rename3 to eth0

From this command it shows that udev rename the network interface, so in the next step we will remove the wrong entry and configure the Ethernet card 

3. Now please open the network rules file to confirm the mac address. Please open this file "/etc/udev/rules.d/70-persistent-net.rules" 

[root@localhost]# cat /etc/udev/rules.d/70-persistent-net.rules

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:5d:00:91:90", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:5d:00:91:91", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:5d:00:91:91", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

Looks like there are multiple entries for the same MAC address. Removed the incorrect entry and restart the interface using below command.

[root@localhost]# ifup eth0

Now you eth0 card is up and if you are running "ifconfig -a" command you can see the eth0 card with mac address. 

Hope you are get the solution of the above issue, also please let me know if you have any other issue.

Tuesday, April 4, 2017

How to Configure Proxy Settings in Linux

In this post, I will explain , how we set or configure the proxy setting in Linux server. Usually when you work on the cooperate server you work behind the proxy. So if you are trying to download any packages or software on the Linux operating system machine, you need to configure the proxy on your browser or on system profile.

1. If you want to set http_proxy shell variable on Linux terminal or bash shell, then please use the below command or method to set the proxy settings on terminal.

# export http_proxy=http://Proxy_IP:Proxyport

or

# export http_proxy=http://Proxy_Domain:ProxyPort

You can use above command to set the proxy on bash shell or on terminal. You can use Proxy IP as well as Proxy DNS name to configure the proxy on shell. In my case I have use proxy IP on my server.

#export http_proxy=http://192.168.1.70:8080

If you want to use https proxy then please run the below command to set the proxy settings on bash or any other shell.

#export https_proxy=https://Proxy_IP:ProxyPort

or

#export https_proxy=https://Proxy_Domain:ProxyPort

You can use this proxy on open shell only if you close the terminal or shell then you need to set proxy variable again.

If your proxy use authentication then you need to give proxy user name and password while you are running the above command.

#export http_proxy=http://Proxy_User:Proxy_Password@Proxy_IP:Port

2. If you want to setup proxy variable for all users then you need to set proxy environment as a global variable. To do this you need to set proxy variable on /etc/profile file.

# vi /etc/profile

export http_proxy=http://Proxy_IP:Proxyport

or

export http_proxy=http://Proxy_User:Proxy_Password@Proxy_IP:Port

3. If you want to set the proxy access to a specific user then you need to set the variable on their bash profile.

# vi /home/vibhor/.bash_profile

Append the following line:

export http_proxy=http://Proxy_User:Proxy_Password@Proxy_IP:Port

or 

export http_proxy=http://Proxy_IP:Proxyport

You can use the https proxy or ftp proxy also only required to change the name of the varibale. 

Friday, March 24, 2017

HP-UX Logical Volume Manager (LVM) Commands with an Example

In this post, You can get an idea about HP-UX logical volume manager commands with an example. As you know LVM is basically used for disk management in operating system that allow to manager the physical disks and logical volume.

Please find the below HP-UX LVM commands with an example.

1. Create a new volume group, logical volume and file system:

You can used the below command in HP-UX operating system to create a new volume group, logical volume and file system.

hpx:/>pvcreate /dev/rdsk/c2t1d0

For creating a new volume group first we need to create physical volume as describe in above command.

hpx:/>mkdir /dev/vg01
hpx:/>mknod /dev/vg01/group c 64 0x010000

In above step we will create a directory where we need to create a volume group.

hpx:/>vgcreate /dev/vg01 /dev/dsk/c2t1d0

After successfully creation of volume group we will create a new logical voulme as describe in below command.

hpx:/>lvcreate -L 2048 /dev/vg01

hpx:/>newfs -F vxfs -o largefiles /dev/vg01/vgvol1

Using above command we create a new file system now in next step we will create a directory where we need to mount the newly created file system.

hpx:/>mkdir /backup
hpx:/>mount /dev/vg01/vgvol1 /backup

Once you mount the logical voulme with file system you can run the file system checking command to verify that mounting is succesfully or not.

2. Create a stripped filesystem:

In this, we will create a stripped file system with the help of volume group and logical voulme.

hpx:/>lvcreate -i 2 -I 32 -L 48 -n vgvol1 /dev/vg01

-i number of stripes
-I stripe size of 32KB
-L size of the volume

3. HP-UX display boot information:

You can use the below command to display boot information.

hpx:/>lvlnboot -v /dev/vg00

Boot Definitions for Volume Group /dev/vg00:
Physical Volumes belonging in Root Volume Group:
        /dev/dsk/c2t0d0 (0/1/1/0.0.0) -- Boot Disk
        /dev/dsk/c2t1d0 (0/1/1/0.1.0) -- Boot Disk
Boot: lvol1     on:     /dev/dsk/c2t0d0
                        /dev/dsk/c2t1d0
Root: lvol3     on:     /dev/dsk/c2t0d0
                        /dev/dsk/c2t1d0
Swap: lvol2     on:     /dev/dsk/c2t0d0
                        /dev/dsk/c2t1d0
Dump: lvol2     on:     /dev/dsk/c2t0d0, 0

When you run the above command you can find the above output , if you see the boot information you can find you have two disk which is available for boot.

4. HP-UX display all disks system information:

hpx:/> ioscan -funC disk
Class     I  H/W Path        Driver   S/W State   H/W Type     Description
==============================================================
disk      0  0/0/2/0.0.0.0   sdisk    CLAIMED     DEVICE       TEAC    DV-28E-N
                            /dev/dsk/c0t0d0   /dev/rdsk/c0t0d0
disk      1  0/1/1/0.0.0     sdisk    CLAIMED     DEVICE       HP 146 GMAX3147NC
                            /dev/dsk/c2t0d0   /dev/rdsk/c2t0d0
disk      2  0/1/1/0.1.0     sdisk    CLAIMED     DEVICE       HP 146 GMAX3147NC
                            /dev/dsk/c2t1d0   /dev/rdsk/c2t1d0

In the above output you can found the all the disk which is available in the system.

5. HP-UX display dump devices:

hpx:/> lvlnboot -v

Normally it is showing the boot information in which you can check the dump devices name.

Wednesday, March 22, 2017

Solaris Processes Monitoring - prstat

In this post, I will explain you which commands is used for display the Solaris zone process information.

Using "prstat" command we can display the solaris zone process information. This command generate the reports information about the processes and zones.

The prstat statistics utility shows a summary of the processes that are using system resources currently. The prstat utility summarizes this information for an every 5 seconds by default and reports the statistics for that period.

Display the zones process informtion:

[sun]# prstat -Z

 PID USERNAME  SIZE   RSS STATE   PRI NICE      TIME  CPU PROCESS/NLWP
 18638 20159    2118M 1502M cpu43    10    0   0:00:44 2.4% oracle/7
 20927 24076    8784K 8136K cpu127    0    2   0:00:17 1.8% prstat/1
   897 24865     916M  512M sleep    59    0  27:52:32 0.7% java/95
 17511 26055     599M  285M sleep    59    0  35:08:33 0.6% java/115
 12540 26055     951M  341M sleep    59    0  31:00:01 0.5% java/101

 ZONEID    NPROC  SWAP   RSS MEMORY      TIME  CPU ZONE
     8     3427   73G   27G    21%  44:01:48 2.8% sunz01
     0      100  465M  132M   0.1% 507:26:46 2.6% global
     6     4056   86G   32G    25%  35:23:30 2.3% sunz02    
Total: 13382 processes, 36594 lwps, load averages: 9.11, 9.27, 9.47

Using above command "prstat -Z" we can monitor the server process utilization in every 5 second. This command is show you the global zone & their local zone process utilization only.

If you want to only specific zone process utilization then you can use the below command.

[sun]# prstat -z sun01

This command output show you only process utilization of specific zone only.

Note:

-Z Reports information about processes and zones.
-z Reports information about a particular zone.

You can use the below syntax to monitor the Global zone as well as only specific zone.

Sun Solaris zonecfg commands

In the last post, I had explained the usage of zoneadm command for Solaris servers, now in this post we will get the information about the "zonecfg" command. 

This is very useful command which is mostly used during configuration of new zone or installed zone as well as for removal of any zone configuration files.

1. Command for creating a Solaris zone:

Please find the below commands to creating a zone on Sun Solaris server. The command must be run on Global zone with root user.

[sun]#zonecfg -z <zone>

Example: [sun]#zonecfg -z sunz01

Once you run the above command, you can enter in the configuration file, where you can add or edit the configuration for the zone.

2. Command for deleting a Solaris zone:

Please find the below command to deleting a Solaris zone from Global zone.

[sun]#zonecfg -z <zone> delete -F

Example: [sun]#zonecfg -z sunz01 delete -F

using above command you can delete or remove the configuration file of solaris local zone.

Note: You need to shutdown and uninstall the local zone before deleting the configuration files of Sun Solaris local zone.

3. Command for display zone current configuration:

Please find the below command to display the current configuration of local Solaris zones.

[sun]#zonecfg -z <zone> info

Example: [sun]#zonecfg -z sunz01 info

This command output show you the zonename, zonepath, autoboot etc attributes information of the solaris zone.

4. Command for zone creation file:

Please find the below command to create a solaris zone creation file.

[sun]#zonecfg -z <zone> export

Example: [sun]#zonecfg -z sunz0 export

Once the creation file has been export you can use this file to another zone creation as well as for restoration of this local zone if any problem occur on this zone.

How to use zoneadm command in Solaris Servers

When you are working on the Solaris operating system then you must aware about this command "zoneadm" which is basic command in Solaris operating system. In this post I would like to explain you how to use the zoneadm command in Solaris servers.

"zoneadm" command are used for verification, installation, boot or viewing of the local zones which are created on the Solaris Server. Please find the below syntax with an example.

1. Verify a Solaris zone:

To verify the local solaris zone you need to run the below command with syntax.

[sun]#zoneadm -z <zone> verify

Example: [sun]#zoneadm -z sunz01 verify

In this example once you run the above command, if your zone is installed properly without any error then this is not showing you any output, that's means it is verified. After running the command if it is showing a message then you need to check the configuration of this zone.

2. Installing a Solaris zone:

To install the local Solaris zone you need to run the below command with syntax.

[sun]#zoneadm -z <zone> install

Example: [sun]#zoneadm -z sunz01 install

In this example when you run the above command then your local zone has been started for installation. It is installed the local zone using the Solaris repostiory or flar images which you are kept at server location.

3. Ready a Solaris zone:

To move the local zone in ready or maintainance state you need to run the below command.

[sun]#zoneadm -z <zone> ready

Example: [sun]#zoneadm -z sunz01 ready

In this example, when we run the above command then your local zone moved in to ready or maintianance state.

4. Boot a Solaris zone:

To boot the solaris zone on global system, you need to run the below command with syantx.

[sun]#zoneadm -z <zone> boot

Example: [sun]#zoneadm -z sunz01 boot

After running the above command your local solaris zone has been boot successfully if it is not showing any error during boot time. If you see any message during the boot time then please check where is the issue.

5. Reboot a Solaris zone:

To reboot or restart the solaris zone on Solaris server, you need to perform the below command on global zone.

[sun]#zoneadm -z <zone> reboot

Example: [sun]#zoneadm -z sunz01 reboot

Using this command the local zone "sunz01" has been restart again successfully. You need to run this command from global zone only.

6. Shutdown/Halt a Solaris zone:

If you want to shutdown or halt your local zone without login it, then you need to run the below command from global zone.

[sun]#zoneadm -z <zone> halt

Example: [sun]#zoneadm -z sunz01 halt

After running this command local solaris zone state change from running to installed state that's means your server is shutdown now.

7. Uninstall a Solaris zone:

If you want to uninstall any solaris zone then you need to run the below command for uninstall the zone.

[sun]#zoneadm -z <zone> uninstall -F

Example: [sun]#zoneadm -z sunz01 uninstall -F

"-F" syntax is used to uninstall the zone forcefully. 

8. Viewing a Solaris zone:

if you want to local zone current status and any other display information you need to run the below command. 

[sun]#zoneadm list -icv

 ID NAME       STATUS      PATH               BRAND   IP
   0 global         running        /                        solaris      shared
   1 sunz01        running       /zones/sunz01   solaris      excl
   2 sunz02        running       /zones/sunz02   solaris      excl

Using above command you can check the current status of all installed zones on Solaris server. It is show you the zone path and zone information. All the above command you need to run from Global zone with root privileges.

Monday, March 20, 2017

10 Practical Examples of RPM Commands in Linux

In this post, I will explain you the usage of RPM (Red Hat Package Manager) command with an example. RPM commands are widely used in Linux operating system to install, remove or update the packages on operating system.

RPM (Red Hat Package Manager) is a default open source and package management utlity which is widely used on Redhat, CentOS linux operating system. You can install , remove, upgrade the packages using this commnad. In this post We will explain each syntax with an example so you can understand how this command is very useful on linux operating system. So here, we will explain best 20 example which is related to Red Hat Package Manager.

1. How to Check an RPM Signature Package:

This command with syntax is used for to check the PGP signature of packages before installing them on your Linux systems and make sure its integrity and origin is fine.

[root@locahost]# rpm --checksig vsftpd-2.2.2-14.el6.x86_64.rpm
vsftpd-2.2.2-14.el6.x86_64.rpm: rsa sha1 (md5) pgp md5 OK

2. How to Install an RPM Package:

Using below syntax you can install the rpm packages on the linux system.

[root@localhost]# rpm -ivh vsftpd-2.2.2-14.el6.x86_64.rpm
Preparing...               ########################################### [100%]
1:vsftpd                    ########################################### [100%]

On the above syantx we are using "-i" option to install the rpm packages on Linux operating system.

3. How to check dependencies of RPM Package before Installing:

If you want to check which packages or dependency is required for RPM packages then you can run the below command to check the dependency.

[root@localhost]# rpm -qpR samba-winbind-3.6.23-12.el6.x86_64.rpm

Here, you can find the syantx meaning of the above command.
-q : Query a package.
-p : List capabilities this package provides.
-R: List capabilities on which this package depends.

4. How to Install a RPM Package Without Dependencies:

If you want to install the packages without any dependency please use the below syntax.

[root@localhost]# rpm -ivh --nodeps samba-winbind-3.6.23-12.el6.x86_64.rpm
Preparing...                       ########################################### [100%]
1:Samba-winbind             ########################################### [100%]

The above command forcefully install rpm package by ignoring dependencies errors, but if those dependency files are missing, then the program will not work at all, until you install them.

5. How to check an Installed RPM Package:

If you want to check which RPM package is installed on the operating system then please use -q option with package name.

[root@localhost]# rpm -q samba
package samba is not installed

If you see the samba packages is not installed on my system so it is show you this message.

[root@localhost]# rpm -q vsftpd
vsftpd-2.2.2-14.el6.x86_64

You can see the above ftp server packages is installed on the system.

6. How to Upgrade a RPM Package:

If you want to upgrade any RPM packages then please use "-U" syntax with rpm name.

[root@localhost]# rpm -Uvh vsftpd-3.0.2-11.el6.x86_64.rpm
Preparing...             ########################################### [100%]
1:vsftpd                 ########################################### [100%]

If you see the above example the packages is upgrade with the new version of vsftpd.

7. How to Remove a RPM Package:

If you want to uninstall or remove the package from the server then please use "-e" erase option is used to remove package.

[root@localhost]# rpm -evv vsftpd

Using above command we can remove the packages with all dependency.

8. How to Remove an RPM Package Without Dependencies:

If you want to remove installed packages without any dependecy then use the below syntax to remove the rpm.

[root@localhost]# rpm -ev --nodeps vsftpd

Using above syntax "--nodeps" we can remove the packages without dependency.

9. How to Import an RPM GPG key:

If you want to import the RPM GPG key then please verify RHEL/CentOS/Fedora packages, you must import the GPG key.

[root@localhost]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

So using above syantx we can import the GPG key on the server.

10. How to List all Imported RPM GPG keys:

To print all the imported GPG keys in your system, use the following command.

[root@localhost]# rpm -qa gpg-pubkey*
gpg-pubkey-0608b895-4bd22942
gpg-pubkey-7fac5991-4615767f

You can see the above entry these are the GPG key which is installed on the server.

Thursday, March 16, 2017

Step by Step Configuration of NTP Server on HP-UX Server

In this post, I would like to explain how we configure the NTP (network time protocol) server on HP-UX operating system server. In my recent post you can found the NTP configuration on Solaris and AIX platform. 

As you know NTP ( Network time Protocol) is one of the oldest internet protocol still in use and it allows the synchronization of computer clocks distributing UTC (Coordinated Universal Time) over the network. It is basaiclly used for time synchronization on Unix servers.

Step by Step Configuration of NTP Server on HP-UX:

1. In the first step we will check the configuration files of "xntpd" daemon. By default the configuration file for this daemon is "/etc/rc.config.d/netdaemons".

# vi /etc/rc.config.d/netdaemons

######################################
# xntp configuration.  See xntpd(1m) #
######################################
#
#  Time synchronization daemon
#
# NTPDATE_SERVER: name of trusted timeserver to synchronize with at boot
# (default is rootserver for diskess clients)
# XNTPD:        Set to 1 to start xntpd (0 to not run xntpd)
# XNTPD_ARGS:  command line arguments for xntpd
#
# Also, see the /etc/ntp.conf and /etc/ntp.keys file for additional
# configuration.
#
export NTPDATE_SERVER=
export XNTPD=0
export XNTPD_ARGS=

This is default configuration entry of this file so for xntpd daemon we need to change the variable which is defined.

export NTPDATE_SERVER='ntp.in.pool.org'
export XNTPD=1
export XNTPD_ARGS=

Note: You must change the NTPDATE server name.

2. For ntp config please set the correct timezone is setup in /etc/TIMEZONE file.

hpx:/> cat /etc/TIMEZONE
TZ=IST-5:30
export TZ

You can edit the file in vi editor and change the time zone as per your location.

3. Now, we need to make some changes in NTP configuration files. 

hpx29:/> cat /etc/ntp.conf
#Configuration NTP des serveurs
server ntp.in.org.com
server ntpin.in.org.com

You need to replace ntp server name accordingly. In my post I will use dummy server name.

4. After setting the NTP server name we need to restart the NTP service on HP-UX operating system and verify the ntp configuration.

hpx:/> /sbin/init.d/xntpd restart

hpx:/> ntpq -p

If it is showing you correct ntp server information now. You can match these information with the NTP server name which we use in above step.

Tuesday, March 14, 2017

How to configure NTP Server on AIX Operating system

In the last post, I had explained the NTP (Network Time Protocol) on Solaris 10 & 11 server. Now in this post, I will explain the same NTP server and client configuration for AIX operating system.

As you know NTP ( Network time Protocol) is one of the oldest internet protocol still in use and it allows the synchronization of computer clocks distributing UTC (Coordinated Universal Time) over the network.

Step by Step Configuration of NTP:

1. In the initial step we must verify that we have check the available NTP server on AIX server. For this please run the below command.

AIX:/>lssrc -ls xntpd
-----------------------------------------------
 Program name:    /usr/sbin/xntpd
 Version:         3
 Leap indicator:  00 (No leap second today.)
 Sys peer:        ntp.aix.in.com
 Sys stratum:     4
 Sys precision:   -18
 Debug/Tracing:   DISABLED
 Root distance:   0.014709
 Root dispersion: 0.066422
 Reference ID:    192.168.1.22
 Reference time:  dc721077.d3a8e000  Tue, Mar 14 2017  7:47:19.826
 Broadcast delay: 0.003906 (sec)
 Auth delay:      0.000122 (sec)
 System flags:    pll monitor filegen
 System uptime:   19248381 (sec)
 Clock stability: 0.000107 (sec)
 Clock frequency: 0.000000 (sec)
 Peer: ntp.aix.in.com
      flags: (configured)(sys peer)
      stratum:  3, version: 3
      our mode: client, his mode: server
 Peer: ntpuk.aix.in.com
      flags: (configured)(sys peer)
      stratum:  3, version: 3
      our mode: client, his mode: server
Subsystem         Group            PID          Status
xntpd            tcpip            8520514      active
------------------------------------------------------

You can found the above output once you run the above command to check the available NTP server. On my AIX machine if you see the sys peer should show a valid server (ntp.aix.in.com). If the server is not showing any ntp server then we need to correct it by adding a server line into /etc/ntp.conf and will take restart of "xntpd" services.

Note : In this post I will use my dummy NTP name instead of real NTP server because of security reason.

2. As your NTP server is not configured and it is show "insame" then you need to add manual entry on the NTP configuration file.

AIX:/>vi /etc/ntp.conf

server ntp.aix.in.com
server ntpuk.aix.in.com

Once you added these ntp server entry manually on the configuration file then please take a restart of NTP services.

AIX:/>stopsrc -s xntpd
AIX:/>startsrc -s xntpd

Using above command we can stop and start the "xntpd" service on AIX operating system.

3. In this step you need to again verify the status of newly added NTP server.

AIX:/>lssrc -ls xntpd

It is taking some time that time because it synchronize process is running. Once the synchronization has been complete and you run the above command you can found the NTP server entry as describe in Step 1.

Step by Step configuration of NTP Client:

1. On the client machine you need to again verify that you have a server suitable for synchronization or not. For this please run the below command.

AIX:/>ntpdate -d ntp.aix.in.com
-----------------------------------------------------------
14 Mar 08:16:21 ntpdate[64356890]: 3.4y
transmit(192.168.1.22)
receive(192.168.1.22)
transmit(192.168.1.22)
receive(192.168.1.22)
transmit(192.168.1.22)
transmit(192.168.1.22)
transmit(192.168.1.22)
server 192.168.1.22, port 123
stratum 16, precision -6, leap 11, trust 000
refid [63.15.23.11], delay 0.03688, dispersion 24.00334
transmitted 4, in filter 4
reference time:      00000000.00000000  Thu, Feb  7 2036  7:28:16.000
originate timestamp: dc721745.3ff1b000  Tue, Mar 14 2017  8:16:21.249
transmit timestamp:  dc721746.3d08a000  Tue, Mar 14 2017  8:16:22.238
filter delay:  0.03688  0.05624  0.00000  0.00000
               0.00000  0.00000  0.00000  0.00000
filter offset: -0.00081 -0.00750 0.000000 0.000000
               0.000000 0.000000 0.000000 0.000000
delay 0.03688, dispersion 24.00334
offset -0.000812

14 Mar 08:16:23 ntpdate[64356890]: no server suitable for synchronization found
--------------------------------------------------------------------------

If you get the message ," no server suitable for synchronization found", verify xntpd is running on the server also verify that no firewalls are blocking port 123.

2. If the no server suitable for synchronization then you must specify the xntpd server in /etc/ntp.conf.

AIX:/>vi /etc/ntp.conf

server ntp.aix.in.com

Once you added the NTP server entry on client configuration file then restart the "xntpd" service again.

AIX:/>startsrc -s xntpd

3. If you want to start the xntpd service on boot time then you need to uncomment the below lines on the configuration file.

AIX:/>vi /etc/rc.tcpip

Unconmment the following line

start /usr/sbin/xntpd "$src-running"

4. Now verify the NTP server on client machine has been synchronized or not. Please use the same command which we used for checking the status.

AIX:/>lssrsc -ls xntpd

This time on the NTP client machine sys peer should display the IP Address or name of your "xntpd" server. As you know it is taking some time to synchronization so you must wait for time.

How to disable the SELinux in Linux machine

In this post, I will explain you the how to disable SELINUX on Redhat or CentOS Operating system. Before going to main work first we need to understand what is SELINUX and how its work on Linux enviorement.

Security-enhanced Linux (SELINUX): SELinux is know as Security enhanced linux system which is the security feature of the Linux kernel system. It is define the security Policy which makes system proctative agaginst the misconfiguration of the daemons. SELinux running in 3 modes which is disabled, enabled and permissive. We will explain these mode in configuration steps.

How to disable SELinux on Linux system:

1. In the first step you can check the current status of SELinux. To do this please run the below command.

[redhat]# getenforce
Enabled

"getenforce" command is used for checking the current status of SELinux.

2. As you see on my machine when I run the above command my SElinux is enabled, So in this step we will change the SELinux mode.

[redhat]# vi /etc/sysconfig/selinux

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

Normally selinux configuration file you can found on the above location. You can edit the SELINUX entry to disabled. All the command is run by super user "root" only.

3. Once you change the entry in SELinux configuration file then for permanent effect you need to take a reboot of the system.

[redhat]#init 6

Once you reboot the server all the configuration files changes has been done.

4. In the last step you will run the "getenforce" command again to verify the new status of SELinux.
[redhat]# getenforce
Disabled

If you comparison the both step 1 and this step output you can found that SELinux policy is not disabled on the Linux operating system.

Friday, March 10, 2017

How to mount CIFS file system on Linux Server

Hope you are doing well at your end. In this post, I will explain how we mount the CIFS file system on Linux operating system.

Normally on linux machine if we mount the any other linux machine folder is quite easiy in comparision to mount the window shared folder on linux machine. So let's going to final topic where i will explain step by step method to mount the CFS folder on Linux server.

Step by Step method for Mount CIFS on Linux Server:

1. In the initial step we will gather all rpm's or packages information which is required for CIFS file system.

redhat# rpm -qa | grep cifs 
cifs-utils-4.8.1-20.el6.x86_64

if you see the above output, this packages is required for CIFS file system on Linux system. So you can install this rpm using rpm command if you have rpm packages on the server otherwise you will install the packages using YUM utility.

redhat#rpm -ivh cifs-utils-4.8.1-20.el6.x86_64.rpm

if you are using YUM, then please install the packages using below command.

redhat#yum install cifs-utils*

it is installed all required dependency related to CIFS file system.

2. In this step, we will create the mount point on the server where we need to mount the CIFS file system.

redhat# mkdir -p /backup/cifs

We will create the above mount directory where i will mount the file system.

3. Now, we will create a CIFS user and assign a password so the user can access mount folder.

redhat# touch /etc/cifspasswd
redhat# chmod 600 /etc/cifspasswd

redhat#vi /etc/cifspasswd

user=castwebsvc
password=*******

4. In this step we need to make a permanent entry of mounted file system so once we reboot the machine mounted file system not umount.

redhat# vi /etc/fstab

ADD fstab entry :

//WindowsServer/share /mount/point cifs rw,mand,user=USER,password=PASS 0 0

Example :
//192.168.0.1/CAST_data4/AICCodeUpload  /backup/cifs cifs   rw,mand,credentials=/etc/cifspasswd         0 0

You can take an example for your system. Please change the mount point as per your requirement.

5. In the final step you need to mount the file system using below command.

redhat# mount /backup/cifs
redhat# mount -a

Using above command the CIFS file system has been mounted successfully.

How to configure NTP server and client on Solaris 10 and Solaris 11

In this post, I will describe the step by step method that how we will configure the NTP server and client on Solaris 10 and Solaris 11 Operating system. Network time protocol is most important part of any UNIX operating system. We will setup the NTP daemon on both the operating system but before moving to main point we will understand first NTP mechanism.

As you know NTP ( Network time Protocol) is one of the oldest internet protocol still in use and it allows the synchronization of computer clocks distributing UTC (Coordinated Universal Time) over the network.

NTP Service on Solaris 10 and Solaris 11:

Solaris 10 used the SMF utility (Service Management Facility) and the NTP service is now managed by SMF (Service Management Facility). NTP daemon configured using Service management facility (svc:/network/ntp:default) and a bunch of sample ntp.conf files to quickly configure a machine as a client or as a server. On Solaris 11 only ships with NTP v. 4, the NTP v. 4 service is identified by the name ntp4. You can check the ntp status using below command.

sun# svcs status ntp

STATE  STIME   FMRI
online 10:14:23 svc:/network/ntp:default

If you see the above command output it is shown that network time protocol services is enable and online on the server.

Steps for Configuring a NTP client:

Suppose your machine is just a client machine, then you can just take the /etc/inet/ntp.client file and copy it to /etc/inet/ntp.conf.

multicastclient 127.0.0.1

If you see the configuration it's a passive configuration for a Server host which listens for NTP server putting packets on the NTP multicast network, 127.0.0.1. If your machine is on LAN without NTP server then in that case we are not recveied any packet and for this we need to use Public NTP server for host.

In my case, I'm using the Indian pool in.pool.ntp.org and my configuration file contains:

server 2.in.pool.ntp.org
server 1.asia.pool.ntp.org
server 3.asia.pool.ntp.org

Normally NTP requires a poll period to elapse before starting synchronizing your clock. If you want NTP to start immediately, which you most probably will if you're configuring a desktop environment, you can take advantage of iburst keyword, introduced in NTP v. 4: it instructs NTP to start the synchronization almost right away.

server 2.in.pool.ntp.org ibrust
server 1.asia.pool.ntp.org ibrust
server 3.asia.pool.ntp.org ibrust

You must make sure you're configuring NTP implementation corresponding to the syntax you're using.

Setting up the drift file:

The last thing which is remaining for NTP server setup in the client machine is to set up  drift file location. On my machine it is 

driftfile /var/ntp/ntp.drift

After setup the drift file configuration we will start the NTP servivce again 

sun# svcadm restart svc:/network/ntp:default
sun# svcs status svc:/network/ntp:default
STATE  STIME   FMRI
online 12:20:12 svc:/network/ntp:default 

Once the service is running, you can check which server you're using with ntpq, Please run the below command to check the ntpq.

sun# ntpq -p

Setting up an NTP server:

Now in above step you see the NTP service has been started successfully, so now, you'll probably want to setup all of your machines.

If you're in a LAN, you can setup an internal NTP server which will provide data to other clients on your LAN. As before, you can take inspiration from the server configuration file shipped with Solaris 10 or Solaris 11, /etc/inet/ntp.server.

After setting up the drift file and the clients you're going to use, you can examine the other options and fine-tune them at your taste. Let's give a quick look at it.

server 127.127.XType.0

Now you have configured the NTP server properly. Please comment on the post if you have any suggestion.

Thursday, March 9, 2017

Solaris Package administration in Solaris 10

In this post, we will get the knowledage about the package administartion on Solaris operating system. As you aware that on solaris server the packages administration work is quite different from other Unix operating system. Solaris system has different architecture for this one.

So, we will discuss first which command is generally used on Solaris 10 server which are listed below.

pkginfo- It displays all software package information.
pkgadd- It installs all software packages to the system.
pkgrm- It removes a package from the system.
pkgchk- It checks package installation state.
pkgtrans- It translates packages from one server format to another.

Commands & Syntax for checking a package information:

For checking a packages information on Solaris 10 operating system we will used the "pkginfo" command. You can find the all command and syntax related to "pkginfo" is listed below.

  • Please use the below command to display information about installed software packages.

          sun# pkginfo | more

  • Please use the below command to view additional information.

          sun# pkginfo -l | more

  • Please use the below command to view information of a specific package.

          sun# pkginfo -l SUNWman

  • Please use the below command to find how many packages are currently installed.

          sun# pkginfo | wc -l

  • To list all installed software packages, please use the below command.

          sun# more /var/sadm/install/contents

These above commands with their syntax are daily used on Solaris 10 platform.

Commands & Syntax for checking a package installation:

For checking an information about packages are installed or not on the server , we need to use "pkgchk"  command. Please find the below example as describe below.

  • Please use the below command to check the contents & attributes of a currently installed package.

          sun# pkgchk SUNWpkgs

  • Please use the below command to list the all files contained in a software package.

          sun# pkgchk -v SUNWpkgs

  • Please use the below commands to find if the contents & attributes of a file have changed since it was installed with its software package.

          sun# pkgchk -p /etc/shadow  

  • Please use the below commands to list information about selected files that make up a package.

          sun# pkgchk -l -p /usr/bin/showrev

If the packages is installed already then in that case "pkgchk" command don't show any output that clear meaning is that packages is already installed on the server.

Commands & Syntax for adding a package software:

For adding a packages on the server, we will used the "pkgadd" command. Please find the below commands and their syntax which is daily used on Solaris operating system.

  • Please use the below command to add a software packages from DVD. For this you need to move on dvd directory where all the packages are listed.
          sun# pkgadd -d . SUNWpkgs

Using above command you can add the packages from DVD.

Commands & Syntax for removing a package software:

For removing the packages from the server, we will used "pkgrm" command. Please find the below commands and their syntax as listed below.

  • Please use the below command to remove the software packages.

          sun# pkgrm SUNWpkgs

  • Please use the below command to remove a package from the spool directory.

          sun# pkgrm -s /export/pkg SUNWldam

Commands & Syntax for translating a packages format:

For translating a packages format from one format to another , we will used the "pkgtrans" command for the same.

  • Please use the below command to translate a package from file system format in /var/tmp to data stream format.

          sun# pkgtrans /var/tmp /tmp/SUNWpkgs.pkg SUNWpkgs

  • Please use the below command to create a data streamed package.

          sun# pkgtrans -s Product /var/tmp/stream.pkg SUNWpkgg SUNWpkgs

 Using above commands and synatx we can easily translate their file format to stream format. If you have any doubt regarding this post please comment on the post.