Sunday, July 6, 2008

Adding to LD Library Path on solaris.

Easiest way to add to LD Library Path on solaris is to use crle...

If you got one of those pesky Fatal library.so exceptions.. the only way is to add to LD Library path..This can be achieved by using crle..

use crle to find out what there in LD Library path..

bash-3.00$ crle

Configuration file [version 4]: /var/ld/ld.config
Default Library Path (ELF):

Trusted Directories (ELF): /lib/secure:/usr/lib/secure (system default)

Command line:
crle -c /var/ld/ld.config -l /lib:/usr/lib


To add to LD Library Path use the following

bash-3.00$ sudo crle -u -l /usr/lib/mps
Password:

Viola..... you have added /usr/lib/mps to the LD Library path...

Confirm that by issuing the following command..


bash-3.00$ crle

Configuration file [version 4]: /var/ld/ld.config
Default Library Path (ELF): /lib:/usr/lib:/usr/lib/mps
Trusted Directories (ELF): /lib/secure:/usr/lib/secure (system default)

Command line:
crle -c /var/ld/ld.config -l /lib:/usr/lib:/usr/lib/mps

Monday, June 9, 2008

use ps to display full listing of the executable on solaris

Ever Wondered of a way to find out the full path details of a executable by using its PID.. if you use ps -ef | grep xyz.. it would give you truncated results...This full path detail which normally includes classpath if the process is a java program is very useful during debugging purposes...

#/usr/ucb/ps -auwww does the trick.. Keep this guy in your solaris repertoire.


~Njoy

Sunday, March 23, 2008

Tips to Add a Hard Drive on Solaris 10

Here are couple of tips to add a hard drive to solaris 10.


I am assuming here that you have a vmware machine on which you have solaris 10 installed.

1) You need to allocate a physical disk to solaris 10 thru vmware first.

2) Check the current disks on the solaris 10 system

# ls /dev/rdsk/*s0
/dev/rdsk/c0t0d0s0 /dev/rdsk/c1t0d0s0

Here you see as of right now, we have two disks ( c0t0d0s0,c1t0d0s0 )

3) Now you need solaris 10 to understand the new drive,

to that end, run devfsadm

or do a "reboot -- -r" which will reboot the solaris system. This would allow solaris 10 understand the nnew drive.

4) Check if solaris 10 understood the new disk.

# ls /dev/rdsk/*s0
/dev/rdsk/c0t0d0s0 /dev/rdsk/c1t0d0s0 /dev/rdsk/c1t1d0s0

see the disk on the new bus c1t1d0s0

5) Now, we have the disk, we want to format the drive and create partitions on it.

# format
Searching for disks…done

AVAILABLE DISK SELECTIONS:
0. c1t0d0
/pci@0,0/pci1000,30@10/sd@0,0
1. c1t1d0
/pci@0,0/pci1000,30@10/sd@1,0
Specify disk (enter its number):

Type “1″, the option for the new drive and hit “enter”. Depending on the type of disk it may be preformatted:

selecting c1t1d0
[disk formatted]

If your drive is not formatted, type format at the format prompt to low level format your hard drive. Next, we need to use fdisk to create the partitions, type “y” to create the default Solaris partition:

format> fdisk
No fdisk table exists. The default partition for the disk is:

a 100% “SOLARIS System” partition

Type “y” to accept the default partition, otherwise type “n” to edit the
partition table.
y

Next enter the partition menu, by typing partition:

format> partition

You can print out the current partitioning first if you like:

partition> print
Current partition table (original):
Total disk cylinders available: 1020 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 0 (0/0/0) 0
1 unassigned wm 0 0 (0/0/0) 0
2 backup wu 0 - 1020 1.99GB (1021/0/0) 4182016
3 unassigned wm 0 0 (0/0/0) 0
4 unassigned wm 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 unassigned wm 0 0 (0/0/0) 0
7 unassigned wm 0 0 (0/0/0) 0
8 boot wu 0 - 0 2.00MB (1/0/0) 4096
9 unassigned wm 0 0 (0/0/0) 0

In this case, I just want to create on large partition for some extra storage so I will allocate all I can to partition 0. Note that partition 2 is used to reference the entire drive and is not a usable partition. To modify a given partition, just enter the number of the partition at the partition prompt:

partition> 0
Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 0 (0/0/0) 0

Enter partition id tag[unassigned]:
Enter partition permission flags[wm]:
Enter new starting cyl[0]: 1
Enter partition size[0b, 0c, 1e, 0.00mb, 0.00gb]: 1019c

And now to print the partition table again you can see what has changed:

partition> print
Current partition table (unnamed):
Total disk cylinders available: 1020 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks
0 unassigned wm 1 - 1019 1.99GB (1019/0/0) 4173824
1 unassigned wm 0 0 (0/0/0) 0
2 backup wu 0 - 1020 1.99GB (1021/0/0) 4182016
3 unassigned wm 0 0 (0/0/0) 0
4 unassigned wm 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 unassigned wm 0 0 (0/0/0) 0
7 unassigned wm 0 0 (0/0/0) 0
8 boot wu 0 - 0 2.00MB (1/0/0) 4096
9 unassigned wm 0 0 (0/0/0) 0

Save your changes by writing the label to the disk:

partition> label
Ready to label disk, continue? y

Quit out of the partition prompt, and then the format prompt, which takes you back to the command prompt:

partition> quit
format> quit
#

Now we are ready to create a file system on this new partition (in this case UFS).

# newfs /dev/rdsk/c1t1d0s0
newfs: construct a new file system /dev/rdsk/c1t1d0s0: (y/n)? y
/dev/rdsk/c1t1d0s0: 4173824 sectors in 1019 cylinders of 128 tracks, 32 sectors
2038.0MB in 45 cyl groups (23 c/g, 46.00MB/g, 11264 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 94272, 188512, 282752, 376992, 471232, 565472, 659712, 753952, 848192,
3298432, 3392672, 3486912, 3581152, 3675392, 3769632, 3863872, 3958112,
4052352, 4146592

Make sure that the file system is clean:

# fsck /dev/rdsk/c1t1d0s0
** /dev/rdsk/c1t1d0s0
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3a - Check Connectivity
** Phase 3b - Verify Shadows/ACLs
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cylinder Groups
2 files, 9 used, 2020758 free (14 frags, 252593 blocks, 0.0% fragmentation)

Next, add the proper line to /etc/vfstab:

/dev/dsk/c1t1d0s0 /dev/rdsk/c1t1d0s0 /data ufs 2 yes

And then mount the partition. In this case, I’m making a /data partition:

# mkdir /data
# mount /data
# df -h /data
Filesystem size used avail capacity Mounted on
/dev/dsk/c1t1d0s0 1.9G 2.0M 1.9G 1% /data

All set !.