Category: Linux

cannot fork [Resource temporarily unavailable]

Tried to login to a Linux server but gave the error cannot fork [Resource temporarily unavailable]

ssh oracle@linux
/etc/profile[62]: .[5]: .: line 46: cannot fork [Resource temporarily unavailable]

Saw how many processes oracle user has

root@linux:~ # ps -ef | grep oracle | wc -l
2038

Then increased the number of processes

root@linux:~ # vi /etc/security/limits.conf
#oracle soft nproc 2048
oracle soft nproc 4096

HP Multipath Device Mapper for Linux Software

Previously HP had a kit to enable the native open-source multipathing solution called Device Mapper Multipath Enablement Kit for HP StorageWorks Disk Arrays

Nowadays HP recommends to read a document called Native Linux Device-Mapper Multipath for HP StorageWorks Disk Arrays reference guide to enable the native open-source multipathing solution.

Linux – Adding timestamp to history

root@linux:~ # history
2 2013-03-18 15:08:24 vi df_mon.cfg
3 2013-03-18 15:08:38 /var/opt/OV/bin/instrumentation/UXMONbroker -d psmon
4 2013-03-18 15:08:41 ps -ef |grep -i scopeux
5 2013-03-18 15:09:11 perfstat

To have the time and date of when the command is issued when using the bash shell, add the following statement to your .bashrc file

export HISTTIMEFORMAT=”%F %T “

Error adding disk partition to LVM – Device /dev/mapper/mpath1p1 not found (or ignored by filtering)

I’ve tried to add a disk partition to the LVM but I was receiving the message “Device /dev/mapper/mpath1p1 not found (or ignored by filtering)”

root@linux:~ # multipath -ll mpath1
mpath1 (360060e800573b800000073b800001703) dm-24 HP,OPEN-V*3
[size=500G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
\_ 0:0:0:4 sdi 8:128 [active][ready]
\_ 1:0:0:4 sdk 8:160 [active][ready]

I created a new msdos label on this disk, partitioned the disk and then I ran kpartx to make the partition available to the operating system

root@linux:~ # kpartx -a /dev/mapper/mpath1

The device file was created

root@linux:~ # ls -l /dev/mapper/mpath1*
brw-rw—- 1 root disk 253, 24 Feb 22 17:22 /dev/mapper/mpath1
brw-rw—- 1 root disk 253, 27 Feb 22 17:24 /dev/mapper/mpath1p1

Checking the disk partition

root@linux:~ # fdisk -l /dev/mapper/mpath1

Disk /dev/mapper/mpath1: 536.8 GB, 536871567360 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/mapper/mpath1p1 1 65270 524281243+ 8e Linux LVM

I running into trouble to add this disk partition to the LVM.

root@linux:~ # pvcreate /dev/mapper/mpath1p1
Device /dev/mapper/mpath1p1 not found (or ignored by filtering).

This problem was resolved by editing the file /etc/lvm/lvm.conf and configuring the following filter

filter = [ “a|cciss/.*|”, “a|mapper/.*|”, “r|/dev/sd.*|”, “r|/dev/dm-.*|” ]

Install Java in Red Hat Enterprise Linux 5

To install Java in RHEL 5, you enable the RHEL Server Supplementary and then install the java-1.6.0-sun and java-1.6.0-sun-plugin packages

root@rhel5:/ # yum install java-1.6.0-sun-plugin

Logrotate configuration for nscd

I wrote a section for nscd log rotation

Edited /etc/logrotate.conf file and added:

# system-specific logs may be also be configured here.
/var/log/nscd.log {
missingok
size 100M
create 644 root root
rotate 4
postrotate
/bin/kill -HUP `cat /var/run/nscd/nscd.pid 2> /dev/null` 2> /dev/null || true
endscript
}

I followed the HowTo: The Ultimate Logrotate Command Tutorial with 10 Examples

Checking the hard drive model in an HP Smart Array

To discover the model of the hard drive that is in an HP Smart Array, type the following command

root@linux:~ # hpacucli ctrl all show config detail

Smart Array P400i in Slot 0 (Embedded)
Bus Interface: PCI
Slot: 0
Serial Number:
Cache Serial Number: PA82C0H9SV5DJS
RAID 6 (ADG) Status: Disabled
Controller Status: OK
Chassis Slot:
Hardware Revision: Rev D
Firmware Version: 7.22
Rebuild Priority: Medium
Expand Priority: Medium
Surface Scan Delay: 15 secs
Post Prompt Timeout: 0 secs
Cache Board Present: True
Cache Status: OK
Accelerator Ratio: 100% Read / 0% Write
Drive Write Cache: Disabled
Total Cache Size: 256 MB
No-Battery Write Cache: Disabled
Battery/Capacitor Count: 0
SATA NCQ Supported: True

Array: A
Interface Type: SAS
Unused Space: 0 MB
Status: Failed

Logical Drive: 1
Size: 136.7 GB
Fault Tolerance: RAID 1
Heads: 255
Sectors Per Track: 32
Cylinders: 35132
Stripe Size: 128 KB
Status: Interim Recovery Mode
Array Accelerator: Enabled
Unique Identifier: 600508B100184839535635444A530004
Disk Name: /dev/cciss/c0d0
Mount Points: /boot 1.0 GB
Logical Drive Label: A01123B864C1
Mirror Group 0:
physicaldrive 1I:1:1 (port 1I:box 1:bay 1, SAS, 146 GB, OK)
Mirror Group 1:
physicaldrive 1I:1:2 (port 1I:box 1:bay 2, SAS, 0 MB, Failed)

physicaldrive 1I:1:1
Port: 1I
Box: 1
Bay: 1
Status: OK
Drive Type: Data Drive
Interface Type: SAS
Size: 146 GB
Rotational Speed: 10000
Firmware Revision: HPDC
Serial Number: 3NM7VLAB00009915WTN0
Model: HP DG146BB976
PHY Count: 2
PHY Transfer Rate: 3.0GBPS, Unknown
physicaldrive 1I:1:2
Port: 1I
Box: 1
Bay: 2
Status: Failed
Drive Type: Data Drive
Interface Type: SAS
Size: 0 MB
Firmware Revision: HPDC
Serial Number: READ_CAPACITY FAILED
Model: HP DG146BB976
PHY Count: 1
PHY Transfer Rate: Unknown

This will be handy when you have to replace a faulty disk

root@linux:~ # hpacucli ctrl all show config

Smart Array P400i in Slot 0 (Embedded) (sn: )

array A (SAS, Unused Space: 0 MB)

logicaldrive 1 (136.7 GB, RAID 1, Interim Recovery Mode)

physicaldrive 1I:1:1 (port 1I:box 1:bay 1, SAS, 146 GB, OK)
physicaldrive 1I:1:2 (port 1I:box 1:bay 2, SAS, 0 MB, Failed)

This can be of interest – HP/Compaq Hard Disk Drives – Hard Drive Model Number Matrix

Getting IP address after installing CentOS / Red Hat Linux in a virtual machine

I installed a VirtualBox/Parallels Desktop virtual machine with CentOS 6 and it didn’t automatically set up the network card with DHCP. I needed to add the following configuration to the file

root@centos:/etc/sysconfig/network-scripts # vi ifcfg-eth0
DEVICE=”eth0″
HWADDR=”00:1C:42:C0:FF:EE”
NM_CONTROLLED=”yes”
ONBOOT=”yes
BOOTPROTO=”dhcp”

Then restart the network service

root@centos:/etc/sysconfig/network-scripts # service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0:
Determining IP information for eth0… done.
[ OK ]

rpm error: failed to stat /media: Input/output error

I had a system where the rpm command was very slow after I was trying to upgrade a package

root@rhel5:~ # rpm -Uvh /tmp/kexec-tools-1.102pre-154.el5.x86_64.rpm
error: failed to stat /media: Input/output error
Preparing… ########################################### [100%]
1:kexec-tools warning: /etc/kdump.conf created as /etc/kdump.conf.rpmnew
########################################### [100%]

The filesystem /media is a NFS share. The server that was hosting the NFS was down and the rpm command was slow because it tried to stat the filesystem.

OCFS2 Support for LVM/LVM2

Here is the official document about Oracle Linux Support for GFS, LVM and LVM2 (Doc ID 423207.1)

As of latest update of this document any combination of OCFS2 with LVM or LVM2 is not supported including clustered and single node configurations.