Showing posts with label Solaris. Show all posts
Showing posts with label Solaris. Show all posts

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.

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.

How to enable SAR (System Activity Reporter) on Solaris Server

In this post, You can find the information one of the most important monitoring tool application on Solaris operating system. SAR (System Activity Reporter) is used to troubleshoot the performance issue on Sun Solaris Servers.

Using SAR (System Activity Reporter) we can troubleshoot or monitored the disk, memory or cpu performance issues on the Solaris operating system servers.

It is widely used performance tools for monitoring purpose but this utility also have some disadvantages. SAR utility consume lot of disk space when it is generated the report as well as /var file system space get increase rapidly.

Now in the below post we will step by step method to enable the SAR on Solaris Operating system.

Step by step procedure to enable SAR (System Activity Reporter):

1. In the first step we will check the current service status of SAR. To check this thing we will used below command which is mention below.

sun#svcs status sar
disabled        Mar_9  svc:/system/sar:default
or
sun#svcs -a | grep -i sar
disabled        Mar_9  svc:/system/sar:default

If you see the current status of SAR service it is disable. You can use both the above syntax to find out the current service status.

2.  As you seen in above step, the SAR service is disable on the Sun Solaris system so in this step we will enable it.

sun#svcadm enable svc:/system/sar:default

Check the status of service again as per below command.

sun# svcs status svc:/system/sar:default
enabled        Mar_9  svc:/system/sar:default

3.  Now in this step, we will make a setup for automatic data collection. Normally once we enable the services of SAR, the default script for SAR utility are located the below directory location.

/usr/lib/sa/sa1: This is a shell script to collect and store data in the binary file /var/adm/sa/sadd, where dd is the current day.

/usr/lib/sa/sa2: This is a  shell script for generating daily report in the file /var/adm/sa/sardd, where dd is current day.

As these above script are used normally to collect the automatically data from Solaris Server. If you required the daily report or weekly report then you need to add both the script in crontab file which is describe in next step.

4.  If you required the SAR report regularly then you need to make an entry of above script on the crontab file.

#crontab -e

Using these command you can edit the existing file and make an entry of above script according to your requirement when you want to generate the report.

Please comment on the post, if you have any issue related to this SAR post.

Wednesday, March 8, 2017

How to run Oracle Explorer on Sun Solaris 11

In this post I will explain how to run Oracle Explorer file on Solaris 11 operating system. Explorer files are used as a snapshot when we need to check all hardware issues or internal issue. The explorer files keeps all these information.

Oracle SUN Solaris explorer is a collection of scripts and binary executable files which collect all information and creates a detailed snapshot of Oracle Sun Solaris system configurations.

Oracle Sun Solaris Explorer is always installed on Global zone using root user which are running only Sun Sparc system and Solaris X86 systems as well as we are gathers information related to drivers, patches, recent system event history, and log file entries from the Oracle Explorer Data Collector output.

Before moving to run the explorer files we need to understand which packages is required to installed and configure the explorer files.

1. First we need to download the Service tools bundle from any ftp servers and extract them and run the script with extension syntax.

# ./install_stb.sh -ext

2. In this step we will uncompressed and untar the Explorer tar file using below command.

# cd /var/tmp/stb/extract/Explorer
# uncompress Explorer.tar.Z
# tar xvf Explorer.tar

3. In this step we will install Explorer packages and create directories "SUNWexplo" and "SUNWexplu" to install the required packages.

# pkgadd -d . SUNWexplo SUNWexpl

4. Now we will run the explorer command to obtained the logs files from the Sun Solaris system.

  #explorer
  
Normally on Solaris server the default location to run the above command is /usr/sbin/explorer which create & send the explorer log file.

If you want the create default configuration file only first time please use the below syntax.

  # explorer -g 

If you want to check explorer version please run the below command.

  # explorer -V
        
Normally in most of the Solaris server the default path of the explorer output is /var/explorer/output but it depends where you installed the Explorer.

Friday, March 3, 2017

NFS mount on Solaris 11 Non-Global zones

In this post, we would learn how we mount one folder from one Non-Global zone to another zone on Solaris 11 operating system.

As you know, in linux server it is less difficult in comparision to Solaris server. Here, I will take a two local zone "sun01" & "sun02". Let's take an example, we will mount one folder named "/export/backup" from "sun01" local zone to another zone "sun02" on "/project/export/data" location.

Step by Step method of NFS mount on Solaris 11:

1. In the first step we will create the directory on "sun02" zone where we want to mount the folder. 

sun02#mkdir /project/export/data

2. In second step, we will make a configuration for this process. So for this work you need to login on global zone with root access and make an entry on the dfstb configuration file.

sun#vi /etc/dfs/dfstab

share -F nfs -o rw=sun02 /zones/sun01/root/export

If you see the above entry, we have provided the read/write access to directory on sun02 server where we mount the folder from sun01 local zone.

3. In next step you need to login on sun02 server and mount the shared folder using below command.

sun02#mount sun:/zones/sun01/root/export/backup /project/export/data

4. Once you run the above command the folder is mount from one local zone to another zone temprarily. You can go to the directory and verify that the data which is listed on /export/backup folder is show on sun02 directory.

5. In the last step you need to restart the NFS service on the global zone so the configuration files and other changes makes affect. But these configuration are available until we are not taking reboot of the zone.

Please comment on the post, if you have any issue regarding the NFS mount sharing process. I will try to resolve such issue as soon as possible.

Sunday, February 26, 2017

zone: error: net0: failed to create VNIC: operation not supported

In this post, I will discuss with you one of the most interesting error which I am facing when I boot the local zone on Solaris 11.3. The description of this interesting issue as describe below.

Description of error:

sun# zoneadm -z sun01 boot

zone 'sun01': error: net0: failed to create VNIC: operation not supported

zoneadm: zone sun01: call to zoneadmd(1M) failed: zoneadmd(1M

I have try to create and configure the  VNIC on Solaris 11.3 operating server but it get failed with the same error.

sun#dladm create-vnic -l net0 vnic01

dladm: vnic creation failed: operation not supported

If you are also facing a such error while booting the local zone on solaris 11 server, then please use the below solution to resolve such issues.

Solution of error:

1. This error "failed to create VNIC: operation not supported" would normally come when there are not enough mac addresses to assign to the zone. So now we need to add alternate mac addresses to the network interface.So before adding the new mac address we will stop LDM.

sun#ldm list-domain

NAME            STATE     FLAGS  CONS   VCPU MEMORY  UTIL NORM UPTIME

primary         active    -n-cv- UART   8    8G      2.0% 2.0% 41d 20h 14m

0004fb0000060000ff1d3d8336112f6f active    -n---- 5001   50   64G     0.1% 0.1% 18h 23m

2. Now log in to the Solaris global zone and check if net0 have additional MAC addresses or not. Please use the below command to check the status.

sun# dladm show-phys -m

LINK               SLOT    ADDRESS           INUSE CLIENT

net0               primary 0:21:f6:d6:d3:e5  yes  net0

                   1       0:14:4f:f9:6d:8d  no   --

                   2       0:14:4f:fb:10:2b  no   --

                   3       0:14:4f:f9:41:d6  no   --

                   4       0:14:4f:f8:dd:c8  no   --

net1               primary 0:21:f6:51:be:4d  yes  net1

3. Now zone will start without any issue, as we have assigned the new mac address to this zone.

sun# zoneadm -z sun01 start

Hope, your issue related to this has been resolved after reading my post. Please let me know if you are facing any issue regarding this error.

How to create whole root zone on Solaris 11

In this post we will see how to install  zone on Solaris 11. In my last post regarding the zone creation you see the zone creation steps about Solaris 10.

Before going to main installation part we need to understand the basic installation methods difference between Solaris 10 & Solaris 11. 

In Solaris 10, we can’t install it without configuring repo on Solaris while in Solaris 11 ,first we need to create a  Solaris 11 repo , then we can install Solaris local zone. In Solaris 11, all the local zones by default uses exclusive ip address. You can’t set the IP address while configuring the zone. After the installation of zone, you can able to configure the IP from the local zone itself.

On my Solaris 11 machine I have already installed one local zone which is used for my R&D work so for this post work I need to install second local zone. So I will clone it from the first local zone.

Step by step method to create a zone on Solaris 11:-

1. In the first step we will create a new local zone. For the zone creation we will used "zonecfg" command and configure the zones as whole root zone without any options supplied.

#zonecfg -z sun02
sun02: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:sun> create
zonecfg:sun> info
zonename: sun02
zonepath:
brand: native
autoboot: false
bootargs:
pool:
limitpriv:
scheduling-class:
ip-type: shared
hostid:
zonecfg:sun> set zonepath=/zones/sun02
zonecfg:sun > add anet
zonecfg:sun:anet> set linkname=net0
zonecfg:sun:anet> end
zonecfg:sun > verfiy
zonecfg:sun > commit
zonecfg:sun > exit

In the above step, we will create a zne and set the zonepath. In my case my new solaris zone path is "/zones/sun02" in your case you can change your installation zone path. Here, I assign the network interface "net0" for this newly zone.

2. After successfully zone creation in above step 1, we will go for start the Solaris zone installation in this step. As I explained you for solaris 11 local zone installation we required solaris 11 repo which is used for installation part.

sun#zoneadm -z sun02 install
The following ZFS file system(s) have been created:
    rpool/zones/sun02
Progress being logged to /var/log/zones/zoneadm.30220110Z233232Z.sun02.install
       Image: Preparing at /zones/sun02/root.
 AI Manifest: /tmp/manifest.xml.F_ayqq
  SC Profile: /usr/share/auto_install/sc_profiles/enable_sci.xml
    Zonename: sun02
Installation: Starting ...
              Creating IPS image
Startup linked: 1/1 done
        Installing packages from:
solaris  origin:  http://localhost:1008/solaris/ce43f14c4791b5320596e2023cde1ec08709a3af/

DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
Completed                            183/183   33556/33556  222.2/222.2  139k/s

PHASE                                          ITEMS
Installing new actions                   46825/46825
Updating package state database               Done
Updating image state                          Done
Creating fast lookup database                 Done
Installation: Succeeded

Note:Man pages can be obtained by installing pkg:/system/manual done. Done: Installation completed in 2392.837 seconds.

Now our newly zone "sun02" has been installed successfully. All the configuration files are keep in /zones/sun02/root directory.

3. In this step we will boot the newly installed zone "sun02".

sun#zoneadm -z sun02 boot

You can check the status of zone that it is running or not after boot.

sun#zoneadm list -icv
ID NAME      STATUS     PATH          BRAND    IP
   0 global   running    /            solaris  shared
   1 sun01    running    /zones/sun01 solaris  excl
   3 sun02    running    /zones/sun02 solaris  excl

if you see the above output newly zone "sun02" is running working fine on the solaris 11 operating system.

4. Now in the next step, we will login on the local zone console to complete the configuration process.

sun# zlogin -C sun02
[Connected to zone 'sun02' console]

You can press enter when you will get this message. Now it is asking for some configuration step we need to give a details one by one.

Time Zone: Regions
select the region that contains your time zone.
Regions
UTC/GMT
Africa
Americas
Antarctica
Arctic Ocean
Asia
Atlantic Ocean
Australia
Europe
Indian Ocean
Pacific Ocean
F2_Continue  F3_Back  F6_Help  F9_Quit

Time Zone: Locations
Select the location that contains your time zone.
Locations
x Afghanistan
x Armenia
x Azerbaijan
x Bahrain
x Bangladesh
x Bhutan
x Brunei
x Cambodia
x China
x Cyprus
x East Timor
x Georgia
x Hong Kong
v India
F2_Continue  F3_Back  F6_Help  F9_Quit

Time Zone
Select your time zone.
Time Zones
Asia/Kolkata

F2_Continue  F3_Back  F6_Help  F9_Quit

System Configuration Summary
Review the settings below before continuing. Go back (F3) to make changes.

Time Zone: Asia/Kolkata
Language: *The following can be changed when logging in.
Default language: C/POSIX
Terminal type: vt100

Users:
No user account

Network:
Computer name: sun02
Network Configuration: Automatic

Support configuration:
Not generating a Support profile as OCM and ASR services are not installed.
Hostname: sun02

So now your zone is fully configured ans installed successfully. You can login in zone very easily. So in next step we will see the post configuration settings which is required on local solaris zone.

5. In the final step you need login to local zone sun02 and configured the ip address on the zone sun02.

sun#zlogin -z sun02

You can successfully login in your newly created solaris 11 zone. Please leave a comment if you have any doubt ,i will get back to you as soon as possible.

How to Create VNIC and Assign a IP Address on Solaris 11

Hello Friends,

In my old post, I described that how we will create a new local solaris zone on global zone. As you know every zone has their own networking but how it is works and configured we need to understand, So in this post, I will explain to you how to create a virtual network on Solaris 11 before zone creation.

For creating Virtual NIC and assigning fix static IP address in Solaris 11 we need to understand the basic difference between older version of Solaris and Solaris 11.

In Solaris 10, according to the NIC manufacturer,physical network interfaces are named as (Ex:bge,e1000g,nxge).But in Solaris 11 onwards,the names are hidden from the view and all the interfaces will be named as net0,net1…netx.

Before forward to main work we need to know that using which command we can check which interface has been mapped to physical interface. Using below command you can check all the network interface details.

sun01# dladm show-phys
LINK              MEDIA                STATE      SPEED  DUPLEX    DEVICE
net0              Ethernet             up         1000   full      bge001
net1              Ethernet             up         1000   full      bge002

If you want to show all dladm level devices,including VNIC’s & aggregation links,use the below command-

sun01# dladm show-link
LINK                CLASS     MTU    STATE    OVER
net0                phys      1500   up       --
net1                phys      1500   up       --

In Solaris 11,you can give a meaning full description(net1/oracle_VIP) to all the IP address on the system unlike Solaris 10. (e1000g1:2)

How to assigning new IP address to NIC:-

1. We can see how we assigned IP address to the physical interface, so in the first step we will check all the physical interface using below command.

sun01# dladm show-phys
LINK              MEDIA                STATE      SPEED  DUPLEX    DEVICE
net0              Ethernet             up         1000   full      bge001
net1              Ethernet             up         1000   full      bge002

2. In this step we would know how we will create a new interface so you can use the below command for this.

sun01# ipadm create-ip net1

3. This is the main step to assign the static ip address to the newly created interface net1. You can use below command or syntax to assign the fixed IP.

sun01#ipadm create-addr -T static -a local=10.135.0.2/24 net1

You can change your IP address accordingly. 

4. Now we will Verify whether IP address is configured or not which we assigned on above step.

sun01# ifconfig  net1
net1: flags=1000843 mtu 1500 index 7
        inet 10.135.0.2 netmask ffffff00 broadcast 10.135.0.255
        ether 0a:cB:12:8e:15:e2

If you see the above output, the new IP address is shown on net1 interface successfully. Using above all 4 steps you can know how we will assinged the static ip address to the sun solaris 11 operating system.

Now we will go for Virtual Network Interface creation steps.I can create N number of VNIC’s using single physical interface.These VNIC are treated as actual physical interface and possible to assign to local zones with  full access to it.

How to create a new VNIC using interface net2:-

1. In the initial steps I will run the same command to check out the all physical interface which is available on the Solaris 11 Server.

sun01# dladm show-phys
LINK              MEDIA                STATE      SPEED  DUPLEX    DEVICE
net0              Ethernet             up         1000   full      bge001
net1              Ethernet             up         1000   full      bge002
net2              Ethernet             unknown    1000   full      bge003

If you see the above command output network interface "net2" is in unknow state, So in the next step I will create a new VNIC using net2.

2. In this step we will create a new VNIC using net2. In my case i will suppose VNIC name “vnic01”, so for creating the new VNIC we will run the below command which describe below.

sun01#dladm create-vnic  -l net2 vnic01

3.Now, We will plumb the virtual interface and create a default IP to new VNIC.

sun01# dladm create-vnic  -l net2 vnic01
sun01# ipadm create-ip vnic01
sun01# ifconfig vnic01
vnic01: flags=1000842 mtu 1500 index 8
        inet 0.0.0.0 netmask 0
        ether 2c:18:10:Ce:1a:12

4. Now we will assign the new IP address to VNIC and verfif that new IP for vnic01 is configured or not.

sun01# ipadm create-addr -T static -a local=10.135.0.3/24 vnic01
sun01# ifconfig vnic01
vnic01: flags=1000843 mtu 1500 index 8
        inet 10.135.0.3 netmask ffffff00 broadcast 10.135.0.255
        ether 2c:18:10:Ce:1a:12

5. In the final step we will try to run snoop on VNIC which we have create now. You can verify through snooping is that VNIC01 is working fine or not.

sun01# snoop -d vnic01

The same way you can create a multiple VNIC and assign a new IP address to it. Hope you got some idea about Solaris 11 networking part after reading this post. Please let me know if you have any doubt regarding this post.

Thursday, February 23, 2017

Sun Solaris File System Management

If you are working on Sun Solaris operating system and wants to more grow up on this operating system, you definitely like my post because in this post I will explain you the most important thing file system management.

I will describe all the file systems command in this post which is generally used on all Solaris version operating system. Using these command you are more familiar about the file system management on Solaris server.

How to create a new file system on Solaris Server:-

We are using two type of file system (UFS & ZFS) on Solaris operating system. In this example we are taking UFS file system as for ZFS file system creation information you can found in my older post.

  • Create a new file system-
          sun01#newfs /dev/rdsk/c0d0s1
  • View minfree value-
          sun01#fstyp -v /dev/rdsk/c0d0s1 | head
  • Set minfree value for a new file system-
          sun01#newfs -m 2 /dev/dsk/c0d0s1
  • Change minfree value on an existing file system-
          sun01#tunefs -m 1 /dev/rdsk/c0d0s1

In the above my example, my hard disk name is c0d0s1.

How to Monitoring File System Usage on Solaris Server:-

In Sun Solaris Server , you must be aware about the capacity of file system. You can check file system usage using several commands.
  • Display the capacity of file systems in readable format-
          sun01#df -h
  • Display the disk allocation size in Kbytes-
         sun01#df -k
  • Display the available space on a device or disk-
         sun01#df -k /dev/dsk/c0d0s1
  • Display the disk usage in readable format-
          sun01#du -h /home
  • Display the disk usage including files-
          sun01#du -ak /home
  • Display the disk usage in summary format-
          sun01#du -sk /home

How to Checking or repair the File System on Solaris Server:-

We can repair and check the file system on Sun Solaris server. You can use the "fsck" command for this one but make sure you never run the fsck command on a mounted file system. You need umount file system first then run repair or check the Solaris file system.

  • Check or repair an unmounted filesystem-
           sun01#fsck /dev/rdsk/c0d0s1
  • Check or repair using the mount point directory-
          sun01#fsck /export/home 
  • To use a backup superblock number on Solaris server-
          sun01#fsck -o b=32 /dev/rdsk/c0d0s1 
  • To use an alternative superblock number-
          sun01#fsck -o b=518432 /dev/rdsk/c0d0s1

Hope, you are like my this post. Please comment on the post if you are facing any issue. I will try to resolve your issue as soon as possible.

How to change a disk in SVM Solaris volume manager

Hope you are doing well at your end. This post documentation explain how to change a disk in SVM ( Solaris volume manager).It means that we have mirrored the disk (RAID1) using SVM. Solaris Volume manager is basically used for creating, modifying & partitioning the different RAID partition.

In this post, I will take my sparc server machine. My Sun Sparc server consist 2 hard disk, let us assume the server has 2 hard disk: c0t0d0 and c0t1d0. We will assume c0t0d0 failed and need to be replaced.

Step by Step Method as described below:

1. In the initial step, we will find that which hard disk is down or faulty. To check this we will used "format" command.

sun01# format
       0. c0t0d0 <__drive type unknown__>
          /pci@0,600000/pci@0/pci@8/pci@0/scsi@1/sd@0,0
       1. c0t1d0 <SUN146G cyl 14087 alt 2 hd 24 sec 848>
          /pci@0,600000/pci@0/pci@8/pci@0/scsi@1/sd@1,0

If you see the "format" command output, we have two disk "c0t0d0,c0t1d0". Disk "c0t0d0" is in faulty state and it's down, You can see the drive type is in unknown state.

2. If you are running the "metastat" command you can see the status of hard disk which is show status in "need maintenance".

sun01# metastat    # will show status in "need maintenance"

        flags           first blk       block count
     a        u         16              8192            /dev/dsk/c0t0d0s7
     a        u         8208            8192            /dev/dsk/c0t0d0s7
     a    p  luo        16              8192            /dev/dsk/c0t1d0s7
     a    p  luo        8208            8192            /dev/dsk/c0t1d0s7

sun01# metadb -d c0t0d0s7
sun01# metadb

Using above command we delete metadb on failing disk and check that metadb on the other disk.

4. Now, we will unconfigure the corresponding disk which is down right now. This is the main step of this post so you can more careful while running the command which is given below.

sun01# cfgadm -al
sun01# cfgadm -f -c unconfigure c0::dsk/c0t0d0
sun01# cfgadm -al

Using cfgadm command we will unconfigure the c0t0d0 faulty hard disk so that we will replace the down hard disk in next step.

5. Now you can change the faulty disk to new one and reconfigure it again with same name.

sun01# cfgadm -c configure c0::dsk/c0t0d0
sun01# cfgadm -al

6. In this steo we will duplicate partitionning schema of first disk to the second and create metadb.

sun01# prtvtoc /dev/rdsk/c0t1d0s2 | fmthard -s - /dev/rdsk/c0t0d0s2
sun01# metadb -a -f -c2 /dev/dsk/c0t0d0s7

7. In second last step you will run all the below command for replacement of the failinf SVM partition.

sun01# metastat
sun01# metareplace -ef d4 c0t0d0s4
sun01# metareplace -ef d3 c0t0d0s3
sun01# metareplace -ef d1 c0t0d0s1
sun01# metareplace -ef d0 c0t0d0s0
sun01# metareplace -ef d5 c0t0d0s5
sun01# metareplace -ef d6 c0t0d0s6
sun01# metasync d0
sun01# metasync d1
sun01# metasync d3
sun01# metasync d4
sun01# metasync d5
sun01# metasync d6
sun01# metasync d7

8. In final step you need to make the disk bootable so that operating system will be boot on the mirror disk.

sun01# installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c0t0d0s0

Using this step you can make a disk bootable. I hope this post is useful for you. You are requested to please comment on the post if you have any issue, I will try to back you with my answer.

How to Remove a Non-Global Zone from Solaris Server

In this post, I will explain to you how to remove a Non-Global Zone from Solaris Server.

As you aware that Non-Global zone are hosted on Global zone on Solaris Operating system. You can check the Non-Global zone list using "zoneadm" command. It will show you are running and installed zones on Global zones.

Step by Step Method of removal a Non-Global Zone:

First of all you need to check the Non-Global Zone list to ensure which zone is running on the server.

global# zoneadm list -iv

You will see a display that is similar to the following:

ID  NAME     STATUS       PATH                           BRAND      IP
 0    global       running         /                                   solaris    shared
 1    sun01       running         /zones/sun01                solaris    shared

In the above command output you can see the Non-Global Zone "sun01" is running, which we need to remove or delete from Solaris Server.

Now, we need to shutdown the required zone which we need to delete. We can shutdown the Non-Global zone using below commands.
--------------------------------------------
global#zoneadm -z sun01 halt
or
global#zoneadm -z sun01 shutdown
or
global#zlogin sun01 shutdown
-------------------------------------------
In next step when your Non-Global zone shutdown you need to uninstall the local zone. You can used the below method to uninstall the Non-Global Zone.

global#zoneadm -z sun01 uninstall

Using above command Non-Global zone "sun01" has been uninstall successfully.

In the last step you need to remove or delete all dataset and configuration files of Non-Global zone "sun01" from Global zone.

global#zonecfg -z sun01 delete

Using above command all the configuration files related to this Non-Global zone has been deleted successfully. Now you can remove the folder related to this zone.

So using above method we can remove or delete the Non-Global zone from global zone or Solaris Operating system. Please let me know if you are facing any issue during using this process.

Monday, February 20, 2017

How to check Operating Systems Version is 64-bit or 32-Bit

Hello Friends,

In this post, you can see how we will check the operating system is 32 bit or 64 bit. Normally when we download any software on Unix platform they have dependency regarding the operating system version. So after following my this post you can easily get the information about the operating system version information.
When you work on Unix operating system then you must know the version of operating system. Because without getting exact version of OS, you can not install the packages on the Linux system.

Here, I mentioned the command and their output using these commands you can easily found the version of operating system. It is 32 bit or 64 bit.

Linux Operating System:

#uname –a
Linux vibhor 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

#uname  -m
x86_64

If the output has "x86_64",the environment is 64 bit.

Solaris Operating System:

#isainfo options

-v         Prints detailed information about the other options
-b         Prints the number of bits in the address space of the native instruction set.
-n         Prints the name of the native instruction set used by portable applications supported by the current version of the OS.
-k         Prints the name of the instruction set or sets that are used by the OS kernel components such as device drivers and STREAMS modules.

[vibhor]# isainfo -v

64-bit sparcv9 applications
        ima fmaf vis2 vis popc
32-bit sparc applications
        ima fmaf vis2 vis popc v8plus div32 mul32

[vibhor]# isainfo -b
64

[vibhor]#isainfo
sparcv9 sparc

The output for the above command should be sparcv9 sparc for a 64-bit operating System.

AIX Operating System:

vibhor:/> getconf -a | grep KERN
KERNEL_BITMODE:                         64

vibhor:/> bootinfo -y
64

The output of the above command should be 64 for a 64-bit hardware. The command must be executed as root.

Note: on AIX, the -y option will specify if the hardware is 32- or 64-bit mode while bootinfo -k will specify if the kernel is 32- or 64-bit (this command must be run as root).

HP-UX Operating system:
         
 hpx:/> getconf KERNEL_BITS
 64
         
The output of the above command should be 64 for a 64-bit operating system.

Monday, February 6, 2017

How to create local zone in Solaris 10

Hello Friends,

In this post, I will explain you how to create a new local zone on Sun Solaris operating system. Before describe the step by step installation and configuration method we need to understand what is zone and where it is used.

Basically Zone is a virtual operating system environment created within a single instance of the Solaris operating system. The mail goal of this technology is efficient resource utilization. We can create multiple zone on one Solaris operating system.
Solaris 10's zone partitioning technology can be used to create local zones that behave like virtual servers. All local zones are controlled from the system's global zone. Processes running in a zone are completely isolated from the rest of the system.


Note- That processes running in a local zone can be monitored from global zone but the processes running in a global zone or even in another local zone cannot be monitored from a local zone.

Global Zone: When we install the Solaris 10 operating system, a global zone gets installed automatically, and the core operating system runs under global zone as well as all the local zone are also runs on same global zone. Using "zoneadm" command we can check list of all configured zones which are running on Solaris operating system.


# zoneadm list -v

  ID NAME             STATUS         PATH
   0 global           running        /

Step by step method to create a Local Zone:

When we create a local Solaris zone on global zone , we have to complete some prerequisite before installing the zone.

Prerequisites:  A lot of disk space is required to installed the newly zone. It needs at least 3 GB space to copy the essentials files to the local zone. In my case I normally use 10 GB free disk space to installed the local zone. Also for configuration we required a dedicated IP for network connectivity.

1. First we will check the disk space and network configuration by using running below command.

[sun]# df -h /
 Filesystem             size   used  avail capacity  Mounted on
 /dev/dsk/c1t1d0s0       50G    22G   28G    46%    /

[sun] # ifconfig -a
 lo0: flags=2001000849 mtu 8232 index 1   
 inet 127.0.0.1 netmask ff000000  
 em0: flags=1000843 mtu 1500 index 2   
 inet 10.135.0.23 netmask fffffe00 broadcast 10.135.0.255

Here, if you see the "df -h" command output we can found that the disk "c1t1d0s0" is mounted on the root file system. Currently the total disk space size of root partition is approx 50 GB, as we required 10 GB free space for installation and configuration of local zone, so free space on root partition is sufficient for zone installation.

In "ifconfig" command output we can able to see the the ip address of global zone.

2. As we have sufficient space on the server so we can go ahead for local zone installation. First we need to create a directory where we want to install the zone. All the files is keep in this folder only.

[sun]# mkdir /zones

3. Next step is to define/create the zone root. This is the path to zone's root directory that is relative to the global zone's root directory. Zone root must be owned by root user with the mode 700. This will be used in setting the zonepath property, during the zone creation process.

[sun]# cd /zones[sun]# mkdir sun01[sun]# chmod -R 775 sun01[sun]# ls -l
 total 2
 drwx------   2 root     root         512 Feb 06 12:46 sun01

In a Sparse Root Zone, the directories /usr, /sbin, /lib and /platform will be mounted as loopback file systems. That is, although all those directories appear as normal directories under the sparse root zone, they will be mounted as read-only file systems. Any change to those directories in the global zone can be seen from the sparse root zone.


However if you need the ability to write into any of those directories listed above, you may need to configure a Whole Root Zone. For example, softwares like ClearCase need write permissions to /usr directory. In that case configuring a Whole Root Zone is the way to go. The steps for creating and configuring a new 'Whole Root' local zone are as follows:

4. In this step we will create & configure a new 'Sparse Root' local zone, with root privileges. For configuration of installed zone we will used "zonecfg" command. It is most widely used command for zone configuration.

[sun]# zonecfg -z sun01sun01: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:
sun01> create
zonecfg:
sun01> set zonepath=/zones/sun01
zonecfg:
sun01> set autoboot=true
zonecfg:
sun01> add net
zonecfg:
sun01:net> set physical=em0
zonecfg:
sun01:net> set address=10.135.0.24
zonecfg:
sun01:net> end
zonecfg:
sun01> add fs
zonecfg:
sun01:fs> set dir=/repo2
zonecfg:
sun01:fs> set special=/dev/dsk/c1t20d0s1
zonecfg:
sun01:fs> set raw=/dev/rdsk/c1t20d0s1
zonecfg:
sun01:fs> set type=ufs
zonecfg:
sun01:fs> set options noforcedirectio
zonecfg:
sun01:fs> end
zonecfg:
sun01> add inherit-pkg-dir
zonecfg:
sun01:inherit-pkg-dir> set dir=/opt/csw
zonecfg:
sun01:inherit-pkg-dir> end
zonecfg:
sun01> info
zonepath: /zones/
sun01
autoboot: true
pool:
inherit-pkg-dir:   dir: /lib
inherit-pkg-dir:   dir: /platform
inherit-pkg-dir:   dir: /sbin
inherit-pkg-dir:   dir: /usr
inherit-pkg-dir:   dir: /opt/csw
net: address: 
10.135.0.24
physical: 
em0
zonecfg:appserv> verify
zonecfg:appserv> commit
zonecfg:appserv> exit

4. Secondly we will create & configure a new 'Whole Root' local zone, with root privileges. In this again we will used the same zone name "sun01".

[sun]zonecfg -z sun01
sun01: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:
sun01> create
zonecfg:
sun01> set zonepath=/zones/sun01
zonecfg:
sun01> set autoboot=true
zonecfg:
sun01> add net
zonecfg:
sun01:net> set physical=em0
zonecfg:
sun01:net> set address=10.135.0.24
zonecfg:
sun01:net> end
zonecfg:
sun01> add inherit-pkg-dir
zonecfg:sun01:inherit-pkg-dir> set dir=/opt/csw
zonecfg:
sun01:inherit-pkg-dir> end
zonecfg:
sun01> remove inherit-pkg-dir dir=/usr
zonecfg:
sun01> remove inherit-pkg-dir dir=/sbin
zonecfg:
sun01> remove inherit-pkg-dir dir=/lib
zonecfg:
sun01> remove inherit-pkg-dir dir=/platform
zonecfg:
sun01> info
zonepath: /zones/
sun01
autoboot: true
pool:
inherit-pkg-dir:  dir: /opt/csw
net:  address: 
10.135.0.24
physical: 
em0
zonecfg:appserv> verify
zonecfg:appserv> commit
zonecfg:appserv> exit

Brief explanation of the properties that we added:

\* zonepath=/zones/sun01
Local zone's root directory, relative to global zone's root directory. ie., local zone will have all the bin, lib, usr, dev, net, etc, var, opt etc., directories physically under /zones/appserver directory

\* autoboot=true

boot this zone automatically when the global zone is booted

\* physical=em0

em0 card is used for the physical interface

\* address=10.135.0.24
10.135.0.24 is the IP address. It must have all necessary DNS entries

The whole add fs section adds the file system to the zone. In this example, the file system that is being exported to the zone is an existing UFS file system.

\* set dir=/repo2

/repo2 is the mount point in the local zone

\* set special=/dev/dsk/
c1t20d0s1 set raw=/dev/rdsk/c1t20d0s1

Grant access to the block (/dev/dsk/c1t20d0s1) and raw (/dev/rdsk/c1t20d0s1) devices so the file system can be mounted in the non-global zone. Make sure the block device is not mounted anywhere right before installing the non-global zone. Otherwise, the zone installation may fail with ERROR: file system check </usr/lib/fs/ufs/fsck> of </dev/rdsk/c2t40d1s6> failed: exit status <33>: run fsck manually. In that case, unmount the file system that is being exported, uninstall the partially installed zone (zoneadm -z <zone> uninstall) then install the zone from the scratch (no need to re-configure the zone, just do a re-install).

\* set type=ufs

The file system is of type UFS

\* set options noforcedirectio

Mount the file system with the option redirection.

\* dir=/opt/csw

Read-only path, will be lofs'd (loop back mounted) from global zone.

Note: it works for sparse root zone only -- whole root zone cannot have any shared file systems

Zonecfg commands verify and commit, verifies and commits the zone configuration for the zone, respectively. Note that it is not necessary to commit the zone configuration; it will be done automatically when we exit from zonecfg tool. info displays information about the current configuration

5. Now we will check the current state of the newly created/configured zone, for this we will use zoneadm command

[sun]# zoneadm list -cv
   ID NAME             STATUS         PATH
    0 global           running        /
    - sun01          configured     /zones/sun01

6. Next step is to install the configured zone "sun01". It takes a while to install the necessary packages
  
[sun]# zoneadm -z sun01 install 

The file contains a log of the zone installation. Once the zone installation is completed you can able to see the message on the installation window, all the required packages get installed during this installation.

7. Now verify the state of the sun01 zone

[sun]# zoneadm list -cv
   ID NAME             STATUS         PATH
    0 global           running        /
    - sun01          installed      /zones/sun01

8. In final step we will boot up the sun01 zone.

[sun]# zoneadm -z sun01 boot
zoneadm: zone 'sun01': WARNING: em0:1: no matching subnet found in netmasks(4) for 
10.135.0.24,using default of  255.0.0.0.

[sun]# zoneadm list -cv
   ID NAME             STATUS         PATH
    0 global           running        /
    1 sun01          running        /zones/sun01


9. Login to the Zone {console} and performing the internal zone configuration. zlogin utility can be used to login to a zone with -C option of zlogin can be used to log in to the Zone console.

[sun]# zlogin -C sun01

9.1. It is asking for some option when we run the above command. for language option you need to select the "English" option. Most probably it is "0" option in the menu.

9.2  After language option it is asking for locale. You need to set "English (c-7-bit ASCII) locale for Solaris 10 zone.

9.3  Enter the host name which identifies this system on the network.  The name must be unique within your domain; creating a duplicate host name will cause problems on the network after you install Solaris. A host name must have at least one character; it can contain letters, digits, and minus signs (-).

10. Now simply login to the newly created zone, just like connecting to any other system in the network.

Note: You can create another local zone using this same method. In this blog we get the idea how we will create the new zone on Solaris 10. The installation method on other Solaris operating system is different. This post is used for only zone creation on Solaris 10 only.