Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Do not restart Linux, manually identify the method of adding new disks online

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

The following is a brief introduction to a method to identify new disks without restarting linux.

Environment description:

OS: Redhat linux 5.4x86 (host is vmware virtual host)

Add a 50G lun

Method 1:

one。 Commands to manually add disks

# echo "scsi add-single-device w x y z" > / proc/scsi/scsi

For the command to work properly, you must specify the correct parameter values w, x, y, and z, as follows:

W is the host adapter identity, and the first adapter is zero (0)

X is the SCSI channel on the host adapter, and the first channel is zero (0)

Y is the SCSI ID of the device

Z is the LUN number, the first LUN is zero (0)

two。 Before executing the command, check the / proc/scsi/scsi file to determine the id of the new disk

Attached devices:

Host: scsi0 Channel: 00 Id: 00 Lun: 00

Vendor: VMware Model: Virtual disk Rev: 1.0

Type: Direct-Access ANSI SCSI revision: 02

Host: scsi0 Channel: 00 Id: 01 Lun: 00

Vendor: VMware Model: Virtual disk Rev: 1.0

Type: Direct-Access ANSI SCSI revision: 02

Host: scsi0 Channel: 00 Id: 02 Lun: 00

Vendor: VMware Model: Virtual disk Rev: 1.0

Type: Direct-Access ANSI SCSI revision: 02

Host: scsi0 Channel: 00 Id: 03 Lun: 00

Vendor: VMware Model: Virtual disk Rev: 1.0

Type: Direct-Access ANSI SCSI revision: 02

Host: scsi0 Channel: 00 Id: 04 Lun: 00

Vendor: VMware Model: Virtual disk Rev: 1.0

Type: Direct-Access ANSI SCSI revision: 02

You can see that the largest id is 04, and the ID of the new disk should be 5. 5.

three。 Execute the fdisk-l command to check the current disk condition

[root@soadb scsi] # fdisk-l

Disk / dev/sda: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/ dev/sda1 * 1 13 104391 83 Linux

/ dev/sda2 14 2610 20860402 + 8e Linux LVM

.

Disk / dev/sde: 53.6 GB, 53687091200 bytes

255 heads, 63 sectors/track, 6527 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk / dev/sde doesn't contain a valid partition table

four。 Execute a command

# echo "scsi add-single-device 0 050" > / proc/scsi/scsi

five。 Execute the fdisk command to check the result

[root@soadb scsi] # fdisk-l

.

Disk / dev/sde: 53.6 GB, 53687091200 bytes

255 heads, 63 sectors/track, 6527 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk / dev/sde doesn't contain a valid partition table

Disk / dev/sdf: 53.6 GB, 53687091200 bytes

255 heads, 63 sectors/track, 6527 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk / dev/sdf doesn't contain a valid partition table

As you can see, the new 50G disk has been identified in the operating system, and the device name is / dev/sdf.

The device can be used at this time.

Method 2:

[root@localhost ~] # fdisk-l

Disk / dev/sda: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/ dev/sda1 * 1 13 104391 83 Linux

/ dev/sda2 14 2610 20860402 + 8e Linux LVM

[root@localhost ~] # echo "- -" > / sys/class/scsi_host/host0/scan

[root@localhost ~] # fdisk-l

Disk / dev/sda: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/ dev/sda1 * 1 13 104391 83 Linux

/ dev/sda2 14 2610 20860402 + 8e Linux LVM

Disk / dev/sdb: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk / dev/sdb doesn't contain a valid partition table

Original blog address: http://blog.chinaunix.net/uid-26557245-id-3307138.html

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report