linux添加新LUN,无需重启
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.
linux添加新LUN,无需重启的更多相关文章
- Linux添加新硬盘自动挂载硬盘
Linux添加新硬盘自动挂载硬盘的具体步骤 1.插入新硬盘,启动Linux服务器,使用fdisk -l 查看硬盘 #fdisk -l Disk /dev/sdb: 1000.2 GB, 1000204 ...
- 给Linux添加新用户,新建用户,新建帐号
给Linux添加新用户,新建用户,新建帐号 添加用户组 sudo groupadd groupname 添加用户 sudo useradd username -m -s /sbin/nologin - ...
- linux添加新硬盘不需要重启识盘,及查看uuid
添加新物理硬盘 用ssh工具连接到服务器,执行:fdisk -l 查看磁盘,并没有新加的硬盘 fdisk -l查看硬盘及分区状态 查看主机总线号,命令:ls /sys/class/scsi_ ...
- Virtualbox中Linux添加新磁盘并创建分区
原文:https://www.linuxidc.com/Linux/2017-01/139616.htm ----------------------------------------------- ...
- linux 添加新硬盘的方法
在服务器上把硬盘接好,启动linux,以root登陆. 比如我新加一块SCSI硬盘,需要将其分成三个区: #fdisk /dev/sdb 进入fdisk模式: Command (m for help) ...
- Linux 添加新用户账号并赋予root权限
除了root用户之外,通常需要为每个管理创建各自的用户账号,方便每个管理员登录使用, 步骤如下: 1. 添加新用户账号 useradd mary.lee 2. 为新用户账号设置密码 passwd ...
- linux添加新硬盘
1.添加新磁盘 2.fdisk -l查看磁盘被识别的名称 3.如果输入fdisk -l命令没有找到新的磁盘,按下面步骤操作 1)进入到cd /sys/class/scsi_host/ 2)echo & ...
- LINUX添加新的用户账号并赋予root权限
一:添加新的用户账号使用 useradd 命令 语法: useradd 选项 用户名 示例: # 添加用户,设定登录目录:useradd -d /home/admin -m a ...
- VMware Linux Guest 增加磁盘无需重启的方法
摘要 常常需要需要给VMware Linux Guest增加磁盘适配一些测试场景,而又不想花费时间重启Guest,查找文档,发现一种简单的方法,记录一下操作步骤. 操作步骤 1 编辑Linux ...
随机推荐
- git入门操作命令(转载)
以下为git环境搭建: 先建用户-->建组-->用户添加到组 新建项目,命名空间选择组 项目建完后,会分配远端地址. 然后本地配置好远端地址后,提交代码. 设置用户,邮箱 git ...
- CSS控制文字,超出部分显示省略号
http://www.daqianduan.com/6179.html <p style="width: 300px;overflow: hidden;white-space: now ...
- Linux默认权限的计算公式(个人理解性的笔记~)
先记下Linux下的权限可以分为 常见的 r(Read,读取):对文件,读取文件内容的权限:目录来说,具有浏览目 录的权限.权限值=4 w(Write,写入):对文件而言,具有新增.修改文件内容的权限 ...
- Android开发工具全面转向Android Studio(3)——AS project/module的目录结构(与Eclipse对比)
如果AS完全还没摸懂的,建议先看下Android开发工具全面转向Android Studio(2)——AS project/module的CRUD. 注:以下以Windows平台为标准,AS以目前最新 ...
- 【笔记】Android项目添加项目引用方法
刚才在做phoneGap时,想试图自己添加phoneGap的lib组件(jar的源码),找了好多种方法,下面这种成功了 项目邮件 Properties, Android ,Add... ,然后Dep ...
- ASPNET 导出EXCEL表
其实网上有很多关于Excel的例子,但是不是很好,他们的代码没有很全,读的起来还很晦涩.经过这几天的摸索,终于可以完成我想要导出报表Excel的效果了.下面是我的效果图. 一.前台的页面图 GridV ...
- Ajax提交与传统表单提交的区别说明
Ajax提交是通过js来提交请求,请求与响应均由js引擎来处理,页面不会刷新,用户感觉不到实际上浏览器发出了请求.比如说我们希望网页总是显示最新的新闻,而又不想老是去点刷新按钮,我们就可以用Ajax机 ...
- sql报句柄无效。 (异常来自 HRESULT:0x80070006 (E_HANDLE))
是由于数据库连接资源被耗尽或者用完没被释放导致的. 我在字符串中加了启用连接池好了. 如果错误信息为:sql 无效操作.连接被关闭 也是这个问题导致的.
- runtime 运行机制2
Mike_zh QQ:82643885 end: blogTitle 博客的标题和副标题 博客园 首页 新随笔 联系 订阅 <a id="MyLinks1_XMLLink" ...
- 多层嵌套ajax同步
方式一: $.ajax({ type : "post", url : "user/add", data : data, async : false, //必须为 ...