Thursday, 31 July 2008

Solaris shell services and packages

On my way to a mystical and magical world... the world of Solaris...

Unfortunately things aren't as fun and exiting as they sound... first impression... the system looks annoying.. uses korn shell and not the dearly beloved bash... and has no freaking colors... what are solaris admins?? colorblind? and what the hell! I like ps auxfw why do I have to do a ps -ef now!?... just annoying!
OK lets put the bitching aside and start getting the hang of this thing...

First things first! replace /sbin/sh with /bin/bash in the /etc/passwd

Second! Go to sunfreeware.com and download pine (of course!) and coreutils... gunzip and pkgadd -d to install

Third! create a .profile for root and add:
PATH="/usr/sbin:/usr/bin:/usr/dt/bin:/usr/openwin/bin:/usr/ucb:/usr/local/bin/"
export PATH
PS1="\u@\h:\w> "
alias ls="/usr/local/bin/ls --color"

Good.. it almost feels like home now!

other useful commands:

Install pine package
pkgadd -d pine-4.64-sol10-x86-local

Print system configuration
prtconf -v

Observe or configure inetd-controlled services
inetadm for a list of services
inetadm -l FMRI (to see more options settings)
inetadm -e FMRI (enable service)
inetadm -d FMRI (disable service)
inetadm -m FMRI option="setting" (change service settings)
inetadm -p (print out the global settings for all services of inetadm)
inetadm -M option=setting (change options to all services of indetadm)

Print processor information
psrinfo -v

Print system definition information
sysdef

File containing the name coresponding to the net interface
/etc/hostname.pcn0

Top lookalike
prstat

Thats all for now...

Thanks for playing :)

Tuesday, 15 July 2008

Dell Poweredge 860 RAID Controller

Fixing up the RAID Controller write cache:
1. Download and install the driver from here
2. Download the lsiutil utility from here
3. Run it and configure the controller thusly:
ocsp2:~# ./mptlinux/lsiutil/lsiutil

LSI Logic MPT Configuration Utility, Version 1.38, July 6, 2005

1 MPT Port found

     Port Name         Chip Vendor/Type/Rev    MPT Rev  Firmware Rev
 1.  /proc/mpt/ioc0    LSI Logic SAS1068 B0      105      000a310

Select a device:  [1-1 or 0 to quit] 1

 1.  Identify firmware, BIOS, and/or FCode
 2.  Download firmware (update the FLASH)
 4.  Download/erase BIOS and/or FCode (update the FLASH)
 8.  Scan for devices
10.  Change IOC settings (interrupt coalescing)
13.  Change SAS IO Unit settings
16.  Display attached devices
20.  Diagnostics
21.  RAID actions
22.  Reset bus
23.  Reset target
30.  Beacon on
31.  Beacon off
97.  Reset SAS phy
98.  Reset SAS link
99.  Reset port

Main menu, select an option:  [1-99 or e for expert or 0 to quit] 21

 1.  Show volumes
 2.  Show physical disks
 3.  Get volume state
23.  Replace physical disk
30.  Create volume
31.  Delete volume
32.  Change volume settings

RAID actions menu, select an option:  [1-99 or e for expert or 0 to quit] 32

Volume:  [0-1 or RETURN to quit] 

Volume 0 Settings:  write caching disabled, auto configure, priority resync
Volume 0 draws from Hot Spare Pools:  

Enable write caching:  [Yes or No, default is No] yes
Offline on SMART data:  [Yes or No, default is No]
Auto configuration:  [Yes or No, default is Yes]
Priority resync:  [Yes or No, default is Yes]
Hot Spare Pools (bitmask of pool numbers):  [00 to FF, default is 01]

RAID actions menu, select an option:  [1-99 or e for expert or 0 to quit] 

Main menu, select an option:  [1-99 or e for expert or 0 to quit] 

     Port Name         Chip Vendor/Type/Rev    MPT Rev  Firmware Rev
 1.  /proc/mpt/ioc0    LSI Logic SAS1068 B0      105      000a310

Select a device:  [1-1 or 0 to quit]
Many thanks to Jan Tomášek whose blog I copied (just in case)
I couldn’t have done it without his guidance

Thursday, 10 July 2008

USB Stick bootable with encypted partition

So I got this 4GB Sandisk thumb drive...

lets make it useful now...

Under linux:
cfdisk /dev/sdc
or
fdisk /dev/sdc

delete all partitions, create one FAT16 and one Linux, mark FAT16 as bootable and format them:
mkdosfs -F 16 /dev/sdc1

Install backtrack.. (I said useful right??)
mount /dev/sdc1 /mnt/memory

download the USB version from here
mount -o loop -t iso9660 bt3final_usb.iso /mnt/iso
cp /mnt/iso/* /mnt/memory
cd /mnt/memory/boot
./bootinst.sh

lets encrypt the other partition now...

boot Backtrack using the usb stick

create the encrypted volume
truecrypt /dev/sdc2

select None for filesystem

Load the volume without mounting it
truecrypt /dev/sdc2

truecrypt -vl
/dev/mapper/truecrypt0:
Volume: /dev/sda2
Type: Normal
Size: 2060089856 bytes
Encryption algorithm: AES-Twofish-Serpent
Mode of operation: LRW
Read-only: No
Hidden volume protected: No

mkfs.ext2 /dev/mapper/truecrypt0

to format the partition using the ext2 filesystem

dismount
truecrypt -d /dev/sdc2

and mount again using the truecrypt utility
truecrypt /dev/sdc2 /mnt/memory

all done!

thanks for playing :)

Tuesday, 8 July 2008

Useful one-liners

Some useful one liners for bash scripting....

Removing the lines that start with #
cat file.conf | sed '/ *#/d; /^ *$/d'
Replacing text within configuration files (replace yes with no when PRELINKING)
sed '/PRELINKING/s/yes/no/g' /etc/sysconfig/prelink > /etc/sysconfig/prelink.new 
awk '/PRELINKING/{gsub(/yes/, "no")};{print}' /etc/sysconfig/prelink > /etc/sysconfig/prelink.new
Delete all blank lines on a file
sed '/^$/d' filename
Number lines (except blank ones)
awk 'NF{$0=++a " :" $0};{print}' filename


to be updated...