Best Disk set-up and shrink vm-disk

Ian S

New Member
Jul 2, 2017
3
0
1
48
I'm very new to Proxmox VE so I apologize if I'm asking something I should know. I have read a good amount on the forums and info pages.

I am trying to figure out two things.

The first is how to shrink the pve-vm--VM NUMBER--disk--1 that come off of pve-data-tpool. I transfered a few virtual box vmdks to the my pve system converting them to raw using the instructions I found on the forum (
qemu-img convert -p -f vmdk NAME.vmdk" -O raw /dev/mapper/pve-vm--101--disk-1.) They all have larger than I'd like virtual drives. Inside the operating system I've shrunk the drives and they show up as the right size, along with the extra space as unallocated space, i.e. in drive manager C:drive 60GB, 60GB unallocated space. Is there a way to shrink the drives in proxmox, so the unallocated space goes away?

The second question is related. I purchased a used dell server to create my home lab, hoping to set-up multiple servers and clients to hopefully learn a ton. As the server only has one small drive I am already running out of space with my VMs. I am now planning on adding a couple drives. Is there a best way to add them to the system. I am running proxmox 4.4 with the default LVM setup. If I add a drive or two is there a way to add it to the pool? Or would it better to add a big drive and migrate everything over to it and then, add back the small drive as a second volume. Is there a best way to add/manage drives/storage? I did read the storage and lvm pages and see there are many options but would I love a quick this is how you do it for now with a simple reason why if possible, and then hopefully as I learn I can come back to it and try to figure out more.

Thanks again for helping a newbie, and hopefully I learn enough to help others out in the future.
 
The first is how to shrink the pve-vm--VM NUMBER--disk--1 that come off of pve-data-tpool. I transfered a few virtual box vmdks to the my pve system converting them to raw using the instructions I found on the forum (
qemu-img convert -p -f vmdk NAME.vmdk" -O raw /dev/mapper/pve-vm--101--disk-1.) They all have larger than I'd like virtual drives. Inside the operating system I've shrunk the drives and they show up as the right size, along with the extra space as unallocated space, i.e. in drive manager C:drive 60GB, 60GB unallocated space. Is there a way to shrink the drives in proxmox, so the unallocated space goes away?

Why do you use RAW? Never do that if you like small images. Just convert to QCOW2 and you can have exabytes of space in a few kilobyte (until you want to write that amount :-p). Also trim or sdelete your drives before converting to QCOW to ensure, that they'll be as small or as empty as possible.
Yet, generally, there is no option to shrink a VM, because it is a very, very complicated task for a hypervisor to do it in such a way, that the OS inside in your VM still works.

The second question is related. I purchased a used dell server to create my home lab, hoping to set-up multiple servers and clients to hopefully learn a ton. As the server only has one small drive I am already running out of space with my VMs. I am now planning on adding a couple drives. Is there a best way to add them to the system. I am running proxmox 4.4 with the default LVM setup. If I add a drive or two is there a way to add it to the pool? Or would it better to add a big drive and migrate everything over to it and then, add back the small drive as a second volume. Is there a best way to add/manage drives/storage? I did read the storage and lvm pages and see there are many options but would I love a quick this is how you do it for now with a simple reason why if possible, and then hopefully as I learn I can come back to it and try to figure out more.

If your server supports RAID, why not build a RAID-5 on top of all the disks (assuming they'll have the same size). You need to reinstall to get it work fast (other ways exists, but not recommended for beginners). You can of course have all disks as space, but I'd strongly suggest to have everything on one big pile (best with redundancy).
 
Thanks for the reply.

I tried qcow2 first, scp'd the vmdk from my laptop to the /var/lib/vz/images/VMID I created as for someone's tutorial and then ran the qemu convert, but for some reason I kept getting errors. Maybe I should have been converting to dev/mapper, not in place. I'm still not 100% clear on the virtual disk structure/paths. I thought under proxmox 4.4 that the drives are all on a LVM partition and thus don't use space until necessary no matter the format, am I wrong on that? It seems to be the way it is working.

I plan to eventually set up a raid, but as the budget is tight (part of the reason I'm setting this up is to study for better jobs) I am planning on re-using drives I've pulled from other systems, so a RAID is a no go for now. The server has a RAID card in it, so that may be a long-term possibility. So with that possibility of the table for the next couple of months, what's the easiest/best way to add space for VMs in the system?

Thanks again for the quick response.
 
Just to update I was able to shrink the drive images . . . played around a lot, but as I'm trying to learn that was good. I shrunk the drive partitions in the actual Windows VMs using disk manager. I then used lvdisplay to find the lv name and path, and then used lvresize, and it worked. Both of my test VMs still work and are now a manageable size. Oh, I also edited the config files in the CLI using nano so the drive sizes showed up right in the GUI.

I also added a drive to the server and expanded my local LVM using the info here: https://pve.proxmox.com/wiki/Extending_Local_Container_Storage

I'm not sure if it's because of changes from earlier versions of Proxmox, but the one command that wouldn't work, but seems to have had no effect is resize2fs. I tried researching and was wondering what the changes were and why that command is no longer working/necessary as I'd like to understand the process better. If anyone has an explanation I'd love to learn.

Thanks again.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!