Adding virtual hard disk to SUSE VM on VMware
without reboot
If you need to add an additional hard disk
to your VM running the SUSE family of operating system, but it’s in production
and you cannot reboot it.
Solution:
Solution:
First, open the "edit settings" window, within the VM, either from the console
menu, or by right clicking in the VM through the virtual infrastructure client.
Add a hard disk and configure it with the size you require. Finally accept the
changes and close the window. After a few seconds, the virtual infrastructure
client will show the reconfiguration being complete.
Now login to the operating system of the VM, as the root user - or use sudo.
You will see that the VM does not see the new disk, i.e.. running the command:
$ fdisk -l
Shows only the existing disks; there is no sign of the new one.
What we need to do is, re-scan the SCSI bus, without rebooting the vm. To do this run the following command:
$ echo "- - -" >/sys/class/scsi_host/host#/scan
e.g
$ echo "- - -" >/sys/class/scsi_host/host0/scan
Where the # is replaced with the SCSI host value, usually 0
Now we re-run the command:
$ fdisk -l
We can now see our additional disk and can carry on configuring it using the usual tools, i.e. fdisk and mkfs or partitioner through yast, etc
Now login to the operating system of the VM, as the root user - or use sudo.
You will see that the VM does not see the new disk, i.e.. running the command:
$ fdisk -l
Shows only the existing disks; there is no sign of the new one.
What we need to do is, re-scan the SCSI bus, without rebooting the vm. To do this run the following command:
$ echo "- - -" >/sys/class/scsi_host/host#/scan
e.g
$ echo "- - -" >/sys/class/scsi_host/host0/scan
Where the # is replaced with the SCSI host value, usually 0
Now we re-run the command:
$ fdisk -l
We can now see our additional disk and can carry on configuring it using the usual tools, i.e. fdisk and mkfs or partitioner through yast, etc
Demo
root@linux-1:/root/Desktop
$ fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total
41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512
bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000ddc04
Device
Boot Start End Blocks
Id System
/dev/sda1
2048 3084287 1541120
82 Linux swap / Solaris
/dev/sda2
* 3084288 41943039
19429376 83 Linux
Disk /dev/sdb: 16.1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders, total
31457280 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512
bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000d8dbb
Device Boot Start End Blocks
Id System
/dev/sdb1
2048 31457279 15727616
83 Linux
Disk /dev/sdc: 16.1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders, total
31457280 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512
bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00057ad4
Device
Boot Start End Blocks
Id System
/dev/sdc1
2048 31457279 15727616
83 Linux
root@linux-1:/root/Desktop $
root@linux-1:/root/Desktop
$ echo "- - -" >/sys/class/scsi_host/host0/scan
Now
Verify
root@linux-1:/root/Desktop
$ fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total
41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512
bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000ddc04
Device
Boot Start End Blocks
Id System
/dev/sda1
2048 3084287 1541120
82 Linux swap / Solaris
/dev/sda2
* 3084288 41943039
19429376 83 Linux
Disk /dev/sdb: 16.1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders, total
31457280 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512
bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000d8dbb
Device
Boot Start End Blocks
Id System
/dev/sdb1
2048 31457279 15727616
83 Linux
Disk /dev/sdc: 16.1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders, total
31457280 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512
bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00057ad4
Device
Boot Start End Blocks
Id System
/dev/sdc1
2048 31457279 15727616
83 Linux
Disk /dev/sdd: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders, total
20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512
bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/sdd doesn't contain a valid partition
table
root@linux-1:/root/Desktop $