linux添加新LUN,无需重启

2023-11-09

author:skate
time:2011/12/12

 

linux添加新LUN,无需重启

在给存储增加新的Lun时,在linux下一般是:

A.重启操作系统
B.重启HBA卡驱动

1. kudzu
添加完新硬盘后,运行命令kudzu重新扫描新的硬件设备,类似aix的cfgmgr

eg:
[root@skatedb]#  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 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 has been added or removed from the system.
    If so, it gives the users the opportunity to configure any added 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@skatedb] 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 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 has already been configured to use Device-Mapper Multipath I/O (DM-MPIO) per the article "How to setup / 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 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 that are appropriate for the SCSI device numbering plan being followed in the SAN and 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 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 filesystems or to expand existing filesystems residing on logical volumes:
Allocate the storage on the SAN and update its access control settings to allow the Linux system access to the new storage. How this is done in 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 be 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 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 HBA driver correctly (at this point, the newly added LUN will not yet be known to the higher layers of the Linux kernel's SCSI subsystem and will not yet be usable).

With SLES10, after the LIP, a directory for the new disk should have been created under /sys/class/fc_remote_ports/ containing 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 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 SCSI subsystem. This can be done in two 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 may need to be 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 will 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 have the new devices be 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 be used for the new storage area(s), configure LVM at this point, either through YaST or using the LVM command line tools, starting with pvcreate.

 

 

 

---------end------

 

 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

linux添加新LUN,无需重启 的相关文章

  • 如何使用 bash 脚本关闭所有终端,在每个终端中有效地按 Ctrl+Shift+Q

    我经常打开许多终端 其中一些正在运行重要的进程 例如服务器 而另一些则没有运行任何东西并且可以关闭 如果您按 重要 则会弹出确认提示Cntrl Shift Q在其中 如下所示 我想要一个 bash 脚本 它可以关闭所有终端 但将 重要 终端
  • 静态链接共享对象?或者损坏的文件?

    我有一个从专有来源获得的库 我正在尝试链接它 但出现以下错误 libxxx so 文件无法识别 文件格式无法识别 Collect2 ld 返回 1 退出状态 确实 ldd libxxx so statically linked 这究竟意味着
  • gnome-terminal 新选项卡,使用别名作为要执行的命令

    我已经创建了一个别名 bashrc文件如下 alias myproject cd Desktop myproject 当我重新启动终端时保存文件后 输入myproject带我到项目目录 但是当我尝试使用别名作为新的命令参数时gnome te
  • 是否有可能通过 mmap 匿名内存“打孔”?

    考虑一个使用大量大致页面大小的内存区域 例如 64 kB 左右 的程序 每个内存区域的寿命都相当短暂 在我的特定情况下 这些是绿色线程的替代堆栈 如何最好地分配这些区域 以便一旦该区域不再使用 它 们的页面可以返回到内核 天真的解决方案显然
  • 编写多个mysql脚本

    是否可以在复合脚本中包含其他 mysql 脚本 理想情况下 我不想为包含的脚本创建存储过程 对于较大的项目 我想分层维护几个较小的脚本 然后根据需要组合它们 但现在 我很乐意学习如何包含其他脚本 source是一个内置命令 您可以在 MyS
  • 如何仅将整个嵌套目录中的头文件复制到另一个目录,在复制到新文件夹后保持相同的层次结构

    我有一个目录 其中有很多头文件 h 和其他 o 和 c 文件以及其他文件 这个目录里面有很多嵌套的目录 我只想将头文件复制到一个单独的目录 并在新目录中保留相同的结构 cp rf oldDirectory newDirectory将复制所有
  • 确定分区属于什么文件系统

    操作系统如何知道分区正在使用什么文件系统 换句话说 FAT16 32 NTFS ext2 3等如何区分 如果您在 Windows 上使用 Win32 API 则可以调用 GetVolumeInformation http msdn micr
  • 是否有可能在linux中找到包含特定文本的文件?

    考虑这种情况 我在文件夹 Example 下有很多文件 如果我需要找到一个包含特定短语 如 Class Example 的文件 我该如何使用 Linux shell 来做到这一点 linux中有类似 定位 的函数可以做到这一点吗 Thank
  • Linux 中的电源管理通知

    在基于 Linux 的系统中 我们可以使用哪些方法 最简单的方法 来获取电源状态更改的通知 例如 当计算机进入睡眠 休眠状态等时 我需要这个主要是为了在睡眠前保留某些状态 当然 在计算机唤醒后恢复该状态 您只需配置即可获得所有这些事件acp
  • MongoDB 查询返回空数组

    有一个基本的 Express 应用程序连接到几乎 0 5 GB 的 MongoDB 数据库 当我运行时 router get function req res next medical data find State CT function
  • Bash 脚本 - 迭代 find 的输出

    我有一个 bash 脚本 其中需要迭代 find 命令输出的每一行 但似乎我正在迭代 find 命令中的每个单词 以空格分隔 到目前为止我的脚本看起来像这样 folders find maxdepth 1 type d for i in f
  • 如何从 Linux 的 shell 中删除所有以 ._ 开头的文件?

    确实如标题所示 我已将许多文件从 Mac 复制到 Raspberry Pi 这导致了许多以前缀开头的多余文件 我想删除以以下开头的文件夹中的每个文件 我该怎么做 尝试类似的方法 cd path to directory rm rf 或者 如
  • 在 shell 脚本中查找和替换

    是否可以使用 shell 在文件中搜索然后替换值 当我安装服务时 我希望能够在配置文件中搜索变量 然后在该值中替换 插入我自己的设置 当然 您可以使用 sed 或 awk 来完成此操作 sed 示例 sed i s Andrew James
  • 无关的库链接

    我有一个可能有点愚蠢的问题 因为我很确定我可能已经知道答案了 假设你有静态库A 动态共享库B和你的linux下的程序C 假设库 A 调用库 B 中的函数 并且您的程序调用库 A 中的函数 现在假设 C 在 A 中调用的所有函数都不使用 B
  • 是否从页面缓存中的脏页面进行文件读取?

    当字节写入文件时 内核不会立即将这些字节写入磁盘 而是将这些字节存储在页缓存中的脏页中 回写缓存 问题是 如果在脏页刷新到磁盘之前发出文件读取 则将从缓存中的脏页提供字节 还是首先将脏页刷新到磁盘 然后进行磁盘读取以提供字节 将它们存储在进
  • 如何确保 numpy BLAS 库可用作动态加载库?

    The theano安装文档 http www deeplearning net software theano install html troubleshooting make sure you have a blas library指
  • 如何使用 node.js / mongodb 在 HTML 中显示任意、无模式数据

    我使用 mongodb 将应用程序错误日志存储为 json 文档 我希望能够将错误日志格式化为 HTML 而不是将纯 json 返回到浏览器 日志是完全无模式的 它们可以随时更改 因此尝试执行此操作 在 Jade 中 是没有用的 var i
  • “grep -q”的意义是什么

    我正在阅读 grep 手册页 并遇到了 q 选项 它告诉 grep 不向标准输出写入任何内容 如果发现任何匹配 即使检测到错误 也立即以零状态退出 我不明白为什么这可能是理想或有用的行为 在一个程序中 其原因似乎是从标准输入读取 处理 写入
  • Linux 上的 Python 3.6 tkinter 窗口图标错误

    我正在从 Python GUI 编程手册 学习 Python GUI 某项任务要求我通过将以下代码添加到我的配方中来更改窗口图标 Change the main windows icon win iconbitmap r C Python3
  • 如何调用位于其他目录的Makefile?

    我正在尝试这样做 我想打电话给 make Makefile存在于其他目录中 abc可以使用位于不同目录中的 shell 脚本的路径 我该怎么做呢 由于 shell 脚本不允许我cd进入Makefile目录并执行make 我怎样才能编写she

随机推荐

  • Flex 构建路径

    然libs文件夹是构建路径的一部分 但它并不总是SWC的理想存放位置 当多个项目同时使用相同的SWC时 就不能都存放在libs文件夹中 在这种情况下 SWC可以保持在中心位置 众所周知 SWC路径可以被添加到构建路径中 虽然这意味着需要建立
  • 问题 G: 用递归的方法求值

    题目描述 求1 2 3 4 5 n的值 输入格式 一个n n不大于10000 输出格式 输出1到n的累加和 输入样例 复制 2 输出样例 复制 3 这道题比较简单 边界是n 0 核心代码为 if n 0 return 0 else retu
  • C++ template 模板的模板参数(5.4节)

    有时 让模板参数本身成为模板是很有用的 我们将继续以stack类模板作为例子 来说明模板的模板参数的用途 在Stack的例子中 如果要使用一个和缺省值不同的内部容器 程序员必须两次指定元素类型 也就是说 为了指定内部容器的类型 你需要同时传
  • java实现文件的上传和下载

    文件的上传 upload 文件上传 客户端通过表单的文件域file 把客户端的文件 上传保存到服务器的硬盘上 页面 首先对上传的表单有以下要求 必须有文件域 input type file 表单提交方式 method post 表单的 en
  • 【剑指Offer】35.复杂链表的复制(JS实现)

    题目描述 请实现 copyRandomList 函数 复制一个复杂链表 在复杂链表中 每个节点除了有一个 next 指针指向下一个节点 还有一个 random 指针指向链表中的任意节点或者 null 示例1 输入 head 7 null 1
  • 图灵机模拟程序功能设计

    图灵机由无限长的纸带 读写头 状态寄存器 控制规则等四部分组成 纸带上的符号可以是 0 1 空格 要利用图灵机求解一个问题 需要自己设计图灵机 程序 即定义一些状态 其中包括初始状态和结束状态 设计给出控制规则 并进行图灵机初始化 设定初始
  • chrome/Edge搜索技巧

    1 剔除干扰项搜索 搜索内容 不想要的关键词 排除干扰项 2 特定搜索 给关键词加引号 关键词 只搜索引号里面的字 3 指定网站内搜索 site 域名 关键词 4 指定格式搜索 filetype 文件格式 关键词 可以制定pdf doc p
  • series not exists. Legend data should be same with series name or data name.

    normal删除
  • php+vscode+xdebug搭建php调试环境

    php vscode xdebug搭建php调试环境 开发环境 windows 10 php 8 0 23 xdebug 3 1 6 配置xdebug 查看php版本信息 cmd exe php version 可看到 我的版本信息为8 0
  • 阿里云maven 仓库地址配置

    参考 https help aliyun com document detail 102512 html spm a2c40 aliyun maven repo 0 0 36183054erKD4V 配置指南 maven配置指南 打开mav
  • 深度学习之生成对抗网络(7)WGAN原理

    深度学习之生成对抗网络 7 WGAN原理 1 JS散度的缺陷 2 EM距离 3 WGAN GP WGAN算法从理论层面分析了GAN训练不稳定的原因 并提出了有效的解决方法 那么是什么原因导致了GAN训练如此不稳定呢 WGAN提出是因为JS散
  • Best Cow Fences (前缀和 + 二分)

    描述 Farmer John s farm consists of a long row of N 1 lt N lt 100 000 fields Each field contains a certain number of cows
  • java Timer(定时调用、实现固定时间执行)

    最近需要用到定时调用的功能 可以通过java的Timer类来进行定时调用 下面是有关Timer的一些相关知识 其实就Timer来讲就是一个调度器 而TimerTask呢只是一个实现了run方法的一个类 而具体的TimerTask需要由你自己
  • caffe_master windows下的安装编译

    一 安装配置 caffe master包 https pan baidu com s 1kI2TcOX3Ak kNGGzsTYRBA 其它有需要请留言2602721630 qq com 本文在windows下使用visual studio2
  • 51单片机控制SG90舵机、MG90S舵机

    舵机的控制信号为周期是20ms 的脉宽调制 PWM 信号 其中脉冲宽度从0 5ms 2 5ms 相对应舵盘的位置为0 180度 呈线性变化 也就是说 给它提供一定的脉宽 它的输出轴就会保持在一个相对应的角度上 无论外界转矩怎样改变 直到给它
  • JavaScript 中的 SOLID 原则

    什么是 SOLID SOLID 是 Robert C Martin 的前五个面向对象设计原则的首字母缩写词 这些原则的目的是 让你的代码 架构更具可读性 可维护性 灵活性 单一职责原则 Single Responsibility Princ
  • 关于Java中Arrays.sort()的几种用法

    复习了Java数组之后 突然Arrays里面有一个sort是针对数组排序的 然后就看了看它的简单用法 Java的Arrays类中有一个sort 方法 该方法是Arrays类的静态方法 在需要对数组进行排序时 非常的好用 但是sort 的参数
  • mongo在linux下的安装(实践记录)

    mongo在linux下的安装 1 到官方网站下载需要安装的mongo版本 下载mongo对应的版本 官网为 http www mongodb org downloads 本人用的是公司的版本 mongodb linux x86 64 1
  • mysql如何设置自动增长id列

    参考 https blog csdn net WxQ92222 article details 79956403 我使用的是navicat软件来可视化mysql 实际上navicat可以直接设置自动增长的 在设计表时只要添加类型为int或b
  • linux添加新LUN,无需重启

    author skate time 2011 12 12 linux添加新LUN 无需重启 在给存储增加新的Lun时 在linux下一般是 A 重启操作系统 B 重启HBA卡驱动 1 kudzu 添加完新硬盘后 运行命令kudzu重新扫描新