📄 iscsi_mount
字号:
#!/bin/bash# This script attempts to mount file systems on UNH iSCSI DisksUNH_ISCSI_DEV=/opt/unh/iscsi/devUNH_FSTAB=/opt/unh/iscsi/conf/fstab.iscsi(( mount = 0 ))(( ecount = 0 ))if [ ! -r $UNH_FSTAB -o ! -d $UNH_ISCSI_DEV ]then echo "iscsi_mount: ERROR: fstab.iscsi and/or device files missing" exit 0fiwhile read TARGET MOUNT FS OPTS JUNKdo COM="`echo $TARGET | /bin/grep -v '[ \t]*#'`" [ -z "$COM" ] && continue set `echo $TARGET | /bin/sed 's/:/ /g'` TARG_NAME=$1;LUN=$2;PART=$3 [ -z "$TARG_NAME" ] && continue [ -z "$LUN" ] && lun=0 if [ ! -z "$PART" ] then DEV=${UNH_ISCSI_DEV}/${TARG_NAME}/l${LUN}p${PART} else DEV=${UNH_ISCSI_DEV}/${TARG_NAME}/l${LUN} fi if [ ! -r ${DEV} ] then echo "iscsi_mount: Device ${DEV} for ${TARGET} not available. Skipping entry." continue fi (( mcount = mount + 1 )) if [ "$MOUNT" != "swap" ] then /sbin/fsck -a -T ${DEV} < /dev/null if [ $? -gt 1 ] then echo "iscsi_mount: fsck failed in ${DEV} for ${TARGET}" (( ecount = ecount + 1 )) continue fi /bin/mount -t ${FS} -o ${OPTS} ${DEV} ${MOUNT} if [ $? -ne 0 ] then echo "iscsi_mount: mount failed in ${DEV} for ${TARGET}" (( ecount = ecount + 1 )) continue fi else /sbin/swapon ${DEV} if [ $? -ne 0 ] then echo "iscsi_mount: swapon failed in ${DEV} for ${TARGET}" (( ecount = ecount + 1 )) continue fi fidone < $UNH_FSTAB# No errors at all(( ecount == 0 )) && exit 0# Some or all mounts failedexit 1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -