From Igor personal wiki
Jump to: navigation, search

Rescan SCSI or FC devices[edit]

When you are playing with SCSI devices (like Fibre Channel, SAS, ..) you sometimes need to rescan the SCSI bus to add devices or to tell the kernel a device is gone. Well, this is the way to do it in CentOS with versions that have a 2.6 kernel. This means CentOS 5 and CentOS 4 (starting from update 3).

Find what's the host number for the HBA:

ls /sys/class/fc_host/

(You'll have something like host1 or host2, I'll refer to them as host$NUMBER from now on)

Ask the HBA to issue a LIP signal to rescan the FC bus:

echo 1 >/sys/class/fc_host/host$NUMBER/issue_lip

Wait around 15 seconds for the LIP command to have effect

Ask Linux to rescan the SCSI devices on that HBA:

echo - - - >/sys/class/scsi_host/host$NUMBER/scan

The wildcards "- - -" mean to look at every channel, every target, every lun.

Rescan for after disk was extended[edit]

echo "1" > /sys/block/sda/device/rescan

How to use a new partition in RHEL6 without reboot?[edit]

partx -a /dev/sd

Use cases:[edit]

existing disk extending on RH6

echo 1 > /sys/block/sda/device/rescan
fdisk -l
fdisk /dev/sda
partx /dev/sda
partx -a /dev/sda
pvcreate /dev/sda4
vgextend VG01 /dev/sda4
lvextend -L +14G /dev/VG01/logs 
lvextend -L +14G /dev/VG01/var 
resize2fs /dev/VG01/logs
resize2fs /dev/VG01/var
df -h