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,无需重启 的相关文章

  • 使用 systemctl 获取 systemd 进程的正常运行时间或停机时间?

    喜欢使用systemctl is active
  • bash 将输出重定向到文件,但结果不完整

    重定向命令输出的问题已经被问过很多次了 但是我有一个奇怪的行为 我使用的是 bash shell debian 版本 4 3 30 1 release 并尝试将输出重定向到文件 但并非所有内容都记录在文件中 我尝试运行的 bin 文件是 l
  • MySQL 与 PHP 的连接无法正常工作

    这是我的情况 我正在尝试使用 Apache 服务器上的 PHP 文件连接到 MySQL 数据库 现在 当我从终端运行 PHP 时 我的 PHP 可以连接到 MySQL 数据库 使用 php f file php 但是当我从网页执行它时 它只
  • 链接错误:命令行中缺少 DSO

    我对 Linux 使用 Ubuntu 14 04 LTS 64 位 相当陌生 来自 Windows 并且正在尝试移植我现有的 CUDA 项目 当通过链接时 usr local cuda bin nvcc arch compute 30 co
  • 如何在 Linux 和 C 中使用文件作为互斥体?

    我有不同的进程同时访问 Linux 中的命名管道 并且我想让此访问互斥 我知道可以使用放置在共享内存区域中的互斥体来实现这一点 但作为一种家庭作业 我有一些限制 于是 我想到的是对文件使用锁定原语来实现互斥 我做了一些尝试 但无法使其发挥作
  • “git add”返回“致命:外部存储库”错误

    我刚刚进入 git 的奇妙世界 我必须提交我对程序所做的一系列更改 位于名为的目录中 var www myapp 我创建了一个新目录 home mylogin gitclone 从这个目录中 我做了一个git clone针对公共回购 我能够
  • Nodejs - 处理和发送多部分请求,

    我的应用程序在 Nodejs 服务器上运行 Node Js 还充当来自应用程序的请求的中间件 代理 因此 从浏览器开始 所有 REST 调用都会转到 NodeJs 然后转到 Java API 我发现处理多部分表单数据的请求时出现问题 我在
  • 使用 libusb 输出不正确

    我用libusb编写了一个程序 我怀疑输出是否正确 因为所有条目都显示相同的供应商和产品 ID 以下是代码 include
  • /sys/device/ 和 dmidecode 报告的不同 CPU 缓存大小

    我正在尝试获取系统中不同缓存级别的大小 我尝试了两种技术 a 使用 sys device 中的信息 这是输出 cat sys devices system cpu cpu0 cache index1 size 32K cat sys dev
  • 如何从 C++ 程序中重新启动 Linux?

    我有一个 Qt 4 GUI 我需要在下拉菜单中提供一个选项 允许用户选择重新启动计算机 我意识到这对于以其他方式重新启动计算机的能力来说似乎是多余的 但选择需要保留在那里 我尝试使用 system 来调用以下内容 suid root she
  • 如何在线程创建和退出时调用函数?

    include
  • Linux 使用 boost asio 拒绝套接字绑定权限

    我在绑定套接字时遇到问题 并且以用户身份运行程序时权限被拒绝 这行代码会产生错误 acceptor new boost asio ip tcp acceptor io boost asio ip tcp endpoint boost asi
  • 如何在不使用 IDE 的情况下在 Linux 上运行 Java 项目

    我是 Java 新手 基本上 我开发了一个java项目 其中包含Eclipse中的多个Java包 该项目在我安装了 redhat Linux 的桌面上运行正常 然而 我需要在一个更强大的没有安装X11的Linux服务器 redhat ent
  • 在 docker 中重定向命令输出

    我想为我的服务器做一些简单的日志记录 它是一个在 Docker 容器中运行的小型 Flask 应用程序 这是 Dockerfile Dockerfile FROM dreen flask MAINTAINER dreen WORKDIR s
  • ssh 连接超时

    我无法在 git 中 ssh 到 github bitbucket 或 gitlab 我通常会收到以下错误消息 如何避免它 输出 ssh T email protected cdn cgi l email protection i ssh
  • 如何在python中读取多个文件中的文本

    我的文件夹中有许多文本文件 大约有 3000 个文件 每个文件中第 193 行是唯一包含重要信息的行 我如何使用 python 将所有这些文件读入 1 个文本文件 os 模块中有一个名为 list dir 的函数 该函数返回给定目录中所有文
  • SSH,运行进程然后忽略输出

    我有一个命令可以使用 SSH 并在 SSH 后运行脚本 该脚本运行一个二进制文件 脚本完成后 我可以输入任意键 本地终端将恢复到正常状态 但是 由于该进程仍在我通过 SSH 连接的计算机中运行 因此任何时候它都会登录到stdout我在本地终
  • 相当于Linux中的导入库

    在 Windows C 中 当您想要链接 DLL 时 您必须提供导入库 但是在 GNU 构建系统中 当您想要链接 so 文件 相当于 dll 时 您就不需要链接 为什么是这样 是否有等效的 Windows 导入库 注意 我不会谈论在 Win
  • 无法在适当的时间对域调用 dispose

    我有一个问题domain模块 目前 我正在尝试捕获请求中引发的任何未捕获的错误 使用express中间件和域 所有请求在调用之前都会通过此函数路由next并继续走正确的路线 app use req res next gt domain cr
  • 在 C 中使用单个消息队列是否可以实现双向通信

    我希望服务器向客户端发送一些消息 并让客户端确认它 我被分配了这个任务 我可以在 C linux 中使用单个消息队列来完成它还是我需要创建两个 谢谢 是的 可以使用 sysV 消息队列来做到这一点 从您之前的问题来看 您正在使用该队列 您可

随机推荐

  • 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重新扫描新