2
0
mirror of https://github.com/LCTT/TranslateProject.git synced 2025-03-30 02:40:11 +08:00

修改md格式

This commit is contained in:
Ezio 2018-01-07 18:05:24 +08:00 committed by GitHub
parent dc7a6d7e7b
commit 6f79ed8ca9

View File

@ -1,6 +1,8 @@
translating by lujun9972
Vmware Linux Guest Add a New Hard Disk Without Rebooting Guest
======
As a system admin, I need to use additional hard drives for to provide more storage space or to separate system data from user data. This procedure, adding physical block devices to virtualized guests, describes how to add a hard drive on the host to a virtualized guest using VMWare software running Linux as guest.
It is possible to add or remove a SCSI device explicitly, or to re-scan an entire SCSI bus without rebooting a running Linux VM guest. This how to is tested under Vmware Server and Vmware Workstation v6.0 (but should work with older version too). All instructions are tested on RHEL, Fedora, CentOS and Ubuntu Linux guest / hosts operating systems.
@ -39,23 +41,37 @@ Finally, set file location and click on Finish.
## Step # 2: Rescan the SCSI Bus to Add a SCSI Device Without rebooting the VM
A rescan can be issued by typing the following command:
`echo "- - -" > /sys/class/scsi_host/ **host#** /scan
```
echo "- - -" > /sys/class/scsi_host/ **host#** /scan
fdisk -l
tail -f /var/log/message`
tail -f /var/log/message
```
Sample outputs:
![Linux Vmware Rescan New Scsi Disk Without Reboot][7]
Replace host# with actual value such as host0. You can find scsi_host value using the following command:
`# ls /sys/class/scsi_host`
Output:
```
host0
```
Now type the following to send a rescan request:
`echo "- - -" > /sys/class/scsi_host/ **host0** /scan
```
echo "- - -" > /sys/class/scsi_host/ **host0** /scan
fdisk -l
tail -f /var/log/message`
tail -f /var/log/message
```
Sample Outputs:
```
Jul 18 16:29:39 localhost kernel: Vendor: VMware, Model: VMware Virtual S Rev: 1.0
Jul 18 16:29:39 localhost kernel: Type: Direct-Access ANSI SCSI revision: 02
@ -96,12 +112,16 @@ Jul 18 16:29:39 localhost kernel: sd 0:0:2:0: Attached scsi generic sg2 type 0
### How Do I Delete a Single Device Called /dev/sdc?
In addition to re-scanning the entire bus, a specific device can be added or existing device deleted using the following command:
`# echo 1 > /sys/block/devName/device/delete
# echo 1 > /sys/block/ **sdc** /device/delete`
```
# echo 1 > /sys/block/devName/device/delete
# echo 1 > /sys/block/ **sdc** /device/delete
```
### How Do I Add a Single Device Called /dev/sdc?
To add a single device explicitly, use the following syntax:
```
# echo "scsi add-single-device <H> <B> <T> <L>" > /proc/scsi/scsi
```
@ -116,10 +136,15 @@ Where,
For e.g. add /dev/sdc with host # 0, bus # 0, target # 2, and LUN # 0, enter:
`# echo "scsi add-single-device 0 0 2 0">/proc/scsi/scsi
```
# echo "scsi add-single-device 0 0 2 0">/proc/scsi/scsi
# fdisk -l
# cat /proc/scsi/scsi`
# cat /proc/scsi/scsi
```
Sample Outputs:
```
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
@ -136,23 +161,31 @@ Host: scsi0 Channel: 00 Id: 02 Lun: 00
## Step #3: Format a New Disk
Now, you can create partition using [fdisk and format it using mkfs.ext3][8] command:
`# fdisk /dev/sdc
```
# fdisk /dev/sdc
### [if you want ext3 fs] ###
# mkfs.ext3 /dev/sdc3
### [if you want ext4 fs] ###
# mkfs.ext4 /dev/sdc3`
# mkfs.ext4 /dev/sdc3
```
## Step #4: Create a Mount Point And Update /etc/fstab
`# mkdir /disk3`
Open /etc/fstab file, enter:
`# vi /etc/fstab`
Append as follows:
```
/dev/sdc3 /disk3 ext3 defaults 1 2
```
For ext4 fs:
```
/dev/sdc3 /disk3 ext4 defaults 1 2
```
@ -162,7 +195,9 @@ Save and close the file.
#### Optional Task: Label the partition
[You can label the partition using e2label command][9]. For example, if you want to label the new partition /backupDisk, enter
`# e2label /dev/sdc1 /backupDisk`
See "[The importance of Linux partitions][10]
## about the author