2011年2月16日 星期三

Linux without rescan disk

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.

Step # 1: Add a New Disk To Vm Guest

First, you need to add hard disk by visiting vmware hardware settings menu.
Click on VM > Settings

Fig.01: Vmware Virtual Machine Settings

Fig.01: Vmware Virtual Machine Settings

Alternatively you can press CTRL + D to bring settings dialog box.

Click on Add+ to add new hardware to guest:

Fig.02: VMWare adding a new hardware

Fig.02: VMWare adding a new hardware

Select hardware type Hard disk and click on Next

Fig.03 VMware Adding a new disk wizard

Fig.03 VMware Adding a new disk wizard

Select create a new virtual disk and click on Next

Fig.04: Vmware Wizard Disk

Fig.04: Vmware Wizard Disk

Set virtual disk type to SCSI and click on Next

Fig.05: Vmware Virtual Disk

Fig.05: Vmware Virtual Disk

Set maximum disk size as per your requirements and click on Next

Fig.06: Finalizing Disk Virtual Addition

Fig.06: Finalizing Disk Virtual Addition

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
fdisk -l
tail -f /var/log/message

Sample outputs:

Linux Vmware Rescan New Scsi Disk Without Reboot

Fig.01:Linux Vmware Rescan New Scsi Disk Without Reboot


Replace host# with actual value such as host0. You can find scsi_host value using the following command:
# ls /sys/class/scsi_host

沒有留言: