Remove or change timestamp in WordPress

February 3rd, 2010

In your wordpress installation directory go to /wp-content/themes/default/single.php file and search for the_time().  You will see a line like this:

on <?php the_time(‘l, F jS, Y’) ?> <?php the_time() ?>

First instance of the_time() used parameters l, F jS, Y which represent day of the week, month, day in month and year. Second instance of the_time() returns only the time, so you’ll want to remove <?php the_time() ?> part in case you want to disable the timestamp at the end of your wordpress posts, os you may want to change parameters in first instance of the_time() to get different date format.

Enable ssh in Netapp’s Ontap

February 3rd, 2010

When connected via console type:

netapp> secureadmin setup ssh
SSH Setup
———
Determining if SSH Setup has already been done before…no

SSH server supports both ssh1.x and ssh2.0 protocols.

SSH server needs two RSA keys to support ssh1.x protocol. The host key is
generated and saved to file /etc/sshd/ssh_host_key during setup. The server
key is re-generated every hour when SSH server is running.

SSH server needs a RSA host key and a DSA host key to support ssh2.0 protocol.
The host keys are generated and saved to /etc/sshd/ssh_host_rsa_key and
/etc/sshd/ssh_host_dsa_key files respectively during setup.

SSH Setup will now ask you for the sizes of the host and server keys.
For ssh1.0 protocol, key sizes must be between 384 and 2048 bits.
For ssh2.0 protocol, key sizes must be between 768 and 2048 bits.
The size of the host and server keys must differ by at least 128 bits.

Please enter the size of server key for ssh1.x protocol [512] :
Please enter the size of host keys for ssh2.0 protocol [768] :

You have specified these parameters:
host key size = 2048 bits
server key size = 512 bits
host key size for ssh2.0 protocol = 768 bits
Is this correct? [yes]

Setup will now generate the host keys. It will take a minute.
After Setup is finished the SSH server will start automatically.

netapp> Wed Feb  3 11:35:51 EST [netapp: secureadmin.ssh.setup.success:info]: SSH setup is done and ssh2 should be enabled. Host keys are stored in /etc/sshd/ssh_host_key, /etc/sshd/ssh_host_rsa_key, and /etc/sshd/ssh_host_dsa_key.

netapp> Wed Feb  3 11:36:14 EST [netapp: openssh.invalid.channel.req:warning]: SSH client (SSH-2.0-OpenSSH_4.3) from 192.168.1.25 sent unsupported channel request (10, env).

To verify that ssh1 has been disabled, run:

netapp> secureadmin status
ssh2    – active
ssh1    – inactive
ssl     – inactive

Disable nwam on Opensolaris and manually configure IP settings

December 27th, 2009

Nwam stands for “Network Auto-Magic” and is part of Opensolaris project. It is meant to automatically configure IP settings for primarily laptop users. While it is useful to an extent, real annoyance is that is enabled by default (I guess it is supposed to be, otherwise it wouldn’t serve its purpose) upon Opensolaris installation. If you want to manually setup your IP, do the following:

svcadm disable svc:/network/physical:nwam

make sure that everything looks good in the following files:
/etc/hosts
IP hostname hostname.domain

/etc/resolv.conf
#Google’s name servers, easy to remember
nameserver 8.8.8.8
nameserver 8.8.4.4

/etc/defaultrouter
IP_of_your_router

/etc/hostname.yge0
IP_of_the_host

/etc/nsswitch.conf
hosts: files dns

/etc/inet/netmasks
#for 192.168.1 network it would be
192.168.1.0 255.255.255.0

svcadm enable svc:/network/physical:default

root@opensolaris:/etc/inet# dladm show-link
LINK CLASS MTU STATE BRIDGE OVER
yge0 phys 1500 up — –

If any any time you experience difficulties, run ‘svcs -x’ (no quotes) to see which service has a problem and what is causing it. To list all services running, type ‘svcs’, to list all services including disabled ones type ‘svcs -a’.
These changes are persistent across reboots.

Install Solutions Enabler on Linux

December 14th, 2009

Installing solutions enabler on Redhat/Centos 5.x will fail, it looks like latest version of Redhat/Centos that work with Solutions Enabler is 4.8. To install Solutions Enabler to Redhat/Centos 4.8, gunizip and untar file you have downloaded from powerlink and run (this will install with all default):

[root@labhost12 emc]# ./se6520_install.sh -install -silent

#—————————————————————————-
# EMC Installation Manager
#—————————————————————————-
Copyright 2007, EMC Corporation
All rights reserved.

The terms of your use of this software are governed by the
applicable contract.

Solutions Enabler Native Installer[RT] Kit Location : /root/emc

Checking for OS version compatibility……
Checking for previous installation of Solutions Enabler……

Checking for active processes…..
Checking for /usr/symcli/storbin/cimserver…
Checking for /usr/symcli/bin/symapisrv…

Checking for active SYMCLI components…

Checking for LIBGCC version compatibility……

Checking for disk space availability….

Installing symcli-datacore-V6.5.2-0.i386.rpm…..

Installing symcli-datastorbase-V6.5.2-0.i386.rpm…..

Installing symcli-core-V6.5.2-0.i386.rpm…..

Installing symcli-storbase-V6.5.2-0.i386.rpm…..

Installing symcli-srmbase-V6.5.2-0.i386.rpm…..

Installing symcli-storfull-V6.5.2-0.i386.rpm…..

Installing symcli-symcli-V6.5.2-0.i386.rpm…..

Installing symcli-star_perl-V6.5.2-0.i386.rpm…..

Installing symcli-symrecover-V6.5.2-0.i386.rpm…..

Installing symcli-64bit-V6.5.2-0.x86_64.rpm…..

Creating OPENSSL Certificate….

Enabling stordaemon…

Do not forget to run ‘symcfg discover’ after the installation
completes and whenever your configuration changes.

You may need to manually rediscover remotely connected
arrays. Please see the installation notes for further
information.

#—————————————————————————–
# The following HAS BEEN INSTALLED in /opt/emc via the rpm utility.
#—————————————————————————–
ITEM PRODUCT VERSION
01 EMC Solutions Enabler V6.5.2.0
RT KIT
#—————————————————————————–

That will install symcli commands to /opt/emc/SYMCLI/V6.5.2/bin

Now you need to copy symapi license key file in its place, and you are done.

Deals on Black Friday 2009

November 26th, 2009

There are several good websites where you can see what are the black friday deals. I like http://bfads.net/ which seems to have most complete list of the deals. Techbargains.com is good because it provides frequently updated list of black friday deals which are available online. I think with little bit of searching you can get most of the things available in store also online. If you are going to store, you’ll have to wait in line where you’ll face some tough competition, below is a photo of people waiting in line at 7PM day before black friday in front of local Germantown, MD Best Buy.

Line in front of Best Buy at 7pm day before Black friday

Line in front of Best Buy at 7pm day before Black friday

Brocade switch firmware upgrade

November 23rd, 2009

I have found old Brocade 3250 lying around with FOS 4.2.0b:

SW2:admin> firmwareShow
Primary partition: v4.2.0b
Secondary Partition: v4.2.0b

Brocade supports firmware upgrades within two feature releases (a feature release is a major release indicated by the second digit “Y” of the release number, for example, X.Y.Z); while upgrades of two releases is supported, single release upgrades are recommended. Following are the major upgrade versions for the Fabric OS:
- v4.0
- v4.1
- v4.2
- v4.4.0
- v5.0.1
- v5.1.0
- v5.3.0
- v6.0.1
- v6.2.3

It is advised that you upload your switch config by running configUpload before running firmware upgrade.

Gotcha during the firmware upgrade is when asked for file name to use a file name without architecture directory which is different for different types of switches (starts with SWBDxx)

drwxr-xr-x 2 dnd dnd 4096 Jun 13 2006 SWBD26
drwxr-xr-x 2 dnd dnd 4096 Jun 13 2006 SWBD27
drwxr-xr-x 2 dnd dnd 4096 Jun 13 2006 SWBD29
drwxr-xr-x 2 dnd dnd 4096 Jun 13 2006 SWBD31
drwxr-xr-x 2 dnd dnd 4096 Jun 13 2006 SWBD32
drwxr-xr-x 2 dnd dnd 4096 Jun 13 2006 SWBD33

this directory is selected automatically during the download, so you need to omit it when asked for file name.

SW2:admin> firmwareDownload
You can run firmwareDownloadStatus to get the status
of this command.

This command will cause the switch to reset and will
require that existing telnet, secure telnet or SSH
sessions be restarted.

Do you want to continue [Y]: y
Server Name or IP Address: 192.168.1.25
User Name: dnd
File Name: /home/dnd/fos/v4.4.2b/release.plist
Password:
Firmwaredownload has started.
Start to install packages……
dir ##################################################
ldconfig ##################################################
glibc ##################################################
….

Write kernel image into flash.
………………………….
Verification SUCCEEDED
All packages have been downloaded successfully.
Firmwaredownload has completed successfully.
HA Rebooting …

after reboot run:

SW2:admin> firmwareShow
Primary partition: v4.4.2b
Secondary Partition: Version is not available

firmware is committing to secondary partition so version info is not yet available. After few min:

SW2:admin> firmwareShow
Primary partition: v4.4.2b
Secondary Partition: v4.4.2b

done. Time to update to FOS 5.x.x

Note: if you don’t want reboot and firmwareCommit to be performed automatically, run ‘firmwareDownload -s’ and you’ll get an option to disable reboot and auto firmwareCommit when runing firmwareDownload, here is an example:

SW2:admin> firmwareDownload -s
Server Name or IP Address: 192.168.1.25
User Name: dnd
File Name: /home/dnd/fos/v5.0.5f/release.plist
Password:
Do Auto-Commit after Reboot [Y]: N
Reboot system after download [N]: N
Firmwaredownload has started.
Start to install packages……
dir ##################################################
ldconfig ##################################################

sysstat ##################################################
Write kernel image into flash.
………………………….
Verification SUCCEEDED
Removing unneeded files, please wait …
Finished removing unneeded files.

All packages have been downloaded successfully.
Firmwaredownload has completed successfully.
SW2:admin> firmwareshow
Primary partition: v4.4.2b
Secondary Partition: v5.0.5f
SW2:admin> reboot

after reboot:

SW2:admin> firmwareshow
Primary partition: v5.0.5f
Secondary Partition: v4.4.2b
SW2:admin> firmwareCommit
Validating primary partition…
Doing firmwarecommit now.
Please wait …
Replicating kernel image.
…………………………..
Firmwarecommit completes successfully.
SW2:admin> firmwareshow
Primary partition: v5.0.5f
Secondary Partition: v5.0.5f

If you skip a firmware version when you run firmwareDownload, upgrade will fail:

SW2:admin> firmwareDownload -s
Server Name or IP Address: 192.168.1.25
User Name: dnd
File Name: /home/dnd/fos/v5.3.2a/release.plist
Password:
Do Auto-Commit after Reboot [Y]: Y
Reboot system after download [N]: Y
Firmwaredownload has started.
Cannot upgrade directly to 5.3. Please upgrade to 5.1 or 5.2 first and then upgrade to 5.3.
Firmwaredownload failed. (0×29) The pre-install script failed.

useful doc which also explains firmware upgrade process for switches with dual CPs: https://www.eng.utoledo.edu/ecc/secure-docs/user/sun_docs/brocade_3850/53_1000039_02.pdf

Create Ramdisk in Opensolaris

November 16th, 2009

There are couple of ways at least to create a ramdisk in Opensolaris and the one described here is using ramdiskadm command:

root@opensolaris:~# pfexec ramdiskadm -a ramdisk1 512m
/dev/ramdisk/ramdisk1

we have just created 512MB ramdisk . To verify:

root@opensolaris:~# ramdiskadm
Block Device Size Removable
/dev/ramdisk/ramdisk1 536870912 Yes

then we add previously created ramdisk to zpool:

root@opensolaris:~# zpool create rampool /dev/ramdisk/ramdisk1

root@opensolaris:~# zfs list
NAME USED AVAIL REFER MOUNTPOINT
rampool 70K 472M 19K /rampool
rpool 6.83G 287G 81K /rpool
rpool/ROOT 3.04G 287G 19K legacy
rpool/ROOT/opensolaris 8.55M 287G 2.87G /
rpool/ROOT/opensolaris-1 3.03G 287G 2.87G /

we can see that out rampool ram disk is mounted /rampool

root@opensolaris:~# ls -la /rampool/
total 3
drwxr-xr-x 2 root root 2 2009-11-15 22:52 .
drwxr-xr-x 26 root root 27 2009-11-15 22:47 ..

root@opensolaris:~# zpool status
pool: rampool
state: ONLINE
scrub: none requested
config:

NAME STATE READ WRITE CKSUM
rampool ONLINE 0 0 0
/dev/ramdisk/ramdisk1 ONLINE 0 0 0

errors: No known data errors

pool: rpool
state: ONLINE
scrub: none requested
config:

NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
c10d1s0 ONLINE 0 0 0

errors: No known data errors

our ram disk is now ready to be used.

Fix failed LVM partition

November 9th, 2009

These instructions are made by using Knoppix Live CD or other Knoppix boot media. During recent reboot, I got the following message on the screen:

No devices found
Setting up Logical Volume Management: No Volume groups found
[ OK ]
Checking filesystems
fsck.ext3: No such file or directory while trying to open /dev/VolGroup00/LogVol00
/dev/VolGroup00/LogVol00:
The superblock could not be read or does not describe a correct ext2 filesystem. If the device is valid and it really contains an ext2 filesystem ( and not swap or ufs or something else), then the superblock is corrupt, and you might thy running e2fsck with and alternate superblock:
e2fsck -b 8193

[FAILED]

*** An error orrured during the file system check.
*** Droping you to a shell; the system will reboot
*** when you leave the shell.
Give root password for maintenance
(or type Control-D to continue):

And this does not looks good, but it may just mean that your system did not shut down cleanly. On the computer with the lvm partition that has a problem, boot with Knoppix boot media and become root (sudo su -)

Then run vgscan to find LVM volumes:

root@Microknoppix:~# vgscan
Reading all physical volumes. This may take a while…
Found volume group “VolGroup00″ using metadata type lvm2

and vgchange -a y to make LVM volumes active:

root@Microknoppix:~# vgchange -a y
2 logical volume(s) in volume group “VolGroup00″ now active

List the LVM volumes:

root@Microknoppix:~# lvs
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
LogVol00 VolGroup00 -wi-a- 72.44G
LogVol01 VolGroup00 -wi-a- 1.94G

Now we can run fsck on the LVM volume that had a problem:

root@Microknoppix:/# fsck /dev/mapper/VolGroup00-LogVol00
fsck 1.41.3 (12-Oct-2008)
e2fsck 1.41.3 (12-Oct-2008)
Adding dirhash hint to filesystem.

/dev/mapper/VolGroup00-LogVol00 primary superblock features different from backup, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information

/dev/mapper/VolGroup00-LogVol00: ***** FILE SYSTEM WAS MODIFIED *****
/dev/mapper/VolGroup00-LogVol00: 204004/19005440 files (1.5% non-contiguous), 3271409/18989056 blocks

another fsck to verify that everything is good this time:

root@Microknoppix:/# fsck /dev/mapper/VolGroup00-LogVol00
fsck 1.41.3 (12-Oct-2008)
e2fsck 1.41.3 (12-Oct-2008)
/dev/mapper/VolGroup00-LogVol00: clean, 204004/19005440 files, 3271409/18989056 blocks

check VG:

root@Microknoppix:/# vgdisplay
— Volume group —
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 74.38 GB
PE Size 32.00 MB
Total PE 2380
Alloc PE / Size 2380 / 74.38 GB
Free PE / Size 0 / 0
VG UUID o8wP8s-605P-cP85-EnQh-r73x-bElI-27Ldub

mount the volume:

root@Microknoppix:~# mount /dev/mapper/VolGroup00-LogVol00 /mnt
root@Microknoppix:~# ls -la /mnt
total 224
drwxr-xr-x 26 root root 4096 Nov 6 20:21 .
drwxr-xr-x 15 root root 0 Nov 9 16:29 ..
-rw-r–r– 1 root root 0 Feb 5 2009 .autorelabel
drwxr-xr-x 3 root root 4096 Nov 5 23:04 app
drwxr-xr-x 2 root root 4096 Jun 18 08:11 bin
drwxr-xr-x 2 root root 4096 Feb 5 2009 boot
drwxr-xr-x 2 root root 4096 Feb 6 2009 cstr
drwxr-xr-x 4 root root 4096 Feb 5 2009 dev
drwxr-xr-x 109 root root 12288 Nov 6 20:21 etc
-rw-r–r– 1 root root 0 Nov 6 20:20 halt
drwxr-xr-x 4 root root 4096 Nov 5 23:03 home
drwxr-xr-x 12 root root 4096 Sep 30 19:53 lib
drwxr-xr-x 7 root root 12288 Oct 1 08:03 lib64
drwx—— 2 root root 16384 Feb 5 2009 lost+found
drwxr-xr-x 2 root root 4096 Mar 11 2009 media
drwxr-xr-x 2 root root 4096 May 25 2008 misc
drwxr-xr-x 2 root root 4096 Mar 11 2009 mnt
dr-xr-xr-x 2 root root 4096 Feb 6 2009 net
drwxr-xr-x 3 root root 4096 Mar 11 2009 opt
drwxr-xr-x 2 root root 4096 Feb 5 2009 proc
drwxr-x— 7 root root 4096 Nov 6 20:20 root
drwxr-xr-x 2 root root 12288 Oct 1 08:03 sbin
drwxr-xr-x 2 root root 4096 Mar 11 2009 selinux
drwxr-xr-x 2 root root 4096 Mar 11 2009 srv
drwxr-xr-x 2 root root 4096 Feb 5 2009 sys
drwxrwxrwt 11 root root 4096 Nov 6 20:20 tmp
drwxr-xr-x 16 root root 4096 Nov 5 22:56 usr
drwxr-xr-x 26 root root 4096 Jun 17 17:04 var
-rw-r–r– 1 root root 1658 Oct 5 17:02 xfs_8p_4k.wks

everything looks good so far, so I unmounted /mnt partition, run sync couple of times and rebooted without Knoppix media

Create bootable Linux USB drive

November 9th, 2009

It is very easy, thanks to Knoppix. On the http://www.knopper.net/knoppix/knoppix60-en.html page is described how to create bootable Knoppix USB (or other flash media) drive (and it works).

Booting from Flash

In order to create a bootable USB-medium (memory flashdisk, SD-card, digital camera with USB connector, cellphone with microSD, …), the program flash-knoppix can be started from a running Knoppix system. This program installs all needed Knoppix files onto the FAT-formatted flashdisk, and creates a boot record for it. Other files on the medium stay intact, since no repartitioning or formatting is done by flash-knoppix.

After having copied the system to flash, using the persistent Knoppix image (overlay feature), it is possible to also store files permanently in live mode. That way, personal settings and additionally installed programs survive a reboot.

flash-knoppix is supposed to be able to install Knoppix on existing FAT partition, that didn’t work for me. I had to partition USB flash drive and install vfat file system on it.
So, to do that, with fdisk -l you can see what is device name that is assigned to your USB flash drive (/dev/sdb for example), then you need to partition it (fdisk /dev/sdb (if /dev/sdb is device name for your USB drive)) use the menu to remove all partitions, and then create at least 1 partition in fdisk, save partition table and exit fdisk. Then create vfat partition by running mkfs.vfat /dev/sdb1 and then run ‘flash-knoppix /dev/sdb1′.
On the 2GB USB flash drive, I have created 2 x 1GB partitions, one for Knoppix and one saving my data. When you boot from Knoppix bootable USB flash drive, you’ll be asked to specify amount of space you want to dedicate for saving your data.

Disk partition aligment

November 2nd, 2009

Misaligned partitions can affect disk I/O peformance by 30% or more for random I/O. Test on this page http://sqlblog.com/blogs/linchi_shea/archive/2007/02/01/performance-impact-of-disk-misalignment.aspx confirm that.

The article below is from “EMC Host Connectivity Guide for Linux” and is described for CLARiiONs, but it equally applies to LUNs provided by other storage arrays:

File-system misalignment affects performance in two ways:

? Misalignment causes disk crossing: an I/O broken across two
drives (where normally one would service it).
? Misalignment makes it hard to stripe-align large uncached writes.

The first case is more commonly encountered. Even if the disk
operations are buffered by cache, the effect can be detrimental, as it
will slow flushing from the cache. Random reads, which by nature
require disk access, are also affected, both directly (waiting for two
drives in order to return data) and indirectly (making the disks busier
than they need to be).
Alignment issues only affect striped LUNs, so RAID 1 is not affected.
However, two disk RAID 1/0 groups are now allowed. They will use
striping once expanded to four or more disks and should be aligned
from the outset.
For greater detail on this and other performance issues regarding the
CLARiiON array, please refer to Powerlink and search for EMC
CLARiiON Best Practices for Fibre Channel Storage.
Aligning the partition
In Linux, align the partition table before data is written to the LUN as
the partition map will be rewritten and all data on the LUN
destroyed. In the following example, the LUN is mapped to
/dev/emcpowerah, and the LUN stripe element size is 128 blocks.
Arguments for the fdisk(8) utility are as follows:
root #> fdisk /dev/emcpowerah

enter x expert mode
enter b adjust starting block number
enter 1 choose partition 1
enter 128 set it to 128, our stripe element size
enter w write the new partition

This method is preferable to the Navisphere LUN alignment offset
method for LUNs that will have a snapshot, BCV, or MirrorView
image made of them. It is preferred for SANCopy sources and targets
as well.

Here is process for partition alignment for windows (from http://technet.microsoft.com/en-us/library/aa995867%28EXCHG.65%29.aspx):

To align Exchange I/O with storage track boundaries using Diskpart.exe

1.

If the disk you are aligning is already blank (raw), proceed to Step 3. If the disk contains data, backup the disk before proceeding.
2.

Delete all partitions on the disk.
3.

Open a command prompt, and execute Diskpart.exe.
4.

At the Diskpart command prompt, type List Disk and press Enter. If the disk you want to align does not appear in the list make sure that it exists and is accessible using the Disk Management snap-in.
5.

At the Diskpart command prompt, type Select Disk X, where X is the number of the disk as shown in the output of the List Disk command. Diskpart should return a message that indicates that Disk X is the selected disk.
6.

At the Diskpart command prompt, type Create Partition Primary Align=X, where X is either 32 or 64, depending on the recommendation from your storage vendor. If your storage vendor does not have any specific recommendations, it is recommended that you use 64.
7.

At the Diskpart command prompt, type Assign Letter=. For example, to assign letter Z to the disk, type Assign Letter=Z.
8.

Once the drive letter is assigned, type exit to exit out of the Diskpart utility.
9.

Use the Disk Management snap-in or the Windows Format command to format the partition as an NTFS-formatted partition.

Vista seems to be aligning its disk partitions while XP 32-bit and 64-bit are not.