Tuesday, March 3, 2009

vmware way of discovering lun

In order to list a vmware lun, please do this.

[root@testdev01 volumes]# esxcfg-mpath -l
Disk vmhba1:0:16 /dev/sdr (204800MB) has 4 paths and policy of Most Recently Used FC 10:0.0 10000000c9610905<->5006016941e02f2b vmhba1:0:16 Standby FC 10:0.0 10000000c9610905<->5006016141e02f2b vmhba1:1:16 On active FC 14:0.0 10000000c96106fc<->5006016041e02f2b vmhba2:0:16 On FC 14:0.0 10000000c96106fc<->5006016841e02f2b vmhba2:1:16 Standby preferred

Disk vmhba1:0:17 /dev/sds (204800MB) has 4 paths and policy of Most Recently Used FC 10:0.0 10000000c9610905<->5006016941e02f2b vmhba1:0:17 Standby FC 10:0.0 10000000c9610905<->5006016141e02f2b vmhba1:1:17 On active FC 14:0.0 10000000c96106fc<->5006016041e02f2b vmhba2:0:17 On FC 14:0.0 10000000c96106fc<->5006016841e02f2b vmhba2:1:17 Standby preferred

Disk vmhba1:0:18 /dev/sdt (204800MB) has 4 paths and policy of Most Recently Used FC 10:0.0 10000000c9610905<->5006016941e02f2b vmhba1:0:18 Standby FC 10:0.0 10000000c9610905<->5006016141e02f2b vmhba1:1:18 On active FC 14:0.0 10000000c96106fc<->5006016041e02f2b vmhba2:0:18 On FC 14:0.0 10000000c96106fc<->5006016841e02f2b vmhba2:1:18 Standby preferred

Tuesday, February 10, 2009

Discovering HBA information from RHEL3 and SLES10

If you wish to retrieve information on HBAs on RHEL3 or SLES10 SP1. Basically, here is the path that you are looking for.

RHEL3: /proc/scsi/lpfc/
SLES10 SP1: /sys/class/fc_host/

As for the SLES10 SP2 : /sys/class/scsi_host/

There are bunch of information like HBA model, firmware, speed, port_state and WWN.

Discovering HBA from OEL5

hbanyware prepares a good place to query the hba information.

e.g.
[root@test03 audit]# /usr/sbin/hbanyware/hbacmd listhbas
Manageable HBA List
Port WWN : 10:00:00:00:c9:63:1d:79

Node WWN : 20:00:00:00:c9:63:1d:79
Fabric Name: 10:00:00:05:1e:04:6c:8b
Flags : 8000f0e5
Host Name : test03.hiu.com
Mfg : Emulex Corporation
Port WWN : 10:00:00:00:c9:63:1d:34

Node WWN : 20:00:00:00:c9:63:1d:34
Fabric Name: 10:00:00:05:1e:04:3f:9d
Flags : 8000f0e5
Host Name : test03.hiu.com
Mfg : Emulex Corporation

In order to get the HBA Model, you can get the information from hbanyware command as well.

[root@test03 audit]# /usr/sbin/hbanyware/hbacmd hbaAttributes 10:00:00:00:c9:63:1d:79
HBA Attributes for 10:00:00:00:c9:63:1d:79
Host Name : test03.hiu.com

Manufacturer : Emulex Corporation
Serial Number : BG72036851
Model : LPe1150-E
Model Desc : EMC LPe1150-E 4Gb PCIe Fibre Channel Adapter
Node WWN : 20 00 00 00 c9 63 1d 79
Node Symname : Emulex LPe1150-E FV2.72A2 DV8.2.0.22
HW Version : 2057706d
Opt ROM Version:
FW Version : 2.72A2 (W3F2.72A2), sli-3
Vendor Spec ID : 10DFNumber of Ports: 1
Driver Name : lpfc
Device ID : F0E5
HBA Type : LPe1150-E
Operational FW : SLI-3 Overlay
SLI1 FW : SLI-1 Overlay 2.72a2
SLI2 FW : SLI-2 Overlay 2.72a2
SLI3 FW : SLI-3 Overlay 2.72a2
IEEE Address : 00 00 c9 63 1d 79
Boot BIOS : 1.70a3
Driver Version : 8.2.0.22; HBAAPI(I) v2.1.g, 12-07-07
Kernel Version : 1.20a4
HBA Temperature: Not Available

Sunday, February 8, 2009

Configure opensuse11 + rewrite_module

if you are using opensuse 11 with cakephp development, most likely you will need to have the rewrite_module enabled on apache2.

All apache2 modules are kept at /usr/lib/apache2. Please use this command to enable your rewrite_module. Enjoy!

a2enmod rewrite
/etc/init.d/apache2 force-reload

Sunday, October 12, 2008

Passed Novell CLP10

After making my mind to go for the certification, i finally passed the cert. It is not that too hard but, the remote connection is slow and lame. What make worse of it is the timer is keep on triggering, making the feeling of panics and nervous.


Wednesday, October 8, 2008

Backup Files

TAR
We have two different backup, full backup and incremental backup.

Let's pick our backup folder as /srv/www/htdocs.

To do a full backup, you need to prompt this command

cd /srv/www
tar cvz -g /tmp/backup/snapshot_htdocs -f /tmp/backup/htdocs_full.tar.gz htdocs

To do a incremental backup.

tar cvz -g /tmp/backup/snapshot_htdocs -f /tmp/backup/htdocs_incremental.tar.gz htdocs

RSYNC
Rsync backup is much more better than tar. Both incremental and full backup can use the same command to execute. Rsync will pick the changes on backup target without capturing the file snapshot.

rsync -ave ssh root@ip_addr_to_be_backup:/home/users /tmp/backup_dir

Monday, October 6, 2008

syslog

The configuration of syslog-ng is distributed across three files

  • /etc/sysconfig/syslog
  • /etc/syslog-ng/syslog-ng.conf.in
  • /etc/syslog-ng/syslog-ng.conf



/etc/sysconfig/syslog contains general parameters applicable to syslog-ng.

/etc/syslog-ng/syslog-ng.conf.in is the template used to create the configuration file /etc/syslog-ng/syslog-ng.conf, which is the configuration file actually used by syslog-ng. both files have the same syntax.

syslogd and syslog-ng share two concepts that you have to understand to the able to configure either one:

  • facilities
  • priorities

Sunday, October 5, 2008

Creating a virtual interface on opensuse11

  • a normal network interface can be queried via the command ifconfig
opensuse01:~ # ifconfig
eth2 Link encap:Ethernet HWaddr 00:0C:29:4F:74:C5
inet addr:192.168.80.134 Bcast:192.168.80.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe4f:74c5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:346 errors:0 dropped:0 overruns:0 frame:0
TX packets:781 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:44214 (43.1 Kb) TX bytes:109649 (107.0 Kb)
Interrupt:18 Base address:0x2024
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:326 errors:0 dropped:0 overruns:0 frame:0
TX packets:326 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:45674 (44.6 Kb) TX bytes:45674 (44.6 Kb)
============================================
  • To add the virtual interface.
ip addr add 192.168.80.135/24 brd + dev eth2 label eth2:1
  • ifconfig again to the command prompt will display this
eth2:1 Link encap:Ethernet HWaddr 00:0C:29:4F:74:C5
inet addr:192.168.80.135 Bcast:192.168.80.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:18 Base address:0x2024
============================================
  • Please do a ping to the new virtual interface.
opensuse01:~ # ping 192.168.80.135
PING 192.168.80.135 (192.168.80.135) 56(84) bytes of data.
64 bytes from 192.168.80.135: icmp_seq=1 ttl=64 time=0.034 ms
64 bytes from 192.168.80.135: icmp_seq=2 ttl=64 time=0.039 ms
64 bytes from 192.168.80.135: icmp_seq=3 ttl=64 time=0.049 ms
64 bytes from 192.168.80.135: icmp_seq=4 ttl=64 time=0.049 ms

Sunday, September 21, 2008

Linux Users and Groups

Linux stores all users and groups configuration data in the following files.
  • /etc/passwd
  • /etc/shadow
  • /etc/group
E.G

geeko:x:1000:100:Geeko Chameleon:/home/geeko:/bin/bash
geeko:$sdfsdf$123$asf234sdfasdf23132:13181:0:9999:7:-1::

The above illustration shows the entry for the user geeko with an encrypted password. Some users such as wwwrun or bin ave an * in the password field. This means that these users can not log in to the system, but are for special applications.

Command to manage the users and groups.
  • useradd -m : automatically generates the home directory for the user. Without this argument, the directory is created under /home/
  • useradd -c : creating a new user with the ext for comment field.
  • useradd -u : specifying the UID of the new account.
  • useradd -g : specifying the primary group of the user.
  • useradd -e : set the expire date.
  • usermod : used to modify the setting. All the options used by usermod is the same as useradd
  • passwd -l : a user can be locked out.
  • passwd -u : a user can be unlocked, or re-activated.
  • if /etc/shadow lists a user account where is the password field is started with !, it means this account had been locked.
  • passwd -S : list the status of a user account.
  • passwd -i : disable an account after the password has been expired for number of days
  • passwd -n : sets the minimum number of days before a password can be changed.
  • passwd -w : warns the user that in number of days his password will expire.
  • passwd -x : sets the maximum number of days a password remains valid. After number of days the password must be changed.
E.G passwd -x 30 -w 5 geeko

When the passwd command is used, the /etc/default/passwd file is checked for the encryption method.

Manage groups from the command line.
  • groupadd -g 200 sports : adding a new group, called sport with gid, 200
  • groupdel sports : deleting a group called sports
  • groupmod -g 201 sports : modifying the gid of sports group to 201
  • groupmod -A geeko : add the user geekp to the group
  • gpasswd : Change password for group accounts.


The standrad configuration information is derived from 2 importants files.
  • /etc/default/useradd
  • /etc/login.defs

Sunday, September 14, 2008

Apache on SLES10

To setup a basic apache webserver, you need to install
  • apache2
  • apache2-prefork
  • apache2-example-pages (optional)

Commands to administer apache2

  • To start apache2: rcapache2 start
  • To stop: rcapache2 stop
  • To let apache starts at boot time: insserv apache2
  • To reload the config file: rcapache2 reload
  • To restart daemon: rcapache2 restart
  • To examine the syntax of the config files: apache2ctl configtest
  • The default directory: /srv/www/htdocs. It is called DocumentRoot of the web server.
  • wwwrun is the user that executing apache2

Apache2 configuration files

  • /etc/apache2/httpd.conf - The main apache configuration file.
  • /etc/apache2/default-server.conf - Contains the basic web server setup. All options set in this file can be overwritten by other configuration files.
  • /etc/apache2/vhost.d - The directory for virtual host setups.
  • /etc/apache2/uuid - Sets the user and group id for apache. By default, apache uses wwwrun(uid) and www(gid)
  • /etc/apache2/server-tuning.conf - tune the performance of apache2.
  • /etc/apache2/errors.conf - configure the behavior of apache when a request cannot be performed.
  • /etc/apache2/ssl-global.conf - configure the connection encryption with SSL.

Create RSA Key Pair

  • cat /dev/random > /tmp/random Stop this command after a few seconds by pressing Ctrl-C
  • To create the server key: openssl genrsa -des3 -rand /tmp/random 1024 -out server.key
  • Sign the public key to create a certification: openssl req -new -x509 -key server.key -out server.crt
  • Copy the server.key to /etc/apache2/ssl.key/* and copy the server.crt to /etc/apache2/ssl.crt/*
  • To configure the main server, you need to add the following lines to /etc/apache2/default-server.conf
  • SSLEngine on
  • SSLCertificateFile /etc/apache2/ssl.crt/server.crt
  • SSLCertificateKeyFile /etc/apache2/ssl.key/server.key
  • APACHE_START_TIMEOUT="10" - This setting extends the start timeout of apache so that have more time to enter the passphrase of the private RSA key.
  • APACHE_SERVER_FLAGS="SSL" - This enables some directives that are necessary for SSL encrytion. It lets apache listen on port 443 instead of only to port 80.