Linux - Virtualization and CloudThis forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am having trouble to install guests out of previously made Guests.
I use KVM and for guests I use LVMs as SWAP and disk
I installed a CentOS guest and mounted it using kpartx and zipped all its contents, preserving numeric owners.
Now when I create a new Guest, I am trying to use the zip from the old machine to simply unzip it and boot.
Before unzipping, I am copying the 512 bytes of the MBR and Partition table from the original guest.
Then I unzip the zip I created after mounting the LVM of the new machine.
When I boot the machine, the console in Virt-Manager shows its hung at StartUp only and the CPU Usage is at 50% of the total Server CPU.
What's all this stuff about the MBR?? if you want to make a new VM from an existing disk image, just take a copy of the disk image and use it under a new VM config. I don't understand what or why you're trying to do this. Might be ignorance on my side, but I have never ever seen any reference to messing with MBR's or partition tables within any form of virtualization.
Also, AFAIK, you don't need any swap under a KVM VM, as it can use memory over subscription and let the host machine swap out the mapped memory to the hosts swap implicitly, so just make the guests memory as large as you need, and don't use a swap partition at all.
resize2fs doesn't work properly? How so? The guest will have no idea what size LV the underlying virtual disk is attached to, so what are we really talking about? resize2fs clearly has nothing to do with LVM so you need to be clearer on the terminology and scope you're talking about. Why is a copy of the disk image not going to work? If you provide a consistent and well managed evironment then you should be able to drop the VM image in really easily to a new qemu config.
I installed the CentOS guest on a 2 GB LVM
Then I made a image of the LVM :
dd if=/dev/vg/centos of=/root/centos.img
Then I created a 10GB LVM and ran the following command :
dd if=/root/centos.img of=/dev/vg/10g
I made the KVM config and booted it without errors.
df now shows 2 GB in the 10GB LVM.
Why is that so ?
I tried resize2fs and still 2 GB!
Any help will be appreciated.
Also I wanted to know who should I shrink the size of the centos.img I made.
Can it be squeezed to just use the space occupied by the OS files ?
It uses only 900MB in the LVM.
But the centos.img is 2.00 GB full as I dd'd it.
Is there a way to dd only the occupied space.
you can check it with lvs or lvdisplay
so first u will need to extend the 10g lv to 10G (or space you have or what you want) and you will be able to increase the fs with resize2fs
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.