![]() The open-source version of VMware Tools for Linux, open-vm-tools, has added a simple command to automate the above steps in the latest version. Once you’re ready, here’s how to shrink your Linux-based VM: Sadly, you either need to delete them or, if you care about keeping snapshots, you can backup the VM as-is to an external disk and then delete the local snapshots. The “clean up” feature that VMware has developed for Windows guests can be applied to Linux guests as well, but it’s pretty convoluted - we need to essentially clean up the VM ourselves, trick VMware to detect the free space, and manually shrink the volume.Ī tiny caveat: This only works on VMs without any snapshots. On a portable machine like my MacBook Air, this can be a huge waste! On a Windows guest, VMware would be able to shrink the volume back down to 10 GB - but you’ll quickly notice, annoyingly, that a Linux disk will remain at 15 GB, even though you’re no longer using that much. I finish the project and delete the 5 GB of its files. Let’s say that my Debian guest starts at 10 GB and I use 5 GB for my project, totaling 15 GB. If you poke around in VMware, you’ll find that the clean up button is greyed-out under the settings of a Linux VM.Ĭommonly, I’ll use a few gigabytes of storage for a project and then delete the files from the guest when I’m done. Either way, cleaning up virtual machines works like a charm.when you have Windows as a guest operating system with an NTFS disk.Īs a developer, I have several VMs with various Linux-based guest OSes - and, for some reason, VMware doesn’t know how to optimize these. VMware can be set to automatically optimize and shrink virtual hard disks as you add and, more importantly, remove files - but this automatic “clean up” setting is disabled by default. 60 GB is simply the maximum amount of storage allowed if your guest operating system and its files amount to 20 GB, the VMDK file will simply be 20 GB. You’ll notice that even if you create a virtual machine with a capacity of 60 GB, for example, the actual size of the VMDK file will dynamically resize to fit the usage of the guest operating system. ![]() On Windows virtual machines, VMware has a “clean up” function, which detects newly unused space and makes the size of the virtual hard disk smaller accordingly. For other languages you'll need to replace /disabled/ in the command with its translation to your language.VMware Workstation and Fusion normally work hard to minimize the size of virtual hard disks for optimizing the amount of storage needed on your host machine. Update: It looks like this script only works with English. In my case, the script reduced the size of the /var/lib/snapd/snaps/ folder by more than 50%. Using this script should free up some significant disk space (depending on the number of snap packages installed on your system, and if they had updates since they were installed). Snap remove "$snapname" -revision="$revision" LANG=en_US.UTF-8 snap list -all | awk '/disabled/' | Related, but for Flatpak packages: How To Remove Unused Flatpak Runtimes To Free Up Disk Spaceīut what if you want to remove all versions kept on the system for all snap packages that had updates? This is a script created by Popey, Community Manager in Ubuntu Engineering at Canonical, to remove ALL old versions of snaps, only keeping the current active version (updated with LANG=en_US.UTF-8 so it works with non-English locales, thanks to William in the comments): You can change this from the default value of 3 to 2 by using: There is a snap option (starting with snapd version 2.34), called refresh.retain, to set the maximum number of a snap's revisions stored by the system after the next refresh, which can be set to a number between 2 and 20. Meaning that for each installed snap package that had at least 2 updates, I had 3 revisions stored on my system, taking up quite a bit of disk space. While investigating how I could free up some space / clear the snap cache from the /var/lib/snapd/snaps/ folder without removing the snap packages I had installed, I found out that by default, 3 snap versions are stored by the system after snap package updates. I was using Disk Usage Analyzer recently to see if I could free up some space on my Ubuntu 18.10 desktop, when I noticed that the /var/lib/snapd/snaps/ folder was quite large.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |