Subscribe:

Ads 468x60px

Pages

Tuesday, August 16, 2011

SAN on HP-UX

After create LUN on external storage, we want to connect server through fiber channel to SAN Switch. 


First we should plugged FC HBA card to server. View HBA version. Ex: AB379B.We need to check depot Fiber Channel that contain HBA’s driver.

# swlist | grep FibrChanl-01
FibrChanl-01 B.11.11.10 FibreChannel;HW=A6826A,A9782A,A9784A,AB378A/B,AB379A/B,AB465A,AD193A,AD194A


If we don’t have any depot installed, we should download depot from HP site. After this we install that depot.
# swinstall -s /tmp/FibrChanl-01_B.11.11.12_HP-UX_B.11.11_64.depot

Before we plugged the HBA card we should make sure we have it’s driver.
After we install driver, it’s safe to shutdown server and plugged HBA card.
After start the system, show the system hardware and all list disk device class.

# ioscan -nfCdisk
Class I H/W Path Driver S/W State H/W Type Description
==========================================================================
disk 6 0/2/1/0.1.0.0.0.0.1 sdisk CLAIMED DEVICE HP HSV300
/dev/dsk/c10t0d1 /dev/rdsk/c10t0d1
disk 5 0/2/1/0.1.1.0.0.0.1 sdisk CLAIMED DEVICE HP HSV300
/dev/dsk/c12t0d1 /dev/rdsk/c12t0d1
disk 3 0/3/1/0.2.0.0.0.0.1 sdisk CLAIMED DEVICE HP HSV300
/dev/dsk/c14t0d1 /dev/rdsk/c14t0d1
disk 4 0/3/1/0.2.1.0.0.0.1 sdisk CLAIMED DEVICE HP HSV300
/dev/dsk/c16t0d1 /dev/rdsk/c16t0d1
# diskinfo -b /dev/rdsk/c10t0d1 
SCSI describe of /dev/rdsk/c10t0d1:
vendor: HP
product id: HSV300
type: direct access
size: 1027604480 Kbytes
bytes per sector: 512

# diskinfo -b /dev/rdsk/c12t0d1 
SCSI describe of /dev/rdsk/c12t0d1:
vendor: HP
product id: HSV300
type: direct access
size: 1027604480 Kbytes
bytes per sector: 512

# diskinfo -b /dev/rdsk/c14t0d1 
SCSI describe of /dev/rdsk/c14t0d1:
vendor: HP
product id: HSV300
type: direct access
size: 1027604480 Kbytes
bytes per sector: 512

# diskinfo -b /dev/rdsk/c16t0d1
SCSI describe of /dev/rdsk/c16t0d1:
vendor: HP
product id: HSV300
type: direct access
size: 1027604480 Kbytes
bytes per sector: 512

From our config, we found 4 path through same LUN. So we only need to create physical volume only on one disk.
# pvcreate -f /dev/rdsk/c10t0d1

Create vgdata partition # mkdir /dev/vgdata

# mknod /dev/vgdata/group c 64 0×010000
( 0×010000 is the magic number and this number has last 4 digits as 0000. The first two digits have to be unique and the maximum limit is 10 )

Create Volume Group, we need to define pe_size(ex: 64 MB) and max_pe (ex: 35000)
# vgcreate -s 64 -e 35000 /dev/vgdata /dev/dsk/c10t0d1 /dev/dsk/c12t0d1 /dev/dsk/c14t0d1 /dev/dsk/c16t0d1

Display volume group vgdata
# vgdisplay vgdata
— Volume groups —
VG Name /dev/vgdata
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 0
Open LV 0
Max PV 16
Cur PV 1
Act PV 1
Max PE per PV 35000
VGDA 2
PE Size (Mbytes) 64
Total PE 15678
Alloc PE 0
Free PE 15678
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0

We want to allocate all “Free PE” to logical volume, so we can get max size.Size = Free PE x PE size.

# expr 15678 \* 64
1003392

Create logical volume on disk
# lvextend -L 1003392 -n datalvol /dev/vgdata

Create file system for logical volume that you created
# newfs -F vxfs -o largefiles /dev/vgdata/datalvol

Mount logical volume
# mkdir /data
# echo “/dev/vgdata/datalvol /data vxfs delaylog 0 2″ >> /etc/fstab
# mount /dev/vgdata/datalvol /data

Show final volume group vgdata information.
# vgdisplay -v vgdata
— Volume groups —
VG Name /dev/vgdata
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 1
Open LV 1
Max PV 16
Cur PV 1
Act PV 1
Max PE per PV 35000
VGDA 2
PE Size (Mbytes) 64
Total PE 15678
Alloc PE 15678
Free PE 0
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0
— Logical volumes —
LV Name /dev/vgdata/datalvol
LV Status available/syncd
LV Size (Mbytes) 1003392
Current LE 15678
Allocated PE 15678
Used PV 1
— Physical volumes —
PV Name /dev/dsk/c10t0d1
PV Name /dev/dsk/c12t0d1 Alternate Link
PV Name /dev/dsk/c14t0d1 Alternate Link
PV Name /dev/dsk/c16t0d1 Alternate Link
PV Status available
Total PE 15678
Free PE 0
Autoswitch On

Read more...

vmstat command on Solaris-based Videos

The videos that follow are for vmstat(1M) on Solaris-based operating systems, including Joyent’sSmartOS. All are available here: vmstat videos, and embedded below:


Read more...

touch command

How to change creation date and creation time of existing file

Example:

$ ls -l abc
-rw-rw-r-- 1 sunshine se 16645 Apr 30 10:34 abc
$ touch -t 201003010800 abc
$ ls -l abc
-rw-rw-r-- 1 sunshine se 16645 Mar 1 08:00 abc
==============================================
Option
-t time
Uses the specified time instead of the current time.
time will be a decimal number of the form:

[[CC]YY]MMDDhhmm[.SS]
Read more...

Thursday, August 11, 2011

Zimbra backup


Login as Zimbra
# su – zimbra


stop the zmcontrol service
# service zmcontrol stop


Logout from zimbra
#exit


login as root
# su -


kill all zimbra process
# ps aux | grep zimbra 
# kill -9 pid


Create a directory zcsbackuprsync
# mkdir /zcsbackuprsync


Take a backup of zimbra using rsync
# rsync -avHK /opt/zimbra/ /zcsbackuprsync/zimbra


Create a directory zcsbackuptars
# mkdir /zcsbackuptars


Make tar archive and zip the file
# tar -zcvf /zcsbackuptars/backup.zimbra.version.date.time.tar.gz -C /zcsbackup/zimbra

Read more...

To mount cdrom in Linux


Create a mount point
# mkdir /media/data


Temporarliy mounting cdrom to mount point
# mount -t iso9660 /dev/sdc0 /media/data


Permanently mounting cdrom to mount point
# vim /etc/fstab
/dev/sdc0 /media/data iso9660 ro,user,noauto 0 0 
:wq


umounting cdrom
# umount /dev/sdc0


If unable to unmount the cdrom
# fuser -mk /dev/sdc0


To eject the cd from cdrom drive
# eject


Troubleshooting:
Testing for iso9660 filesystem is support or not in your linux system.


To search for loaded kernel modules with lsmod command or by reading a content of /proc/filesystem file
# cat /proc/filesystems | grep iso9660
or
# lsmod | grep iso9660

Read more...

Yum local Repository , using Redhat DVD


Steps by step as followed:


Make a directory rhel5 inside the /var/ftp/pub
# cd /var/ftp/pub
# mkdir rhel5

Mount the RHEL DVD and Moved all files to this Directory /var/ftp/pub/rhel5
# mkdir /mnt/cdrom
# mount -t iso9660 -o ro /dev/cdrom /mnt/cdrom
# cp -rvfp /mnt/cdrom/Server/ rhel5

4. Installed createrepo RPM
# rpm -ivh createrepo

5. Executed this command
# cd /rhel5/Server/
# createrepo -v .

6. Create a myown.repo file at the /etc/yum.repos.d/
# vi /etc/yum.repos.d/myown.repo
[localinfo]
name=MyOwnRepo
baseurl=file:///pub/rhel5/Server/
enabled=1
gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
:wq

Clean the cache and list all the rpms from the yum server
# yum clean all
# yum list

Read more...

Wednesday, August 10, 2011

Custom Error Page with .htaccess

404 Page Not Found
When you type wrong URL in a address bar for any website then you usually get the following error with the message.
The 404 is error code in http which represents that “file is not found” in the server.
To display your own custom error page:
create a .htaccess file in the root of the web server and place the following code in that file. 
ErrorDocument 404 /errror404.htm

This would cause any error code resulting in 404 to be forwarded to example.com/error404.html.
In the above line ErrorDocument is a server directive and 404 is the server status code and last part is the name of the error page created by yourself.

If you want to create the custom error page for the codes 404 and 400 (bad request) then you can put the two following lines in .htaccess file.
ErrorDocument 404 /errror404.htm
ErrorDocument 400 /errror400.htm


Note : Never try to put a ErrorDocument for code 200 which mean that page is found and causes the infinite loop in the server.

Read more...

Prevent Directory Listing using .htaccess

Directory Listing
Directory listing:
In most of the website contains “images” folder inside the root folder. If we type “www.example.com/images” in the browser and it shows the listing of the files in the browser like the image above which means that directory listing is allowed on that web server. It’s better not to show the files inside the directory of the web sever for the security purpose.

To prevent directory listing
Put the any one of following code into the .htaccess file
Options -Indexes

or

IndexIgnore *


If you don’t want to list “.jpp , .gif and .zip” and you don’t care about listing other files of that directory then you can out the following code inside .htaccess.
IndexIgnore *.gif *.jpg *.zip

If your want to allow directory listing then you can add the following code in the .htaccess file to allow the directory listing.
Options +Indexes
Read more...