Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

enter image description hereI installed Redhat 6.4 on KVM Server. Right Now there is only One Disk /dev/vda. Now I need to add extra Disk like /dev/vdb I tried adding New Volume but it is not showing when I do fdisk -l

How to add extra Volumes to existing running VMs

share|improve this question
    
You are adding storage but it is not linked with a virtual machine. It is just a volume in the volume pool. Your VM does not know Newpart.img belongs to it. You need to point to this location /var/lib/libvirt/images/Newpart.img in your virsh edit vm-name file. –  val0x00ff Sep 30 '13 at 13:28
    
This is kind of wandering outside the question, but you might also think about creating a storage group backed by an LVM Volume Group instead of flat files. Flat files are useful if you can't anticipate how much space you'll need and need to economize storage space, or you want a least hassle initial set-up but LVM can ease management issues later on. For example, expanding these volumes or migrating them to a new storage device without turning any of the VM's off. Just my two cents, though. –  Joel Davis Sep 30 '13 at 13:36

2 Answers 2

up vote 4 down vote accepted

You can use the virsh option mentioned above (probably faster, in fact) or you can use the "Add Hardware" option in virt-manager to either add new space or assign existing space.

Simply open the VM, go to "Details" (top left), and select "Add Hardware" (bottom left):

"Add Hardware" is in the bottom left

Storage is the default type of hardware, so it should already be selected by default.

FWIW, since it's a new disk, if the guest is Linux, you probably want to add it as VirtIO instead of IDE. VirtIO has better performance but non-Linux platforms need special drivers installed to be able to use VirtIO drives.

The GUI is pretty self-explanatory. Since you've already created the .img file you probably want to select the "managed or existing storage" radio and go browsing for it. After that, it should be visible to the guest.

share|improve this answer
    
Yours GUI and my VMs GUI is different check the snap i added in the Question Section. –  OmiPenguin Sep 30 '13 at 14:25
    
You're just on a different screen. Close out of that window and open up the VM you want to modify (by double clicking on it) and go to "details" on it and you should see the screen I'm referencing up there. –  Joel Davis Sep 30 '13 at 14:28
    
Hahhahaaha, It was right there all the time in menu and i didn't notice it. I will do a lot of practice on Double -Clicking. Thanks it worked. –  OmiPenguin Oct 1 '13 at 7:07
    
+1 On the answer. I did not have virt-manager so I could not demonstrate it. Well done Joel Davis. –  val0x00ff Oct 1 '13 at 8:01

Adding a virtual disk can be done either using virt-manager (A graphical interface for KVM) or virsh.

Using virsh:

virsh edit VM-name

Modify your configuration file as needed and save the configuration file (See your vda configuration line).

NOTE: You need to reboot the VM so the virtual disk is recognized.

Shutdown your VM using virsh destroy VM-name and start the vm again using virsh start VM-name

Once you have logged in to the VM check fdisk -l as root, otherwise it will not show anything.

Finally use mkfs.ext3 /dev/vdb or mkfs.ext4 /dev/vdb to assign a file system to the virtual disk.

share|improve this answer
    
I did tried to Add New Disk using virt-manager but it ain't working. As you can see in the image I uploaded it is already added but it is not attached to Server thats why it is not showing and there is no option to connect to server –  OmiPenguin Sep 30 '13 at 13:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.