Linux adds a new LUN without rebooting

Source: Internet
Author: User
Tags file permissions

Linux adds a new LUN without rebooting

When adding a new LUN to the store, it is generally under Linux:

A. Restart the operating system
B. Restart the HBA card driver

1. Kudzu
After adding the new hard drive, run the command kudzu to rescan the new hardware device, similar to Aix's cfgmgr

eg
[[Email protected]]# 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

Official explanation:
DESCRIPTION
Kudzu detects and configures new and/or changed hardware on a system.
When started, Kudzu detects the current hardware, and checks it against
A database stored in/etc/sysconfig/hwconf, if one exists. It
Then determines if any hardware have been added or removed from the system.
If So, it gives the users of the opportunity to configure any added hardware,
and unconfigure any removed hardware. It then updates the database
In/etc/sysconfig/hwconf.


2. Directly modify the file permissions, let the system re-scan the new hardware device

Under rhel4,5, locate the corresponding card directory in the/sys/class/scsi_host/hostx file system,
There will be a file called scan. The permissions for the file are only write, not read.
Only the echo "---" > scan can be scanned for the corresponding new LUN

See how many HBA cards the machine has
[[email protected]] ls/sys/class/fc_host/
Host1

[[Email protected]~]# 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

[Email protected]~]# ls-l/sys/class/scsi_host/host0/scan
--w-------1 root root 4096 Dec 18:51/sys/class/scsi_host/host0/scan

Modify the file "Scan" permission,
[Email protected]~]# echo "---" >/sys/class/scsi_host/host0/scan

View
[[Email protected]~]# fdisk-l

Record an English reference:

Dynamically adding storage for use with Multipath I/O

This document (3000817) was provided subject to the disclaimer at the end of this 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 have already been configured to use Device-mapper Multipath I/O (Dm-mpio) per the article "How To Se" Tup/use multipathing on SLES ".

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

The system has been booted with kernel parameters for SCSI device scanning that is appropriate for the SCSI device number ing plan being followed in the SAN and for the SCSI levels reported by the HBAs as discussed in TID 3955167-troubleshoot ing SCSI (LUN) scanning issues.
Situation
Purpose
Adding SAN Storage to the Linux system and setting up multiple I/O paths to it without needing to reboot the system.
Resolution
Follow these steps to allocate new storage on the SAN, make it visible to the Linux system and use it to create new Filesy Stems or to expand existing filesystems residing on logical volumes:
Allocate the storage on the SAN and update it access control settings to allow the Linux system access to the new storage . How that is-detail is highly dependent on the components of the SAN and its architecture; Refer to the SAN vendor ' s documentation for details.

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

With SLES10, a LIP (Loop initialization Procedure) can is issued to both Qlogic and Emulex drivers through SYSFS:
Echo 1 >/sys/class/fc_host/host/issue_lip

With SLES9 and Oes/linux, the Qlogic and Emulex drivers require different commands for rescanning. For example, for a QLogic 2300 HBAs, the command is
echo Scsi-qlascan >/proc/scsi/qla2xxx/
Whereas for a Emulex HBA, it is
Echo 1 >/sys/class/scsi_host/host/issue_lip

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

With SLES10, after the LIP, a directory for the new disk should has been created Under/sys/class/fc_remote_ports/contai Ning information such as Port ID 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 the newly added disks is 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 SCSI subsystem. This can is done in both ways.
Through the
rescan-scsi-bus.sh
Command which rescans the SCSI subsystem for changes. Depending on the SCSI device numbering plan in use, arguments could need to being used to enlarge the scope of the search or to Control it more carefully, e.g through
Rescan-scsi-bus.sh-l-w-c
Which would search LUNs other than 0, scan for more device IDs and for more channels, 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 the new devices is picked up for Dm-mpio.
Examine/dev/disk/by-id to identify the persistent device names for the new storage area (s) and use the persistent device Names for further operations (including filesystem creation and addition To/etc/fstab).
If LVM is to being used for the new storage area (s), configure LVM at this point, either through YaST or using the LVM comman D line tools, starting with pvcreate.

Linux adds a new LUN without rebooting

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.