Search

OakieTags

Who's online

There are currently 0 users and 31 guests online.

Recent comments

Affiliations

Adding disks to VMware Workstation 8 on the fly on RHEL 6

Although this post is primarily written for users of VMware Workstation 8 it is applicable for any RedHat 6 clone and adding disks with single path on the fly. Multipathing requires additional setup in dm-multipath or the vendor multipathing software which I won’t cover here. A quick hint though: you need to set disk.EnableUUID = “TRUE” in your VM’s config file for scsi_id to return a value.

The situation is common: you created a virtual machine and need more storage. Hopefully you created it using LVM which would allow you to add the new disk to an existing volume group followed by a resize operation of the logical volume which is short on space. But before you can do this you have to add a new LUN to your setup-here is how you can do this without rebooting the VM.

First I recommend you install lsscsi (for convenience, not really necessary) and the sg3_utils:

[root@server1 ~]# yum install lsscsi.x86_64 sg3_utils.x86_64
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package lsscsi.x86_64 0:0.23-2.el6 will be installed
---> Package sg3_utils.x86_64 0:1.28-4.el6 will be installed
--> Processing Dependency: sg3_utils-libs = 1.28-4.el6 for package: sg3_utils-1.28-4.el6.x86_64
--> Processing Dependency: libsgutils2.so.2()(64bit) for package: sg3_utils-1.28-4.el6.x86_64
--> Running transaction check
---> Package sg3_utils-libs.x86_64 0:1.28-4.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
 Package                                      Arch                                 Version                                    Repository                           Size
========================================================================================================================================================================
Installing:
 lsscsi                                       x86_64                               0.23-2.el6                                 local                                38 k
 sg3_utils                                    x86_64                               1.28-4.el6                                 local                               470 k
Installing for dependencies:
 sg3_utils-libs                               x86_64                               1.28-4.el6                                 local                                51 k

Transaction Summary
========================================================================================================================================================================
Install       3 Package(s)

Total download size: 559 k
Installed size: 1.4 M
Is this ok [y/N]: y
Downloading Packages:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                    25 MB/s | 559 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : sg3_utils-libs-1.28-4.el6.x86_64                                                                                                                     1/3
  Installing : sg3_utils-1.28-4.el6.x86_64                                                                                                                          2/3
  Installing : lsscsi-0.23-2.el6.x86_64                                                                                                                             3/3

Installed:
  lsscsi.x86_64 0:0.23-2.el6                                                        sg3_utils.x86_64 0:1.28-4.el6

Dependency Installed:
  sg3_utils-libs.x86_64 0:1.28-4.el6

Complete!

With this done it is easy to check the attached SCSI devices, and on my system I found these:

[root@server1 ~]# lsscsi
[0:0:0:0] disk VMware, VMware Virtual S 1.0 /dev/sda
[0:0:1:0] disk VMware, VMware Virtual S 1.0 /dev/sdb
[2:0:0:0] cd/dvd NECVMWar VMware IDE CDR10 1.00 /dev/sr0

This means there are two virtual disks and a virtual CD-ROM. Now it’s time to add the new disk. Do so using the user VMware workstation interface. Once completed, you need to rescan the scsi bus:

[root@server1 ~]# rescan-scsi-bus.sh
Host adapter 0 (mptspi) found.
Host adapter 1 (ata_piix) found.
Host adapter 2 (ata_piix) found.
Scanning SCSI subsystem for new devices
Scanning host 0 for  SCSI target IDs  0 1 2 3 4 5 6 7, all LUNs
Scanning for device 0 0 0 0 ...
OLD: Host: scsi0 Channel: 00 Id: 00 Lun: 00
      Vendor: VMware,  Model: VMware Virtual S Rev: 1.0
      Type:   Direct-Access                    ANSI SCSI revision: 02
Scanning for device 0 0 1 0 ...
OLD: Host: scsi0 Channel: 00 Id: 01 Lun: 00
      Vendor: VMware,  Model: VMware Virtual S Rev: 1.0
      Type:   Direct-Access                    ANSI SCSI revision: 02
Scanning for device 0 0 2 0 ...
NEW: Host: scsi0 Channel: 00 Id: 02 Lun: 00
      Vendor: VMware,  Model: VMware Virtual S Rev: 1.0
      Type:   Direct-Access                    ANSI SCSI revision: 02
Scanning for device 0 0 2 0 ...
OLD: Host: scsi0 Channel: 00 Id: 02 Lun: 00
      Vendor: VMware,  Model: VMware Virtual S Rev: 1.0
      Type:   Direct-Access                    ANSI SCSI revision: 02
Scanning host 1 channels  0 for  SCSI target IDs  0 1 2 3 4 5 6 7, all LUNs
Scanning host 2 channels  0 for  SCSI target IDs  0 1 2 3 4 5 6 7, all LUNs
Scanning for device 2 0 0 0 ...
OLD: Host: scsi2 Channel: 00 Id: 00 Lun: 00
      Vendor: NECVMWar Model: VMware IDE CDR10 Rev: 1.00
      Type:   CD-ROM                           ANSI SCSI revision: 05
0 new device(s) found.
0 device(s) removed.

A new disk has been found, as shown by lscsi:

[root@server1 ~]# lsscsi
[0:0:0:0]    disk    VMware,  VMware Virtual S 1.0   /dev/sda
[0:0:1:0]    disk    VMware,  VMware Virtual S 1.0   /dev/sdb
[0:0:2:0]    disk    VMware,  VMware Virtual S 1.0   /dev/sdc
[2:0:0:0]    cd/dvd  NECVMWar VMware IDE CDR10 1.00  /dev/sr0
[root@server1 ~]#

Very nice-from there on it’s just another disk you can format using parted or fdisk. And you are done.