How to add a new hard disk without shutting down a Linux Server

Source: Internet
Author: User

How to add a new hard disk without shutting down a Linux Server

Method 1:

1. After the disk is inserted, run echo "---">/sys/class/scsi_host/host0/scan

2. Check whether the command in step 1 takes effect. You can verify it in/var/log/messages.

3. Run the fdisk-l command to check whether the new disk can be seen. If not, replace host0 with host1 or host2 and try again.

Method 2:

1. Insert the disk, run the/proc/scsi directory, and then less./scsi to check the current SCSI disk usage.

Root @ debian:/proc/scsi # ls
Device_info scsi
Root @ debian:/proc/scsi # less scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: ATA Model: KINGSTON SVP200S Rev: 501A
Type: Direct-Access ansi scsi revision: 05
Host: scsi0 Channel: 00 Id: 01 Lun: 00
Vendor: ATA Model: TOSHIBA DT01ACA2 Rev: MX4O
Type: Direct-Access ansi scsi revision: 05
Host: scsi1 Channel: 00 Id: 00 Lun: 00
Vendor: ATA Model: WDC WD20EURS-63S Rev.: 80.0
Type: Direct-Access ansi scsi revision: 05
You can find the four parameters used by the disk, namely the primary adapter ID, the SCSI channel on the primary adapter, the scsi id of the device, and the LUN Number of the device.

2. Run the command to add a disk: echo "scsi add-single-device w x y z">/proc/scsi

The specified parameter values w, x, y, and z are as follows:
W is the host adapter identifier, and the first adapter is zero (0)
X is the SCSI channel on the host Adapter. The first channel is zero (0)
Y is the scsi id of the device.
Z is the LUN number, and the first LUN is zero (0)
Note: You can use this command to delete a disk: echo "scsi remove-single-device w x y z">/proc/scsi

3. Use the fdisk-l command to partition and format the disk.

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.