Linux implements hot swapping of SCSI hard disks and online identification

Source: Internet
Author: User
Article Title: Linux implements SCSI hard drive hot swapping and online identification. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

When adding a SCSI hard disk to the server, you can let the system identify the new hard disk without stopping the server. The specific steps are as follows:

Step 1: Insert the new hard disk to the machine;

Step 2: run the command as the root user:

Echo "scsi add-single-device x y z u">/proc/scsi

Where:

X is the SCSI controller Number of the hard disk (usually a SCSI controller, so it is 0 );

Y is the serial number of the SCSI channel where the hard disk is located (generally, the serial number of the single channel is 0, and the multi-channel depends on the Channel );

Z is the scsi id of the hard disk (which can be determined by the hard disk slot Inserted );

U is the lun Number of the hard disk (both are 0 by default)

Since I inserted the third hard disk, the command I run is:

Echo "scsi add-single-device 0 0 2 0">/proc/scsi

If the x y z parameter is incorrect, the system cannot identify the added hard disk. You can check the content of the/proc/scsi file to determine whether the added disk is successful. After the file is added, a device is added to the file. This file contains detailed information about all SCSI devices identified by the system, including the vendor, model, and media access type.

After running the above command, I checked the file/proc/scsi and found that there was one more device (the last one ):

Attached devices:

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

Vendor: MAXTOR Model: ATLASU320_18_SCA Rev: B120

Type: Direct-Access ansi scsi revision: 03

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

Vendor: IBM Model: IC35L036UCDY10-0 Rev: S28F

Type: Direct-Access ansi scsi revision: 03

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

Vendor: ESG-SHV Model: SCA hsystolic M17 Rev: 1.15

Type: Processor ansi scsi revision: 02

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

Vendor: IBM Model: IC35L146UCDY10-0 Rev: S26B

Type: Direct-Access ansi scsi revision: 03

Then look at the/proc/partition file and find that the hard disk has been identified! Next, you can partition, format, and use the partition tool. Because you do not need to reboot the system when using the parted partition tool, you do not need to restart the system during the entire hard disk adding process.

To remove a hard disk, perform the following operations:

Step 1: run the command as the root user:

Echo "scsi remove-single-device x y z u">/proc/scsi

The definition of x y z u is the same as above.

Step 2: physically disconnect the hard disk.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.