일반적인 zLinux의 디스크 운영은 DASD 디스크와 FCP (scsi) 디스크의 혼합해서 운영을 하는 것이 일반적이다.
LVM으로 구성된 SCSI 영역을 Rebooting 없이 SCSI 영역을 Remove 하고..Port 또한 정상적으로 Remove 할수 있는
유용한 스크립트인듯 하다.. (첨부파일 참조)
A.1 Set all SCSI devices offline
File name:
/usr/local/sbin/remove_scsi_devices.sh
A.1 Set all SCSI devices offline
File name:
/usr/local/sbin/remove_scsi_devices.sh
File contents:
#!/bin/sh
#
# ------------------------------------------------------------------
# | REMOVES ALL SCSI DEVICES |
# | |
# | Author: Marc Beyerle (marc.beyerle@de.ibm.com), 12/12/2008 |
# | Copyright IBM Corp. 2008 |
# ------------------------------------------------------------------
#
# the sysfs directory containing all scsi devices
SYSFS_DIRECTORY="/sys/class/scsi_device"
if [ -e "${SYSFS_DIRECTORY}" ]; then
# change to the sysfs directory containing all scsi devices
cd "${SYSFS_DIRECTORY}"
# find all scsi devices
DEVICES=$(find . -maxdepth 1 | grep -v "^.$" | cut -c 3-)
else
# the sysfs directory for the scsi devices does not exist
DEVICES=""
fi
# print an empty line
echo
if [ -z "${DEVICES}" ]; then
# print information
echo "No SCSI devices found."
fi
# iterate over all scsi devices found
for DEVICE in ${DEVICES}; do
# change to this scsi device's directory
cd "${SYSFS_DIRECTORY}/${DEVICE}/device"
# print information
echo -n "Removing SCSI device ${DEVICE}... "
# remove this scsi device
echo 1 > delete
if [ "${?}" -eq "0" ]; then
# print success message (otherwise the error is printed above)
echo "OK"
fi
done
# print an empty line
echo
====================================================================
스크립트 수행후 lssci 명령어를 수행했을때 SCSI 디스크들이 보이지 않으면 정상..
그냥 가져다가 수행해도..잘 돌아가네..
LVM으로 구성된 SCSI 영역을 Rebooting 없이 SCSI 영역을 Remove 하고..Port 또한 정상적으로 Remove 할수 있는
유용한 스크립트인듯 하다.. (첨부파일 참조)
A.1 Set all SCSI devices offline
File name:
/usr/local/sbin/remove_scsi_devices.sh
A.1 Set all SCSI devices offline
File name:
/usr/local/sbin/remove_scsi_devices.sh
File contents:
#!/bin/sh
#
# ------------------------------------------------------------------
# | REMOVES ALL SCSI DEVICES |
# | |
# | Author: Marc Beyerle (marc.beyerle@de.ibm.com), 12/12/2008 |
# | Copyright IBM Corp. 2008 |
# ------------------------------------------------------------------
#
# the sysfs directory containing all scsi devices
SYSFS_DIRECTORY="/sys/class/scsi_device"
if [ -e "${SYSFS_DIRECTORY}" ]; then
# change to the sysfs directory containing all scsi devices
cd "${SYSFS_DIRECTORY}"
# find all scsi devices
DEVICES=$(find . -maxdepth 1 | grep -v "^.$" | cut -c 3-)
else
# the sysfs directory for the scsi devices does not exist
DEVICES=""
fi
# print an empty line
echo
if [ -z "${DEVICES}" ]; then
# print information
echo "No SCSI devices found."
fi
# iterate over all scsi devices found
for DEVICE in ${DEVICES}; do
# change to this scsi device's directory
cd "${SYSFS_DIRECTORY}/${DEVICE}/device"
# print information
echo -n "Removing SCSI device ${DEVICE}... "
# remove this scsi device
echo 1 > delete
if [ "${?}" -eq "0" ]; then
# print success message (otherwise the error is printed above)
echo "OK"
fi
done
# print an empty line
echo
====================================================================
스크립트 수행후 lssci 명령어를 수행했을때 SCSI 디스크들이 보이지 않으면 정상..
그냥 가져다가 수행해도..잘 돌아가네..
'Linux 이야기. > 유용한 쉘스크립트' 카테고리의 다른 글
리눅스 정기점검 스크립트 (0) | 2013.05.30 |
---|---|
System V를 이용한 솔루션 구동 스크립트 (0) | 2012.03.27 |
Remove All FCP Sysfs. (0) | 2011.08.29 |
Linux FileSystem Mount 체크 (0) | 2011.03.30 |