In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to scan / detect new LUN and SCSI disks on Linux, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.
When the storage team maps LUN to a given Linux host, they will provide you with new LUN details.
LUN is called serial hexadecimal of LUN in storage terminology.
You need to scan the SCSI host to find the new LUN assigned by the storage team.
This can be done in two ways, either by scanning each scsi host device or by running a rescan-scsi-bus.sh script to detect new disks.
After scanning, you can find them in the / dev/disk/by-id directory.
# ll / dev/disk/by-id total 0 lrwxrwxrwx 1 root root 10 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684b->.. / sdah lrwxrwxrwx 1 root root 9 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684c->.. /.. / sdw. . Lrwxrwxrwx 1 root root 10 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684d->.. /.. / sdjk lrwxrwxrwx 1 root root 10 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684e->.. / sdaa lrwxrwxrwx 1 root root 9 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684f->.. /.. / sdh
In addition, if you have configured them with multipath, you can find them with the multipath command.
`multipath is mainly configured in the Oracle database server to improve performance.
# multipath-ll 60a98000486e542d4f5a2f47694d684b dm-37 NETAPP LUN C-Mode size=512G features='3 queue_if_no_path pg_init_retries 50' hwhandler='1 alua' wp=rw |-+-policy='round-robin 0' prio=50 status=active | |-1VOVOVAND 4VAN18 sdoe 128RU 416 active ready running | |-0VOVUR 4VERV 18 sdpq 131RUD256 active ready running | |-0VOVOVERV 5VAN18 sdsr 135RAD496 active ready running | `- 1VULV 5VAN18 sdsq 135RAPHING active ready running`-+-policy='round-robin 0' Prio=10 status=enabled |-1 active ready running 0sdci 0sdci 69:96 active ready running |-0active ready running 0active ready running 0sdci 69:96 active ready running |-0Vl0VAND 18 sdbz 68M208 active ready running |-0VUL0VUR 0VUL18 sds 65:32 active ready running |-1VUL0VER18 sdmd 69336 active ready running |-1OO sdjj 8464 active ready running | 0VUL0VANG 3US34 sdjt 65 active ready running 368 active ready running `- 0VOUR 2VAN34 sdgi 131US224 active ready running
This process applies to systems based on Red Hat 6.x, 7.x, and 8.x (RHEL-Red Hat Enterprise Linux), such as CentOS and Oracle Linux.
Method 1: how to scan new LUN and SCSI disks on Linux using the / sys class file
The sysfs file system is a pseudo file system that provides an interface for kernel data structures.
The files under sysfs provide information about devices, kernel modules, file systems, and other kernel components.
The sysfs file system is usually mounted at / sys. Typically, it is automatically mounted by the system.
You can use the echo command to scan each SCSI host device, as follows:
# echo "- -" > / sys/class/scsi_host/ host [n] / scan
When you run all the rescan commands above, the three dashes (- -) refer to the wildcard option. These values are as follows:
# echo "c t l" > / sys/class/scsi_host/ host [n] / scan
Here:
Channels on c:HBA
T:SCSI Target ID
L:LUN ID
N:HBA number
Run the following command to find all host bus numbers in the system:
# ls / sys/class/scsi_host host0 host1 host2
After you get the host bus number, run the following command to discover the new disk:
# echo "- -" > / sys/class/scsi_host/host0/scan # echo "---" > / sys/class/scsi_host/host1/scan # echo "--- > / sys/class/scsi_host/host2/scan
Alternatively, you can scan with a single command using the for loop.
# for host in ls / sys/class/scsi_host/;do echo "- -" > / sys/class/scsi_host/$ {host} / scan; done
You can check them using the ls command mentioned at the beginning of the article.
# ls / dev/disk/by-id | grep-I "serial-hex of LUN"
Method 2: how to use the rescan-scsi-bus.sh script to scan new LUN and SCSI disks on Linux
Make sure you have installed the sg3_utils package to use this script. Otherwise, run the following command to install it.
For the RHEL/CentOS 6 yum 7 system, use the install command to install sg3_utils.
# yum install-y sg3_utils
For RHEL/CentOS 8 and Fedora systems, use the dnf command to install sg3_utils.
# dnf install-y sg3_utils
Now you can rescan LUN using the rescan-scsi-bus.sh script.
#. / rescan-scsi-bus.sh Thank you for reading this article carefully. I hope the article "how to scan / detect new LUN and SCSI disks on Linux" shared by the editor will be helpful to you. At the same time, I hope you will support us and follow the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.