Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am currently doing some Virtualisation lab works in which I need to run Virtual Machines on Xen hypervisor.

I need to create Logical Volumes on Volume Groups.

I can create a new Volume Group using the command

"vgcreate vgpool /dev/sda1"

While executing this, I am getting error saying that the partition is already mounted. However "/sda1" being my root partition, I cannot unmount it. I can create volume groups on partitions other than the root partition.

My questions are 1) Is there a way, I can add my root partition to a Volume Group? 2) If not, how can I create logical volumes inside the root partitions, using commands like below? (I cannot do this now since I dont know what should I substitute in place of the VolumeGroupName)

"lvcreate -L 3G -n LogicalVolumeName VolumeGroupName"

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

/dev/sda1 is a one of your partitions, which equals one physical volume.

You can boot to LiveCD and create the volumegroup there, but if you do so you will overwrite all old data on that partition when you create new logical volumes and filesystems on top of that.

share|improve this answer
    
I already have a Volume Group on another partition. I also have some data in that partition. I can create additional logical volumes in that partition on the go without disturbing the data. May I know why the same actions overwrite the data when it is on Root partition? –  Erdnase Oct 23 '13 at 15:13
    
It is not the same. When you allocate Physical Volumes (PV), you are telling the LVM to "use this entire PV" as the underlying storage. Within an established Volume Group you can use all the LVM management tools. –  Eero Aaltonen Oct 24 '13 at 8:06
    
Sorry to ask again, Does creating a volume group on ANY partition will disturb the data on that partition? –  Erdnase Oct 24 '13 at 12:12
    
Yes, as I understand it. Suppose you created a volumegroup on a partition and created a logical volume, filesystem and installed Ubuntu. How would the LVM avoid overwriting the original filesystem? –  Eero Aaltonen Oct 24 '13 at 13:06
    
Seems like this is correct. I added a new volume group on an existing partition and it destroyed all the data in it. So I am concluding that in order to install virtual machines,ideally there should be multiple partitions in the system, since we cannot create logical volume on the root partition. However, GUI tools like "Virtual Machine Manager" are able to create new virtual machines on the same root partitions. How they are creating this on the same partition (in the back end) is something of interest. –  Erdnase Oct 25 '13 at 9:04
show 1 more comment

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.