Friday, December 17, 2010

HP-UX Kernel

Kernel files are stored under /stand.

Commands :

1. To display detailed information about a kernel module :
# kcmodule -v autofs

2. To load a module :
# kcmodule autofs=best

3. To unload a module :
# kcmodule autofs=unused

4. To view the values of tunables :
# kctune acctresume

5. To view the values of tunables with description :
# kctune -d acctresume

6. To view the values of tunables with detailed information :
# kctune -v acctresume

7. To change a tunable's value to the default :
# kctune nproc=Default

8. To change the value of a tunable :
 # kctune nproc=3500

9. To view the list of module changes  for next boot :
# kcmodule -D

10. To view the list of tunable changes  for next boot :
# kctune -D

11. To view the list of module and tunable changes  for next boot :
# kconfig -D

12. To view the list of module settings that are set to non-default :
# kcmodule -S

13. To view the list of tunable settings that are set to non-default :
# kctune -S

14. To view the list of module and tunable settings that are set to non-default :
# kconfig -S

15. To unhold all the module and tunable settings being held for next boot :
# kconfig -H











Points to remember :

Different states of kernel modules :
unused         -  This module is not used, but installed in the system.
static            -  This module will be statically bound to the kernel executable
loaded         -  This module will be dynamically bound to the kernel while booting
auto             -  The module will be dynamically loaded into the kernel when it is first needed after each boot.

NFS in HP-UX

There has been a vast difference between HP-UX 11i v3 with the older versions.Prior to v3, HP-UX used NFS concepts (commands and files) a like AIx. From v3, it following Solaris-like environment.

Configuration Files :

/etc/exports                  -  Contains a list of exportable file systems. This file is available in upto HP-UX 11i v2
/etc/dfs/dfstab               - Contains a list of sharable file systems. This file is available from HP-UX 11i v3 
/etc/rc.config.d/nfsconf  - NFS server configuration file contains the nfs, autofs and mountd daemons startup


Command :

1.  To start NFS server daemons :
# /sbin/init.d/nfs.server start

2. To stop NFS server daemons :
# /sbin/init.d/nfs.server stop

3. To start NFS daemons on system boot,
Change the value of NFS_SERVER to "1" in /etc/rc.config.d/nfsconfig file.


For Ex,
NFS_SERVER=1
4. To export or share a file system :
# exportfs /data         <--- Upto HP-UX 11i v2
# share     /data         <--- From HP-UX 11i v3

5. To unexport or unshaer a file system :
# exportfs -u /data         <--- Upto HP-UX 11i v2
# unshare     /data          <--- From HP-UX 11i v3

6. To export or share all the filesystems defined in /etc/exports or /etc/dfs/dfstab :
# exportfs -a         <--- Upto HP-UX 11i v2
# shareall              <--- From HP-UX 11i v3

Network Configuration in HP-UX

Configuration File :
/etc/rc.config.d/netconf        -  Contains the hostname, ip address, default route
/etc/hosts                            -  Contains the hsotname to IP address mapping
/etc/resolv.conf                   -  Contains DNS server details
/etc/inetd.conf                     - Internet daemon configuration file

Configuration Files used for DNS Client:
/etc/nsswitch.compat
/etc/nsswitch.nis
/etc/nsswitch.ldap
/etc/nsswitch.conf
/etc/nsswitch.files
/etc/nsswitch.hp_defaults

Scripts :
/sbin/init.d/net start  - To start network services
/sbin/init.d/net stop  - To stop network services

Commands :

1. To set the hostname :
# set_parms hostname

2. To set primary ip address :
# set_parms ip_address

3.  To set the default gateway, DNS/NIS server details :
# set_parms addl_netwrk

4.  To restart inetd daemon :
# inetd -c

5. To display the ip address configuration details :
# netstat -i

6. To set the IP details of lan0 :
# ifconfig lan0

7. To display all the network adapters :
# lanscan

8. To display routing table :
# netstat -rn

9. To add a route :
# route add default 192.168.1.254 1

10. To enable a network interface :
# ifconfig lan0 up

11. To disable a network interface :
# ifconfig lan0 down

12. To change NIC settings like speed, duplex,..
# lanadmin

Thursday, December 9, 2010

Managing vPars in SuperDome 2

1. To start a vpar from MON> prompt,

MON> vparload -p vPar_name

2. To boot a vpar from command line,

# vparload -p vPar_name

3. To show vpar info from MO> prompt,

MON> vparinfo

4. To show vpar status from command prompt,
# vparstatus

Under Construction.

Managing nPartitions in SuperDome 2

Following commands are to executed by logging (telnet/h) into Onboard Administrator's CLI.

1. To display all the blades and enclosures in a superdome 2 machine,
>  parstatus

2. To display all the nPars,
> parstatus -P

3. To allow an operating system running in a npar to perform partition configuration operations on other partitions,
> parperm npar on 1

4. To create a nPar using blade 1/2 and IO bay 5/1,
> parcreate -P nPar0002 -a blade:1/2:::: -a io:5/1::

5. To create a nPar using blades 1 and 3 from enclosure 1 and IO lot in IOX enclosure 5, bay 1,
> parcreate -p nextPartition -a blade:1/1:::: -a blade:1/3:::: -a io:5/1:

6. To display the details on a specific nPar,
> parstatus –Vp1
or
> parstatus –Vp nPar0001

7. To remove a nPar,
> parremove -p 2
or
> parremove -p nPar0002

8. To rename a nPar,
> parmodify -p1 -PnPar0005

9. To add the blade in enclosure 1, slot 5 to the existing nPartition 1,
> parmodify -p 1 -a blade:1/5:base:y:ri:50%

10. To add I/O bay 2 in enclosure 3 to the existing nPartition3,
> parmodify -p 3 -a io:3/2:

11 To remove the blade in enclosure 1, slot 5 from nPartition 1,
> parmodify -p 1 -d blade:1/5

12. To remove I/O bay 2 in enclosure3 from nPartition3,
> parmodify -p 3 -d io:3/2

 13. To power on nPar ID 1,
> poweron partition 1

Note: You can also use the legacy bo or pe command(menu based) to power on a nPartition.

14. To view the powr status of nPars,
> parstatus -P

15. To open the console of nPartition id 1,
> connect partition 1

Note: You can also use the legacy co command to get the console.

16.

Superdome OA - User Management commands

1. Add user,
ADD USER jack password

2. Disable User,
DISABLE USER jack

3. Enable User,
ENALE USER jack

4. Remove User,
REMOVE USER jack

5. Show History,
HISTORY

6. Set paword for the currently logged in user id,
SET PASSWORD

7. To set admin priviliage to an user,
SET USER ACCESS jack ADMINISTRATOR

HP BLADE MANAGEMENT COMMANDS

1. To open the console of a blade,
> CONNECT BLADE bay_number

2. To poweroff all the blades,
> POWEROFF BLADE ALL

3. To poweroff a specific blade,
> POWEROFF BLADE bay_number

4. To forcefully poweroff a specific blade,
> POWEROFF BLADE bay_number FORCE

5. To poweron all the blades,
> POWERON BLADE ALL

6. To poweron a specific blade,
> POWERON BLADE bay_number

7. To Reboot all the blades,
> REBOOT BLADE ALL

8. To Reboot a specific blade,
> REBOOT BLADE bay_number

9. To Forcefully Reboot a specific blade,
> REBOOT BLADE bay_number FORCE

10. To set hard disk as the bootdevice for the next boot of the blade,
> SET BLADE ONCE HDD bay_number

11. To set PXE (N/w) as the bootdevice for the next boot of the blade,
> SET BLADE ONCE PXE bay_number

12. To set hard disk as the bootdevice for he blade,
> SET BLADE ONCE HDD bay_number

13. To set PXE (N/w) as the bootdevice for the blade,
> SET BLADE ONCE PXE bay_number

14. To turn on/off the Blade UID LED,
> SET BLADE UID ALL ON
> SET BLADE UID bay_number OFF

15. To show the boot settings for a specific blade,
> SHOW BLADE BOOT bay_number

16. To show the blade information,
> SHOW BLADE INFO bay_number

17. To show the list of blades,
> SHOW BLADE LIST

18. To show the blade names,
> SHOW BLADE NAMES

19. To show the blade status of bay number 2,
> SHOW BLADE STATUS 2

20. To show the blade temperature of bay 2,
> SHOW BLADE TEMP 2

21. To show syslog of bay 2,
> SHOW SYSLOG BLADE 2

Thursday, August 5, 2010

Device Management

All the devices are communicated by HP-UX using their device files which are located under /dev directory. Basically each device will have 2 type of device file - block and character(raw) device files. Most of the devices and their device files are configured automatically during the system boot. At the time of boot, HP-UX probes  all devices and executes /sbin/ioinit.rc script to create new device files if needed. If any device file is not created you can always create them manually using some commands.

How to list and identify various devices connected to your system ?

1. To show all the configured devices:
# ioscan -f

2. To list the available disk/CD Drives along with their device file details:
# ioscan -funC disk

3. To list the tape drives:
# ioscan -funC tape

4. To list the lan adapters:
# ioscan -funC lan

5. To show the details of a device file:
# lssf /dev/rmt/c2t0d0BEST

How to configure newly connected devices ?

To configured the recently connected tape drive:

# insf -C tape

Same way to configure newly connected CDrom or disk,
# insf -C disk


This is similar to devfsadm in solaris and cfgmgr in AIX. It will configure new devices but not the already configured devices.

How to create specific device file if you have accidentally deleted any of them ?

1. To create the device file for a CD-ROM which is attached to hardware path 0.2.0 :
# insf -H 0.2.0 -e

2. To create a raw (character) device file for a disk attached to hardware address 1.2.0 :
# mksf -H 1.2.0 -r

3. To create a block device file for a disk attached to hardware addres 1.2.0 :
# mksf -H 1.2.0 -b

4. To create raw device file for a device with major number 243 and minor number 0x040012 :
# mknod /dev/rmt/1m c 243 0x040012

5. To create block device file for a device with major number 243 and minor number 0x040012 :
# mknod /dev/rmt/1m b 243 0x040012

Thursday, January 28, 2010

HP Service Guard Cluster

How to setup a Two-Node cluster:

1. Modify /etc/hosts on both the nodes to include stationary and heartbeat IP addresses.

2. Create volume groups, logical volumes, filesystems on the first node and then import on the second node

3. Configure /.rhosts & /etc/cmcluster/cmclnodelist on both the nodes
Example:
/.rhosts
node1 root
node2 root

/etc/cmcluster/cmclnodelist
node1 root
node2 root

4. Configure stationary and heartbeat IP addresses on both the nodes

    a. Modify /etc/rc.config.d/netconf
    b. /sbin/init.d/net stop
    c. /sbin/init.d/net start

5. Modify /etc/lvmrc to disable auto-activation of volume groups

6. Create the cluster configuration file on the first node
# cmquerycl -v -C /etc/cmcluster/mycluster.conf -n node1 -n node2


7. Modify the configuration file include your needs

8. Verify the configuration file

# cmcheckconf -v -C /etc/clcluster/mycluster.conf

9. Create the cluster binary file and distribute to all the nodes across the cluster
# cmapplyconf -v -C /etc/clcluster/mycluster.conf

10. To view the cluster configuration
# cmviewcl -v

11. Start the cluster
# cmruncl -v

12. Halt the cluster
# cmhaltcl -v

13. You're done.

Execution sequence for starting a package :

1. Master control script
2. External pre-scripts
3. Volume Groups
4. File Systems
5. Package IPs
6. External Scripts
7. Services


Frequently used commands :

To start the entire cluster : # cmruncl –v

To stop the entire cluster : # cmhaltcl

To view the status of cluster : # cmviewcl

To view the cluster, node, package status : # cmviewcl -v

To start a node in the cluster : # cmrunnode -v nodename

To stop a node in the cluster : # cmhaltnode -f -v nodename

To see the configuration : # cmgetconf -C config_name

To start a package : # cmrunpkg pkg1

To start a package on a node : # cmrunpkg -n ndoename pkg1

To halt a package : # cmhaltpkg pkg1


Configuration Files :-

/etc/cmcluster/cmclnodelist – Contains the list of nodes in the cluster

/etc/cmcluster/cluster_config.ascii - cluster configuration file.

/etc/cmcluster/package_name/package_config.ascii - package configuration file

/etc/cmcluster/package_name/package.cntl - package control script

Tuesday, January 5, 2010

LVM - Logical Volume

Naming Convention:

Logical Volume's can have a name of max. 255 chars.
It can be assigned by the admin or done by the system.
Default names of the form /dev/vgxx/lvoln (for block device) and /dev/vgxx/rlvoln (for raw device).

Few Points to remember :

1. A logical volume can be used for swap, dump, raw data or a file system.

Here are the mostly used commands for managing LV's :

To create a LV :
# lvcreate

To change the characteristics of a LV :
# lvchange

To display info about LVs :
# lvdisplay

To increase the size of a LV :
# lvextend

To decrease the size of a LV :
# lvreduce

To remove a LV :
# lvremove

To prepare a LV to be a root, primary swap or dump volume, updating the boot info on a boot PV :
# lvlnboot

To remove the link that makes a LV a root, primary swap or dump volume :
# lvrmboot

To split a mirrored LV into 2 LVs :
# lvsplit

To merge 2 LVs into 1 mirrored LV :
# lvmerge

To sync the mirrored copies of a mirrored LV :
# lvsync

Few Examples,

1. To display the properties of a LV :

# lvdisplay /dev/vg01/lvol8

2. To display the detailed properties of a LV :

# lvdisplay -v /dev/vg01/lvol8

3. To create a LV of size 100MB in vg01 :

# lvcreate -L 100 /dev/vg01

4. To create a LV named myvol in vg01 of size 100MB :

# lvcreate -n myvol -L 100 /dev/vg01

5. To extend the size of a LV to 200MB :

# lvextend -L 200 /dev/vg01/lvol8

6. To extend the size of a LV by 12 LE's from disk8 :

# lvextend -l 12 /dev/vg01/myvol /dev/disk/disk8

7. To extend the size of a LV to 120MB by taking space from disk8 :

# lvextend -L 120 /dev/vg01/myvol /dev/disk/disk8

8. To list out the processes using a LV :

# fuser -cu /dev/vg01/myvol

9. To add additional copy (mirror) for a LV :

# lvextend -m 1 /dev/vg01/myvol

10. To do the same as above but using a specific PV :

# lvextend -m 1 /dev/vg01/myvol /dev/disk/disk9

11. To remove the mirror copies from a LV :

# lvreduce -m 0 /dev/vg01/myvol
This will remove all the mirror copies. I mean only the original copy is left on the LV.

12. To do the same as above but mentioning a specific PV where to remove the copy :

# lvreduce -m 0 /dev/vg01/myvol /dev/disk/disk9

13. To rename a LV :

a. Rename both the block and raw device files of the LV :

# mv /dev/vg01/myvol /dev/vg01/newvol
# mv /dev/vg01/rmyvol /dev/vg01/rnewvol

b. Finally change the lv names in other config files like /etc/fstab

14. To remove a logical volume :

First of all make sure the LV is not in use.I mean if it got any file system, then unmount the file system.
Then remove the lv using the below command.

# lvremove /dev/vg01/myvol

LVM - Physical Volume

Naming Convention:

Here is a set of examples for pv naming convention.

/dev/disk/disk1 - Persistent block device file for disk1

/dev/disk/disk1_p1 - Persistent block device file for partition 2 belonging to disk1

/dev/rdisk/disk1 - Persistent character/raw device file for disk1

/dev/rdisk/disk1 - Persistent character/raw device file for partition 2 belonging to disk1

/dev/dsk/c1t1d1 - Legacy block device file for disk1 located in target 1 of controller 1

/dev/dsk/c1t1d1s1 - Legacy block device file for the partition 1 belonging to the above disk

/dev/rdsk/c1t1d1 - Legacy character/raw device file for disk1 located in target 1 of controller 1

/dev/rdsk/c1t1d1s1 - Legacy character/raw device file for the partition 1 belonging to the above disk

Here are the mostly used commands for managing PV's :

To create a PV:
# pvcreate

To change the characteristics :
# pvchange

To display the info on PV :
# pvdisplay

To move data between PVs :
# pvmove

To remove a PV from LVM control :
# pvremove

To check or repair a PV :
# pvck

To check if a disk is under LVM control :
# lvmchk

Few Examples,

1. To initialize a disk for LVM [ To create a PV out of a disk] :

# pvcreate /dev/rdisk/disk12

2. To initialize a disk for LVM to use as a boot device :

# pvcreate -B /dev/rdisk/disk2_p2

3. To display the properties of a PV :

# pvdisplay /dev/disk/disk12

4. To display the detailed properties of a PV :

# pvdisplay -v /dev/disk/disk12

5. To move the data between PVs :

# pvmove /dev/disk/disk12:2 /dev/disk/disk13

LVM - Physical Extent

Few Points to remember :

1. Default size of PE is 4MB
It can take a value from 1 MB to 256 MB.

2. PE size can be set when you create the volume group.
If you want to change it the only way is to recreate the VG with a newer PE value.

LVM - Volume Group

Naming Convention:

Volume group's name is unique and can have a max. 255 chars.
Default names of the form /dev/vgxx

Few Points to remember :

1. Max VGs per system can be changed thru the kernel tunable 'maxvgs'.
Minimum value is 0
Default Value is 16
Maximum value is 256
This tunable has been removed in version 11.31.

2. A Volume group can contain minimum 1 PV and maximum 255 PVs.

3. A VG can contain maximum 255 LVs.


Here is the list of mostly used commands for managing VG's :

To create a volume group :

# vgcreate

To remove a volume group :

# vgremove

To activate, deactivate, change the chars of a VG :

# vgchange

To modify the config parameters of a VG :

# vgmodify

To backup the VG config details :

# vgcfgbackup

To restore the VG config details from a config file :

# vgcfgrestore

To display the info for all or a particular VG :

# vgdisplay

To export a VG and its associated LVs:

# vgexport

To import a VG into the system as well as adding an existing VG into /etc/lvmtab :

# vgimport

To scan all PV s looking for LVs and VGs :

# vgscan

To add a PV to a VG :

# vgextent

To remove a PV from a VG :

# vgreduce

To sync all the mirrored LVs in a VG :

# vgsync

To modify the VGID on a PV :

# vgchgid

To migrate a VG from legacy to persistent device files :

# vgdsf

Here are few Examples,

1. To create a volume group :

a. Create a directory under /dev,


# mkdir /dev/vg01

b. Create a group device file

# mknod /dev/vg01/group c 64 0xnn0000

where
c -> to mention group is a character device file
64 -> is the major number for the group file. It should be always 64
0xnn0000 -> is the monir number for the group file in hexadecimal and nn is the unique vg number

c. Finally create the vg using a pv
# vgcreate /dev/vgname /dev/disk/disk12

2. To display all the volume groups :

# vgdisplay

3. To display the properties of a volume group :

# vgdisplay vg00

4. To display the detailed properties of a volume group :

# vgdisplay -v vg00

5. To add a PV to a VG :

# vgextend /dev/vg01 /dev/disk/disk13

6. To remove a PV from a VG :

# vgreduce /dev/vg01 /dev/disk/disk13

Before executing this command, make sure the PV disk13 doesnot hold any LV.

Otherwise vgreduce command wont work.

7. To deactivate a VG :

# vgchange -a n vg01

8. To activate a VG :

# vgchange -a y vg01

9. To export a VG :

# vgexport -s -v -m /tmp/vg01.map vg01
where /tmp/vg01.map is the map file whicj will hold PE-LE mappings and other config details.

10. To import a VG :

You need to create the VG dir and the group device file as like in the VG creation process.
Then you can import the VG using the below command,

# vgimport -s -v -N -m /tmp/vg01.map /dev/vg01

11. To change the "Max PV" attribtue to 255 for a VG :

# vgchange -a n vg01
# vgmodify -p 255 -n vg01
# vgchange -a y vg01

12. To change the "Max PE per PV" attribtue to 8128 for a VG :

# vgchange -a n vg01
# vgmodify -e 8128 -n vg01
# vgchange -a y vg01

13. To hold the write operation on a VG for 400 secs :

# vgchange -Q w -t 400 vg01
This operation is called as quiescing a VG.

14. To hold both read and write operation on a VG untill it is explicitly resumed :

# vgchange -Q rw vg01

15. To resume a quiesced VG :

# vgchange -R vg01

16. To rename a VG :

a. Deactivate the VG :
# vgchange -a n vg01

b. Find out the minor number of the Vg's group file :
# ls -l /dev/vg01/group

c. Export the VG :
# vgexport -m /tmp/vg01.map vg01

d. Create the vg dir in the new name and create its group file with the same minor number
# mkdir /dev/dbvg
# mknod /dev/dbvg/group c 64 0x010000

e. Import the VG
# vgimport -m /tmp/vg01.map /dev/dbvg

f. Backup the VG config info :
#  vgcfgbackup /dev/dbvg

g. Activate the VG :
# vgchange -a y /dev/dbvg

h. Remove the saved conf information file for the old vg name :
# rm /etc/lvmconf/vg01.conf

i. Modify all the references in other config files like /etc/fstab