Wednesday, March 24, 2010

Get the size of all SAN LUNs in Solaris

luxadm probe | grep Logical| awk -F: '{print $2}' | xargs luxadm display | grep Unformatted

Basic Sun cluster commands

- Create failover resource groups :
scrgadm -a -g nfs-rg1 -h node1,node2 -y PathPrefix=/global/nfs1 -y Failback=true

- Add logical hostname resources to the resource groups :
scrgadm -a -j nfs-lh-rs1 -L -g nfs-rg1 -l log-name1

- Configure device groups :
scconf -c -D name=nfs1,nodelist=node1:node2,failback=enabled

- Create HAStoragePlus resources :
scrgadm -a -j nfs-hastp-rs1 -g nfs-rg1 -t SUNW.HAStoragePlus -x FilesystemMountPoints=/global/nfs1 -x AffinityOn=True

- Bring the groups online :
scswitch -Z -g nfs-rg1

- Enable NFS resources :
scswitch -e -j share1

scrgadm -pvv -g lpdb-ms -j resource-name | grep FilesystemMountPoints

scrgadm -c -j lp-db-hasp-res2 -x FilesystemMountPoints=”/oracle/lpprod/data01,/oracle/lpprod/data02,/oracle/lpprod/index01,/oracle/lpprod/archive,/oracle/lpprod/redologa,/oracle/lpprod/redologb,/oracle/lpprod/redologc,/oracle/lpprod/redologd,/oracle/lpprod/data03,/oracle/lpprod/data04″

Create dependencies
- scrgadm -c -j resource2 -y Resource_dependencies=myresource1

http://www.datadisk.co.uk/html_docs/sun/sun_cluster_31_tasks.htm

How to remove DISKs/LUNs FROM Solaris

1. Identify the file systems.
2. Get the disks that belong to the file system.
3. Check them in the metaset/metadevice and make sure no one else is using them (no other soft partition).
4. Clean the metadevice from the metaset
5. REMOVE THE DISKS FROM THE METASET
6. REMOVE THE METADB FOR THE DISKS THAT YOU WANT TO REMOVE
7. ASK data storage to remove the disks
8. Configure the controllers after you confirm that the disks has been removed in all nodes
9. Run devfsadm -Cv in all nodes
9. Run scgdevs in ONE NODE (in case you are using SUN Cluster)
10. Run scdidadm -C in ONE NODE (in case you are using SUN Cluster)
11. Check all nodes have the same number of LUNS (in case you are using SUN Cluster)
For more information check http://docs.sun.com/app/docs/doc/817-1673/6mhcv6m38?a=view

How to remove a reservation key from a lun that is not used anymore

If you try to add a LUN to a server and you are not able to do anything on this LUN (e.g.: metainit is not working) most probubly this luns was used somewhere before and the reservation key was not removed from it.

in order to remove the reservation key (BEFORE you remove it make sure the LUN has been removed from the other system and it’s not needed anymore otherwise you will lose your data and the other system will panic)

1. Check if you have reservation key in the LUN (you will need the sun cluster to be installed, if you don’t have it in the system try to mount the directory /usr/cluster from any sun cluster node to your server (nfs), I know it’s a dirty trick, but it will help.

root@localhost# /usr/cluster/lib/sc/scsi -c inkeys -d /dev/rdsk/c8t6005076300C0B334000000000000170Ed0s2
Reservation keys(4):
0×420773ee00000001
0×420773ee00000002
0×420773ee00000004
0×420773ee00000003 <— reservation key number

root@localhost# /usr/cluster/lib/sc/scsi -c inresv -d /dev/rdsk/c8t6005076300C0B334000000000000170Ed0s2
Reservations(1):
0×420773ee00000002
type —> 5

2. Run the following command to clean/remove the reservation keys

root@localhost# /usr/cluster/lib/sc/scsi -c scrub -d /dev/rdsk/c8t6005076300C0B334000000000000170Ed0s2
Reservation keys currently on disk:
0×420773ee00000001
0×420773ee00000002
0×420773ee00000004
0×420773ee00000003
Attempting to remove all keys from the disk…
Scrubbing complete, use ‘/usr/cluster/lib/sc/scsi -c inkeys -d /dev/rdsk/c8t6005076300C0B334000000000000170Ed0s2′ to verify success