Add a New HDD to a VM Without Rebooting
This article describes how to add a new HDD to a VM without rebooting – handy if you need consistency of service and don’t have a redundant solution.
Solution:
Add a hard disk as usual through the VM settings. Check dmesg to see if the kernel has detected it automatically, if not:
echo "- - -" > /sys/class/scsi_host/host0/scan
fdisk -l
You should see something like:
Disk identifier: 0x00004fff
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 30076927 15037440 83 Linux
/dev/sda2 30078974 31455231 688129 5 Extended
/dev/sda5 30078976 31455231 688128 82 Linux swap / Solaris
Disk /dev/sdc: 429.5 GB, 429496729600 bytes
255 heads, 63 sectors/track, 52216 cylinders, total 838860800 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/sdc doesn't contain a valid partition table
/dev/sdc is the disk you just added, all you need to do is “fdisk /dev/sdc” to partition it and “mkfs.ext3 /dev/sdc1” to format the partition.
Job done.
Like this:
Like Loading...