linux操作系统添加新LUN新存储后无需重启可识别

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:845

linux操作系统添加新LUN新存储后无需重启可识别

[color=#0990]linux[color=#0990]添加新[color=#0990]LUN[color=#0990],无需重启
在给存储增加新的Lun时,在linux下一般是:
A.重启操作系统
B.重启HBA卡驱动
不需要重启的两种方法:
1. kudzu
添加完新硬盘后,运行命令kudzu重新扫描新的硬件设备,类似aix的cfgmgr
eg:
[root@db]# kudzu -p | more
-
class: OTHER
bus: PCI
detached: 0
driver: shpchp
desc: "VMware PCI Express Root Port"
vendorId: 15ad
deviceId: 07a0
subVendorId: 0000
subDeviceId: 0000
pciType: 1
pcidom: 0
pcibus: 0
pcidev: 18
pcifn: 7
-
class: OTHER
bus: PCI
detached: 0
driver: shpchp
desc: "VMware PCI Express Root Port"
vendorId: 15ad
deviceId: 07a0
官方解释:
DESCRIPTION
kudzu detects and configuresnew and/or changed hardware on a system.
When started, kudzu detects the current hardware, and checksit against
a database stored in /etc/sysconfig/hwconf, if one exists. It
then determines if any hardware has beenadded or removed from the system.
If so, it gives the users the opportunity to configure anyadded hardware,
and unconfigure any removed hardware. It then updates the database
in /etc/sysconfig/hwconf.

2.直接修改文件权限,让系统重新扫描新的硬件设备
在RHEL4,5之下,在/sys/class/scsi_host/hostX文件系统中找到对应的卡的目录,
会存在一个文件叫做scan。该文件的权限只有write,没有read。
只需要执行echo "- - -"> scan即可扫描对应的新LUN
查看机器有几块HBA卡
[root@db] ls /sys/class/fc_host/
host1
[root@skatedb~]# ls /sys/class/scsi_host/host0/
cmd_per_lun hba_bios_version host_busy model scan state unchecked_isa_dma
device hba_kernel_version max_channel proc_name serial_number subsystem unique_id
flags hba_monitor_version max_id reset_host sg_tablesize uevent vendor
[root@skatedb~]# ls -l /sys/class/scsi_host/host0/scan
--w------- 1 root root 4096 Dec 12 18:51 /sys/class/scsi_host/host0/scan
修改文件“scan”权限,
[root@skatedb~]# echo "- - -" > /sys/class/scsi_host/host0/scan
查看
[root@skatedb~]# fdisk -l
记录一篇英文参考:Dynamically adding storage for use with multipath I/O

This document (3000817) is provided subject to the disclaimer at the end ofthis document.
Environment
SUSE Linux Enterprise Server 10
SUSE Linux Enterprise Server 9
Novell Open Enterprise Server (Linux based)

SAN suited for multiple paths to storage

The Linux installation has already been configured to use Device-MapperMultipath I/O (DM-MPIO) per the article "How to setup / use multipathingon SLES".

The Linux driver for the host base adapters (HBAs) on the system supportsrescanning the HBA to detect the addition or deletion of storage areas("SAN disks"). For example, a QLogic or Emulex HBA is being used.

The system has been booted with kernel parameters for SCSI device scanning thatare appropriate for the SCSI device numbering plan being followed in the SANand for the SCSI levels reported by the HBAs as discussed in TID 3955167 -Troubleshooting SCSI (LUN) scanning issues.
Situation
Purpose
Adding SAN storage to the Linux system and setting up multiple I/O paths to itwithout needing to reboot the system.
Resolution
Follow these steps to allocate new storage on the SAN, make it visible to theLinux system and use it to create new filesystems or to expand existingfilesystems residing on logical volumes:
Allocate the storage on the SAN and update its access control settings to allowthe Linux system access to the new storage. How this is done in detail ishighly dependent on the components of the SAN and its architecture; refer tothe SAN vendor's documentation for details.

On the Linux system, instruct the HBA driver to rescan the SAN to discover thenew storage area ("LUN"). The exact commands depend on the kernelversion and driver.

With SLES10, a LIP (Loop Initialization Procedure) can be issued to both Qlogicand Emulex drivers through sysfs:
echo 1 > /sys/class/fc_host/host/issue_lip

With SLES9 and OES/Linux, the Qlogic and Emulex drivers require differentcommands for rescanning. For example, for a QLogic 2300 HBA, the command is
echo scsi-qlascan > /proc/scsi/qla2xxx/
whereas for an Emulex HBA, it is
echo 1 > /sys/class/scsi_host/host/issue_lip

If the HBA driver supports it, check that the new disk is seen by the HBAdriver correctly (at this point, the newly added LUN will not yet be known tothe higher layers of the Linux kernel's SCSI subsystem and will not yet beusable).

With SLES10, after the LIP, a directory for the new disk should have beencreated under /sys/class/fc_remote_ports/ containing information such as portID and port name.

With SLES9 or OES/Linux, for a QLogic 2300 HBA, run
less /proc/scsi/qla2xxx/
and check the "SCSI LUN information" section. The entries for thenewly added disks are indicated by a "*" after the flags.
Unfortunately, there is no equivalent for Emulex cards.

Make the new device known to the middle layer of the Linux kernel's SCSIsubsystem. This can be done in two ways.
Through the
rescan-scsi-bus.sh
command which rescans the SCSI subsystem for changes. Depending on the SCSIdevice numbering plan in use, arguments may need to be used to enlarge thescope of the search or to control it more carefully, e.g through
rescan-scsi-bus.sh -l -w -c
which will search LUNs other than 0, scan for more device IDs and for morechannels, or through
rescan-scsi-bus.sh --hosts="hostlist"--channels="channellist" --ids="idlist"--luns="lunlist"
Alternatively, one can
echo "scsi add-single-device 0 1 2 3" > /proc/scsi/scsi
to add the storage with host ID 0, channel ID 1, target ID 2, LUN ID 3, or,with kernel 2.6.5-7.257 or newer,
echo "- - -" > /sys/class/scsi_host/host/scan
to rescan all targets on a host.

Run
multipath
to have the new devices be picked up for DM-MPIO.
Examine /dev/disk/by-id to identify the persistent device names for the newstorage area(s) and use the persistent device names for further operations(including filesystem creation and addition to /etc/fstab).
If LVM is to be used for the new storage area(s), configure LVM at this point,either through YaST or using the LVM command line tools, starting withpvcreate.

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】