Jump to content

Thick to Thin VM Disks


Recommended Posts

Posted

Hello all

 

I have a number of VMs that I originally setup as thick provisioned (raw .img). I would like to convert these to thin volumes if possible. How would I go about doing this?

Posted

Are you sure? The default I believe for raw is sparse, unless you copied the vdisk file using something that un-sparsified it. You should be able to use

cp --sparse=always

to make the file sparse again.

Posted
16 minutes ago, jonathanm said:

Are you sure? The default I believe for raw is sparse, unless you copied the vdisk file using something that un-sparsified it. You should be able to use


cp --sparse=always

to make the file sparse again.

That is possible, I can't remember to be honest.

 

Ill give this a go and post back. Thanks for responding!

Posted

Okay so I ran the command and created new vdisks. No change in sizes as they still eat up 60G when in they're actually only half full.

 

I'll just rebuild the VMs using qcow2.

vdisk.PNG

Posted
9 minutes ago, Mr_Jay84 said:

No change in sizes as they still eat up 60G when in they're actually only half full.

That's the allocated size, not the actually used space, you can check with ls:

 

root@Tower1:~# ls -lskh /mnt/cache/VMs/Win10/
total 27G
27G -rw-rw-rw- 1 root users 60G Jul 13 15:52 vdisk1.img

27GB used, 60GB allocated

Posted (edited)
3 hours ago, johnnie.black said:

That's the allocated size, not the actually used space, you can check with ls:

 


root@Tower1:~# ls -lskh /mnt/cache/VMs/Win10/
total 27G
27G -rw-rw-rw- 1 root users 60G Jul 13 15:52 vdisk1.img

27GB used, 60GB allocated

I ran the command you specified and got a similar return however other VMs created with qcow2 show correctly, also when copying to my NAS for backup the vdisk1 & vdisk2 takes up the full 60G

 

fedora.PNG.adf07d7ffe0323a267dd3fdf0425fa91.PNG

Fedora shows correctly which was created with qcow2 and has 30G allocated.

 

 

 

win7.PNG.fa4d5820ded31928af2c6dceeff6e390.PNG

 

Windows 7 Game Server with vdisk1 being an offender, vdisk2 was created using qcow2 and has 60G allocated.

 

 

1896300125_windows10.PNG.c96fd6dfcf596595b6920ea4c2e114b8.PNG

 

Windows 10 with vdisk1 & vdisk2 showing the full 60G despite the below....

 

Capture2.PNG.258494d8ef2a041afcbbc131172a3f82.PNG

 

Edited by Mr_Jay84
Posted
2 minutes ago, Mr_Jay84 said:

also when copying to my NAS for backup the vdisk1 & vdisk2 takes up the full 60G

You'd need to copy with the --sparse-always flag, assuming the NAS filesystem supports that.

 

QCOW2 are compressed images, so they compress the zeros, i.e., all the blank space.

Posted (edited)

I see Johnnie. Okay thanks for the help mate.

 

The original vdisks were copied to the nas and back again so maybe thats where the issue came from.

Edited by Mr_Jay84

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...