Thursday, March 15, 2012

Solaris live upgrade

Solaris live upgrade can be used not only to upgrade the OS but also it provides a easiest way to deploy the patch with the minimal downtime and better rollback approach.

Before you perform the live upgrade activity, install the latest live upgrade packages on your current OS and remove the old package which requires as  release of the live upgrade package must match the release of the OS you are upgrading to otherwise the live upgrade will fail

There are three packages which are to be reinstalled .

SUNWluu, SUNWlur and SUNWlucfg
# pkgrm SUNWlucfg SUNWluu SUNWlur
 
and while installing the package it has to be in the following order

#pkgadd -d path_to_packages SUNWlucfg SUNWlur SUNWluu

The above steps can be performed by running liveupgrade10 utility which is available under Tools/Installer directory on your CDROM

I have another spare disk where i am going to perform the live upgrade. Below is the output of format output

       0. c1t0d0
          /pci@0,0/pci15ad,1976@10/sd@0,0
       1. c1t1d0
          /pci@0,0/pci15ad,1976@10/sd@1,0


Active disk is c1t0d0 so i am going to perform the 
upgrade on the second disk c1t1d0.

Steps1 : Create the partition table as it is on c1t0d0
         prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2

Below is the output of df -h 

/dev/dsk/c1t0d0s0      7.7G   3.0G   4.7G    39%    /
/dev/dsk/c1t0d0s5      3.8G    69M   3.7G     2%    /var
/dev/dsk/c1t0d0s6      4.8G   2.5G   2.3G    52%    /opt
/dev/dsk/c1t0d0s7      1.9G   2.0M   1.8G     1%    /opt/support



Steps 2: Once the disk is ready, create alternate boot environment
#lucreate -c Solaris10-9 -n Solaris10-10 -m /:/dev/dsk/c1t1d0s0:ufs -m -:/dev/dsk/c1t1d0s1:swap -m /var:/dev/dsk/c1t1d0s5:ufs -m /opt:/dev/dsk/c1t1d0s6:ufs -m /opt/support:/dev/dsk/c1t1d0s7:ufs

Steps 3: With the above steps you have alternate boot environment, now its turn to upgrade the ABE(Alternate Boot Environment)





Solaris live upgrade

Solaris live upgrade can be used not only to upgrade the OS but also it provides a easiest way to deploy the patch with the minimal downtime and better rollback approach.

Before you perform the live upgrade activity, install the latest live upgrade packages on your current OS and remove the old package which requires as  release of the live upgrade package must match the release of the OS you are upgrading to otherwise the live upgrade will fail

There are three packages which are to be reinstalled .

SUNWluu, SUNWlur and SUNWlucfg
# pkgrm SUNWlucfg SUNWluu SUNWlur
 
and while installing the package it has to be in the following order

#pkgadd -d path_to_packages SUNWlucfg SUNWlur SUNWluu

The above steps can be performed by running liveupgrade10 utility which is available under Tools/Installer directory on your CDROM

I have another spare disk where i am going to perform the live upgrade. Below is the output of format output

       0. c1t0d0
          /pci@0,0/pci15ad,1976@10/sd@0,0
       1. c1t1d0
          /pci@0,0/pci15ad,1976@10/sd@1,0


Active disk is c1t0d0 so i am going to perform the 
upgrade on the second disk c1t1d0.

Steps1 : Create the partition table as it is on c1t0d0
         prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2

Below is the output of df -h 

/dev/dsk/c1t0d0s0      7.7G   3.0G   4.7G    39%    /
/dev/dsk/c1t0d0s5      3.8G    69M   3.7G     2%    /var
/dev/dsk/c1t0d0s6      4.8G   2.5G   2.3G    52%    /opt
/dev/dsk/c1t0d0s7      1.9G   2.0M   1.8G     1%    /opt/support



Steps 2: Once the disk is ready, create alternate boot environment
#lucreate -c Solaris10-9 -n Solaris10-10 -m /:/dev/dsk/c1t1d0s0:ufs -m -:/dev/dsk/c1t1d0s1:swap -m /var:/dev/dsk/c1t1d0s5:ufs -m /opt:/dev/dsk/c1t1d0s6:ufs -m /opt/support:/dev/dsk/c1t1d0s7:ufs

Steps 3: With the above steps you have alternate boot environment, now its turn to upgrade the ABE(Alternate Boot Environment)





Tuesday, March 13, 2012

Jumstart server configuration

Easy way to set up a jumpstart server

share -F nfs -o ro,anon=0 /export/install

1. Setting up a install server

#cd /cdrom/cdrom0/s0/Solaris_2.7/Tools
#./setup_install_server /export/install

2. Setting up a boot server

# ./setup_install_server -b /export/install sun4u

3. Create the rule files

Create a directory which will holds the rules file

#mkdir /jumpstart

Copy the sample configuration files to /jumpstart directory

#cp –r /cdrom/Solaris_2.7/Misc/* /jumpstart

Edit the rule files

There are various rules are available, below is the example of simple rules

any – - any_machine -

The above rules matches any machine and redirect the install request to a profile called any_machine
ceck the rules using the check script

#/check - which will create rules.ok file


4. Create a profile file which contains the configuration information for the client

In the previous section of creating rules, i mentioned the profile name as any_machine so create a file of same name


#vi any_machine

install_type initial_install

system_type server

partitioning explicit

filesys c0t0d0s0 500 /

filesys c0t0d0s1 1000 swap

filesys c0t0d0s3 1000 /usr

filesys c0t0d0s4 1000 /var

filesys c0t0d0s5 1000 /opt

cluster SUNWCall add

5. Create sysidcfg file which contains basic system idenfication information which you need to provide while booting the machine for the first time after installation
. So create this file to avoid the installation goes into interactive mode

# vi sysidcfg

system_locale=en_US

install_locale=en_US

timeserver=localhost

timezone=US/Pacific

network_interface=hme0 {netmask=255.255.255.0}

name_service=NONE

6. Update the /etc/ethers file with the MAC address followed by hostname

#vi /etc/ethers

8:00:50:44:88:12 mercury

Note : Get the MAC address by running banner command at the OK prompt

7. Adding Client
#cd /export/install/Solaris_2.7/Tools
#./add_install_client -e 8:00:50:44:88:12 -s jupiter:/export/install -c jupiter:/jumpstart -p jupiter:/jumpstart mercury sun4u

-e specify the ethernet address of client -s option specify the location of boot image ( As given in setup_install_server)

-c option specify the jumpstart directory path.

-p option specify the sysidcfg file location

jupiter is your jumpstart server

mercury is jumpstart client to be installed.

sun4u is the architecture of client

You need to enter the client through above command at the boot server also

8. Starting the client installation

ok>boot net – install












Jumstart server configuration

Easy way to set up a jumpstart server

share -F nfs -o ro,anon=0 /export/install

1. Setting up a install server

#cd /cdrom/cdrom0/s0/Solaris_2.7/Tools
#./setup_install_server /export/install

2. Setting up a boot server

# ./setup_install_server -b /export/install sun4u

3. Create the rule files

Create a directory which will holds the rules file

#mkdir /jumpstart

Copy the sample configuration files to /jumpstart directory

#cp –r /cdrom/Solaris_2.7/Misc/* /jumpstart

Edit the rule files

There are various rules are available, below is the example of simple rules

any – - any_machine -

The above rules matches any machine and redirect the install request to a profile called any_machine
ceck the rules using the check script

#/check - which will create rules.ok file


4. Create a profile file which contains the configuration information for the client

In the previous section of creating rules, i mentioned the profile name as any_machine so create a file of same name


#vi any_machine

install_type initial_install

system_type server

partitioning explicit

filesys c0t0d0s0 500 /

filesys c0t0d0s1 1000 swap

filesys c0t0d0s3 1000 /usr

filesys c0t0d0s4 1000 /var

filesys c0t0d0s5 1000 /opt

cluster SUNWCall add

5. Create sysidcfg file which contains basic system idenfication information which you need to provide while booting the machine for the first time after installation
. So create this file to avoid the installation goes into interactive mode

# vi sysidcfg

system_locale=en_US

install_locale=en_US

timeserver=localhost

timezone=US/Pacific

network_interface=hme0 {netmask=255.255.255.0}

name_service=NONE

6. Update the /etc/ethers file with the MAC address followed by hostname

#vi /etc/ethers

8:00:50:44:88:12 mercury

Note : Get the MAC address by running banner command at the OK prompt

7. Adding Client
#cd /export/install/Solaris_2.7/Tools
#./add_install_client -e 8:00:50:44:88:12 -s jupiter:/export/install -c jupiter:/jumpstart -p jupiter:/jumpstart mercury sun4u

-e specify the ethernet address of client -s option specify the location of boot image ( As given in setup_install_server)

-c option specify the jumpstart directory path.

-p option specify the sysidcfg file location

jupiter is your jumpstart server

mercury is jumpstart client to be installed.

sun4u is the architecture of client

You need to enter the client through above command at the boot server also

8. Starting the client installation

ok>boot net – install












Monday, March 5, 2012

Restore a Solaris OS

Procedure 1 using ufsrestore:

Follow the following steps if you already have the OS backup taken using ufsdump

Step 1: Boot the OS into single user mod

               ok> boot cdrom -s
step 2: Create the same partition as original disk and create the filesystem
 
             #newfs /dev/rdsk/c1t0d0s0
step 3: Mount the filesystem
            
            # mount /dev/dsk/c1t1d0s0 /a

step 4: Verify whether the tape is configured

           # mt status or mt -f /dev/rmt/0 status 

Note : If the tape is not recognized by the OS run the following commands
 # devfsadm -C

or
# devfsadm -c tape
or
# drvconfig; tapes; devlinks

Step 5:Rewind the tape
  #mt rewind

Step 6:

cd to the directory which needs to be restored

cd /a
ufsrestore /dev/rmt/0n

Step 7 :

Install the bootloader

#installboot /a/usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c1t0d0s0

You are good to reboot your machine

Restore a Solaris OS

Procedure 1 using ufsrestore:

Follow the following steps if you already have the OS backup taken using ufsdump

Step 1: Boot the OS into single user mod

               ok> boot cdrom -s
step 2: Create the same partition as original disk and create the filesystem
 
             #newfs /dev/rdsk/c1t0d0s0
step 3: Mount the filesystem
            
            # mount /dev/dsk/c1t1d0s0 /a

step 4: Verify whether the tape is configured

           # mt status or mt -f /dev/rmt/0 status 

Note : If the tape is not recognized by the OS run the following commands
 # devfsadm -C

or
# devfsadm -c tape
or
# drvconfig; tapes; devlinks

Step 5:Rewind the tape
  #mt rewind

Step 6:

cd to the directory which needs to be restored

cd /a
ufsrestore /dev/rmt/0n

Step 7 :

Install the bootloader

#installboot /a/usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c1t0d0s0

You are good to reboot your machine

Saturday, March 3, 2012

Important links - Solaris

Important links - Solaris

Solaris commands

1. awk

Need to print the ufs filesystem listed in /etc/vfstab file

awk '($4 == "ufs") | printf("%s %s\n", $1, $3) }' /etc/vfstab

The above command will print filesystems which are commented as well. To print only the active filesystem, use the following commands

awk '(!/^#/ && $4 == "ufs") { printf("%s %s\n", $1, $3) }' /etc/vfstab

!/^#/ - ignore all the commented lines $4 - is the fourth column in the /etc/vfstab file

Solaris commands

1. awk

Need to print the ufs filesystem listed in /etc/vfstab file

awk '($4 == "ufs") | printf("%s %s\n", $1, $3) }' /etc/vfstab

The above command will print filesystems which are commented as well. To print only the active filesystem, use the following commands

awk '(!/^#/ && $4 == "ufs") { printf("%s %s\n", $1, $3) }' /etc/vfstab

!/^#/ - ignore all the commented lines $4 - is the fourth column in the /etc/vfstab file


ls -ltr | awk 'BEGIN {print "File \t Owner"} {print $3 "\t" $9} END {print "-----Done-----" }'