Hi all,
Today I ran into something that took me a bit to figure out. I could not add new disks to a virtual machine running Ubuntu.
The basic scenario:
- VMWare ESXi 5.1
- Ubuntu 12.04.3 LTS
- 15 virtual harddrives already configured
I had to add more space to a filesystem without rebooting the server, which normally is very simple. This is what I normally do:
- Add a virtual disk in vSphere Client
- “rescan-scsi-bus -w -c” on the guest system (ubuntu)
- fdisk -> create partition and set device id to 8e
- pvcreate vgName /dev/sdX1
- vgextend
- lvextend -L +100G /dev/vgName/lvName
- sudo fsadm -v resize /dev/vgName/lvName
I tried to do this, but no matter what, I just could not get my Ubuntu box to see the new disks (I added a few).
Now over to the solution: After quite some research, I figured out what I had to do, but first some theory.
VMWare: When you add your 16th scsi device, VMWare will not only add the disk you ask it to add, but allso add a new scsi controller, and add the new disk to this controller. This since you can only have 16 devices on the scsi2 bus (duh). The new disk will be “SCSI (1:0)”. If you just want to test this, you can add a new disk to your VM and in the last section of the wizard, just assign it to (1:0). Before you apply this to your VM, you will see that you will not only add a new disk; you will also add a new scsi controller.
Ubuntu: If you just try and run on your Ubuntu system, it will happily do so, but it will not be able to see your new disk; since it does not know of your new scsi controller yet. You will notice that, since the adapters are listed in the beginning of the output:
maglub@nfs-v001alt:~$ sudo rescan-scsi-bus -c -w
/sbin/rescan-scsi-bus: line 592: [: 1.03: integer expression expected
Host adapter 0 (ata_piix) found.
Host adapter 1 (ata_piix) found.
Host adapter 2 (mptspi) found.
...
So, the million dollar question is: How do you add this adapter without rebooting?
First, check the PCI bus, just to see that you don’t have the new scsi controller listed:
maglub@nfs-v001alt:~$ lspci
00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01)
...
00:10.0 SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)
No trace of the new controller. This is, because you will need to rescan the PCI bus as well. To do this, you will need to do the following (as root):
echo "1" > /sys/bus/pci/rescan
If you check your PCI bus now, you will see the new scsi-controller:
root@nfs-v001alt:~# lspci
00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01)
...
00:10.0 SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)
...
02:02.0 SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)
02:03.0 SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)
This will also add your new disks, but if you are curious, you can scan your scsi bus for new disks to see what happens:
root@nfs-v001alt:~# rescan-scsi-bus -w -c
/sbin/rescan-scsi-bus: line 592: [: 1.03: integer expression expected
Host adapter 0 (ata_piix) found.
Host adapter 1 (ata_piix) found.
Host adapter 2 (mptspi) found.
Host adapter 3 (mptspi) found.
...
The command can see your new scsi adapter! Voila!