VMware Cloud Community
mmartin0926
Enthusiast
Enthusiast
Jump to solution

Shrinking Linux VM Created by Converter - P2V

Hello All,

I know this has been asked many times. But, every link/discussion I find has a different answer, and I'm not sure which one is the right one. And a lot of them depend on the VM being thin-provisioned, which this is not...

I recently moved to a Windows 10 machine from a OpenSuSE machine. Since Linux is my go to, I decided to convert my old laptop to a VM using the VMWare Standalone Converter and a Trail Version of ESXi 6. Now, I have the VM converted to a Virtual Machine within my ESXi trail VM. The end-game is to export the VM to Workstation Player.

The physical machine that I converted had 300 GB for '/' partition, which I don't need all that space anymore. I was able to get the used partition down to about 40 GB on the VM, and I was hoping to get the partition shrunk down to about, maybe 60 GB (*from currently 300 GB).

I read you can use the Standalone Converter to do v2v to shrink the partition, however in the converter I don't seem to have that option to shrink the disk, from what I can tell.

Here is what the disk looks like inside the VM:

     *The partition numbers seem strange because the P2V was a dual-boot windows/linux laptop and I only wanted the Linux partitions...

     sda1 = /boot

     sda6 = /

     sda5 = swap

pastedImage_0.png

Could someone help me out for what I need to do to shrink down the ' / ' partition, i.e. sda6?

Any help would be greatly appreciated.

Thanks in Advance,

Matt

Tags (1)
Reply
0 Kudos
1 Solution

Accepted Solutions
mmartin0926
Enthusiast
Enthusiast
Jump to solution

After searching all around and not finding a way to do this after the VM was already created, I decided to re-run the Physical to Virtual conversion again, because when doing P2V, even with Linux, you DO have the ability to modify Volumes and Sizes. Whereas when attempting V2V with the Converter, this was not possible with a Linux guest.

So the solution was to re-run VMWare Standalone Converter of my Powered-On, physical Linux machine (*P2V), and editing the Volumes during that step prior to the conversion.

-Matt

View solution in original post

Reply
0 Kudos
4 Replies
aleex42
Enthusiast
Enthusiast
Jump to solution

First you need to shrink your filesystem with "resize2fs".

Example HOWTO: microHOWTO: Reduce the size of an ext2, ext3 or ext4 filesystem

But use at your own risk. Make sure you have a backup of your data!

After shrinking the filesystem you need to shrink your partition(s) - that could be done with "fdisk" oder "cfdisk" or any GUI tool like gParted.

Hope to help,

Alex

-- Alex (VMware VCAP-DCV, NetApp NCIE, LPIC 2)
Reply
0 Kudos
mmartin0926
Enthusiast
Enthusiast
Jump to solution

Hey, thanks for the reply. Sorry for the delay, never got a notification that there was a reply.

Ok cool, I'll check out those links you supplied and give it a try.

Thanks,

Matt

Reply
0 Kudos
mmartin0926
Enthusiast
Enthusiast
Jump to solution

Hey Aleex,

So I was finally able to give this a try today.

I was able to boot the VM to a Gparted Live CD/ISO and run the resize2fs command and resized the filesystem to 60 GB. And then after that I used Gparted to resize the partition to 60 GB.

What do I need to do now to resize the VM's files on my Host OS? Do I use the v2v converter?

This is what the Standalone Converter shows for my VM's Disk details:

VM_source_disk_info.jpg

Thanks Again,

Matt

Reply
0 Kudos
mmartin0926
Enthusiast
Enthusiast
Jump to solution

After searching all around and not finding a way to do this after the VM was already created, I decided to re-run the Physical to Virtual conversion again, because when doing P2V, even with Linux, you DO have the ability to modify Volumes and Sizes. Whereas when attempting V2V with the Converter, this was not possible with a Linux guest.

So the solution was to re-run VMWare Standalone Converter of my Powered-On, physical Linux machine (*P2V), and editing the Volumes during that step prior to the conversion.

-Matt

Reply
0 Kudos