How to TRIM your Drives#
After importing a virtual machine from another hypervisor, sometimes the free space available inside the virtual machine does not match the free space reported to the VergeOS platform. This discrepancy is often due to the virtual disk being thick-provisioned from the VM source, making VergeOS unaware of the unused disk space. To resolve this, a TRIM/UNMAP operation needs to be performed on the virtual disk from within the virtual machine.
Prerequisites for Running a TRIM Command#
- Edit the virtual drive(s) in question in the VergeOS UI and ensure Discard is enabled.
- Ensure the virtual drive(s) is using a drive type of virtIO-SCSI or SATA.
- Ensure the virtual drive(s) is assigned to a Solid State Tier (usually tier 1-3).
Trimming a Windows Drive#
To perform a manual TRIM operation in a Windows environment, follow these steps:
- Launch PowerShell as an admin user.
- From the PowerShell prompt, type the following command:
As the TRIM operation progresses, you can watch the reported free space in the VergeOS dashboard increase as the blank data on the volume is removed.
If this does not resolve the issue, TRIM may not be enabled. To check if TRIM is enabled:
- Run the following FSUTIL command:
If the value is 1, TRIM is not enabled on the drive.
- To enable TRIM, run:
After enabling, rerun the TRIM commands.
Trimming a Linux Drive#
Newer Linux distros have TRIM enabled by default via a systemd service or a cron job. To check if automated TRIM is enabled, follow these steps:
- Ensure the prerequisite steps from above are complete.
Example: Ubuntu Server
- Launch a terminal.
- Enter the following commands to check the status:
-
Check TRIM Timer/Schedule Status:
- Check TRIM Service Status:
If TRIM is enabled, an operation will run at the next scheduled time. If TRIM is not enabled, you can run a manual TRIM using:
Info
It is recommended to enable automatic TRIM to ensure that data usage is reflected accurately between VergeOS and the guest OS.
To enable automatic TRIM, run:
For more information on fstrim
, visit the man page.
Document Information
- Last Updated: 2024-09-03
- VergeOS Version: 4.12.6