Red Hat 5 – hdc: open failed: No medium found
by dervish on Jun.21, 2011, under Red Hat
Error:
Starting monitoring for VG VolGroup00: /dev/hdc: open failed: No medium found
Fix:
[root@rh5-32 cache]# vgscan
Reading all physical volumes. This may take a while…
Found volume group “VolGroup00” using metadata type lvm2
Before:
[root@rh5-32 ~]# /etc/init.d/lvm2-monitor restart
Stopping monitoring for VG VolGroup00: /dev/hdc: open failed: No medium found
6 logical volume(s) in volume group “VolGroup00” unmonitored
[ OK ]
Starting monitoring for VG VolGroup00: /dev/hdc: open failed: No medium found
6 logical volume(s) in volume group “VolGroup00” monitored
[ OK ]
/etc/lvm/cache/.cache shows hdc:
# This file is automatically maintained by lvm.
persistent_filter_cache {
valid_devices=[
“/dev/VolGroup00/LogVol00_home”,
“/dev/mapper/VolGroup00-LogVol00_home”,
“/dev/VolGroup00/LogVol00_usr”,
“/dev/VolGroup00/LogVol00_var”,
“/dev/mapper/VolGroup00-LogVol00_var”,
“/dev/mapper/VolGroup00-LogVol00_usr”,
“/dev/sda1”,
“/dev/mapper/VolGroup00-LogVol00_root”,
“/dev/hdc”,
“/dev/VolGroup00/LogVol00_root”,
“/dev/VolGroup00/LogVol00_tmp”,
“/dev/root”,
“/dev/mapper/VolGroup00-LogVol00_tmp”,
“/dev/sda2”,
“/dev/mapper/VolGroup00-LogVol00_swap”,
“/dev/VolGroup00/LogVol00_swap”
]
}
After:
[root@rh5-32 cache]# /etc/init.d/lvm2-monitor restart
Stopping monitoring for VG VolGroup00: 6 logical volume(s) in volume group “VolGroup00” unmonitored
[ OK ]
Starting monitoring for VG VolGroup00: 6 logical volume(s) in volume group “VolGroup00” monitored
[ OK ]
New /etc/lvm/cache/.cache:
[root@rh5-32 cache]# cat /etc/lvm/cache/.cache
# This file is automatically maintained by lvm.
persistent_filter_cache {
valid_devices=[
“/dev/disk/by-path/pci-0000:00:10.0-scsi-0:0:0:0-part1”,
“/dev/ram11”,
“/dev/VolGroup00/LogVol00_home”,
“/dev/mapper/VolGroup00-LogVol00_home”,
“/dev/ram10”,
“/dev/ram”,
“/dev/disk/by-uuid/59b6dbd6-938b-4b6c-9b3d-570403ab5aff”,
“/dev/VolGroup00/LogVol00_usr”,
“/dev/disk/by-path/pci-0000:00:10.0-scsi-0:0:0:0-part2”,
“/dev/ram12”,
“/dev/VolGroup00/LogVol00_var”,
“/dev/mapper/VolGroup00-LogVol00_var”,
“/dev/mapper/VolGroup00-LogVol00_usr”,
“/dev/ram6”,
“/dev/ram13”,
“/dev/ram14”,
“/dev/ram5”,
“/dev/ram1”,
“/dev/sda1”,
“/dev/ramdisk”,
“/dev/mapper/VolGroup00-LogVol00_root”,
“/dev/VolGroup00/LogVol00_root”,
“/dev/ram0”,
“/dev/VolGroup00/LogVol00_tmp”,
“/dev/root”,
“/dev/mapper/VolGroup00-LogVol00_tmp”,
“/dev/disk/by-label/boot”,
“/dev/ram2”,
“/dev/sda2”,
“/dev/ram8”,
“/dev/ram9”,
“/dev/ram15”,
“/dev/mapper/VolGroup00-LogVol00_swap”,
“/dev/VolGroup00/LogVol00_swap”,
“/dev/ram3”,
“/dev/ram4”,
“/dev/ram7”
]
}
How to disable Spotlight in Snow Leopard
by dervish on Jun.09, 2011, under Snow Leopard
To disable Spotlight for all volumes:
sudo mdutil -a -i off
To enable Spotlight for all volumes:
sudo mdutil -a -i on
20110511: raidcheck.sh
by dervish on May.11, 2011, under Scripts
#!/bin/bash
# raidcheck.sh – Search for SAS1064 or Adaptec AAC-RAID controller and report failed/degraded drives
#
# 20091222 jah – Created by Jamey Hopkins
# 20110511 jah – Added support for more than 1 drive. Still defaults to controller 1.
# rm UcliEvt.log
# Code/error message cleanup/clarification.
process_mpt-status() {
ID=`grep Found status.0 | cut -f2 -d= | cut -f1 -d,`
/usr/sbin/mpt-status -i $ID -s >status.1
C1=`cat status.1 | grep phys_id | wc -l`
C2=`cat status.1 | grep phys_id | grep ONLINE | wc -l`
[ “$C1” = “0” ] && echo “No Drives Found”
[ “$C1” = “$C2” ] && echo “$C2 of $C1 Drives Are Online”
#echo “Controller ID=$ID”
if [ $C2 -lt $C1 ]
then
echo “ERROR: Failed SAS Drive Found”
echo “$C2 of $C1 Drives Are ONLINE”
echo
exit 2
fi
}
AACRAID=”0″;SAS1064=”0″
# search for SAS1064 controller
DATA=`/sbin/lspci | grep SAS1064 2>/dev/null`
if [ “$DATA” != “” ]
then
#echo Process SAS
SAS1064=”1″
# check if mptctl module is loaded
MPT=`/sbin/lsmod | grep mptctl 2>/dev/null`
[ ! -n “$MPT” ] && echo “mptctl module not loaded”
/usr/sbin/mpt-status -p >status.0 2>&1
grep “not found” status.0 >/dev/null
if [ “$?” = “0” -a ! -n “$MPT” ]
then
echo “mpt-status not found in /usr/sbin”
else
process_mpt-status
fi
fi
# search for Adaptec AAC-RAID controller
DATA=`/sbin/lspci | grep AAC-RAID 2>/dev/null`
if [ “$DATA” != “” ]
then
#echo Process AAC-RAID
AACRAID=”1″
STATE=`/usr/StorMan/arcconf getconfig 1 | grep “Logical devices/Failed/Degraded” | cut -f2 -d: | xargs echo`
#echo state is -${STATE}-
#STATE=”1/0/1″ # Set STATE for Testing
STATE2=`echo $STATE | cut -f2 -d’/’`
STATE3=`echo $STATE | cut -f3 -d’/’`
if [ “$STATE2” != “0” -o “$STATE3” != “0” ]
then
echo “ERROR: AAC-RAID Error – Devices/Failed/Degraded $STATE”
echo
exit 2
else
echo “AAC-RAID: No Failed or Degraded Drives Found.”
fi
fi
if [ $SAS1064 = 0 -a $AACRAID = 0 ]
then
echo “No supported controllers found.”
fi
rm status.0 status.1 >/dev/null 2>&1
rm UcliEvt.log >/dev/null 2>&1
exit 0
Move LVM Volume Group To New Larger Drive
by dervish on May.09, 2011, under Linux
Shutdown server and add new drive to system, then after power on:
fdisk /dev/sdb # set partion type to 8e
pvcreate /dev/sdb1
vgextend Volume00 /dev/sdb1
pvmove -n /dev/mapper/Volume00-external /dev/sda2 /dev/sdb1
lvextend -L +47G /dev/mapper/Volume00-external
ext2online /dev/mapper/Volume00-external
sdb=New Drive, Volume00=Volume Group, Volume00-external=Logical Volume
Support Commands: lvdisplay, vgdisplay sfdisk -s, df
Create Additional Swap Space
by dervish on May.05, 2011, under Linux
Use a File for Additional Swap Space
If you don’t have additional disk, you can create a file on your filesystem, and use the file for swap space.
Using dd, create a swap file with the name “swap_file” under /root directory with a size of 4096MB (4GB).
# dd if=/dev/zero of=/root/swap_file bs=1M count=4096
4096+0 records in
4096+0 records out
4294967296 bytes (4.3 GB) copied, 136.328 s, 31.5 MB/s
# ls -lh /root/swap_file
-rw-r–r– 1 root root 4.0G May 5 14:43 swap_file
Change the permission of the swap file so that only root can access it.
# chmod 600 /root/swap_file
Mark this file as a swap file using the mkswap command.
# mkswap /root/swap_file
Setting up swapspace version 1, size = 4194300 KiB no label, UUID=982c0db9-d522-4f08-a072-29168de28c64
Enable the newly created swapfile.
# swapon /root/swap_file
To make this swap file available as a swap area even after the reboot, add the following line to the /etc/fstab file.
# grep swap_file /etc/fstab
/root/swap_file swap swap defaults 0 0
Verify whether the newly created swap area is available for your use.
# swapon -s
Filename Type Size Used Priority
/dev/dm-1 partition 1048572 9272 -1
/root/swap_file file 4194300 0 -2
# free
total used free shared buffers cached
Mem: 508772 492700 16072 0 39384 311016
-/+ buffers/cache: 142300 366472
Swap: 5242872 9272 5233600
Note: In the output of swapon -s command, the Type column will say “file” if the swap space is created from a swap file.
If you don’t want to reboot to verify whether the system takes all the swap space mentioned in the /etc/fstab, you can do the following, which will disable and enable all the swap partition mentioned in the /etc/fstab.
# swapoff -a
# swapon -a
To increase swap by extending a Logical Volume:
# cat /proc/swaps
Filename Type Size Used Priority
/dev/mapper/Volume00-lv_swap partition 16777208 208 -1
# swapoff /dev/Volume00/lv_swap
# lvextend -L +900M /dev/Volume00/lv_swap
# mkswap /dev/Volume00/lv_swap
# swapon /dev/Volume00/lv_swap