Innovate | Connect | Transform
ContactService statusUSD $

GICT knowledge base

Understanding SSD Trim

Published

rapid deploy serverszfstrim

If you are running an InterServer Rapid Deploy or SSD KVM system, you might run into a confusing issue: your file system reports that you have deleted files, but your actual disk usage reports remain high. You might see 50GB of data on the drive, but the server reports 80GB used.

This “ghost usage” happens because of how Solid State Drives (SSDs) manage data. When you delete a file in your Operating System, the OS marks the space as free, but the SSD itself doesn’t know those specific blocks are empty. It continues to hold onto the old data. This becomes more apparent with snapshots running holding space.

To fix this discrepancy and reclaim that space, you need Trim.

What is Trim?

Trim is a command that lets your Operating System communicate with the SSD. It tells the drive, “These data blocks are no longer needed. You can wipe them and use them for new data.”

Why is this useful?

  • Reclaims Space: It ensures your disk usage reports match reality.
  • Improves Performance: SSDs write faster to empty blocks. If a block still holds old data, the drive has to wipe it before writing, which slows down the server.
  • Extends Drive Life: It helps the SSD manage its internal storage more efficiently.

Real-World Example: ZFS Trim Status

Below is an actual log from a server. You can see the progression from an “untrimmed” state (where space is not reclaimed) to a “trimming” state.

1. Before Trim

Notice the status says (untrimmed). The drive is holding onto data the OS has likely already deleted.

pool: vz
 state: ONLINE
 scan: resilvered 1.41T in 01:29:22 with 0 errors on Tue Dec 30 19:51:29 2025
config:

        NAME                                             STATE     READ WRITE CKSUM  SLOW
        vz                                               ONLINE       0     0     0     -
          mirror-0                                       ONLINE       0     0     0     -
            ata-Samsung_SSD_870_EVO_2TB-part3            ONLINE       0     0     0     0  (untrimmed)
            ata-CT2000MX500SSD1_2301E698F084-part3       ONLINE       0     0     0     0  (untrimmed)

errors: No known data errors

2. During Trim

Once the command runs (e.g., zpool trim vz), the drive begins processing the empty blocks to free up space.

 pool: vz
 state: ONLINE
 scan: resilvered 1.41T in 01:29:22 with 0 errors on Tue Dec 30 19:51:29 2025
config:

        NAME                                             STATE     READ WRITE CKSUM  SLOW
        vz                                               ONLINE       0     0     0     -
          mirror-0                                       ONLINE       0     0     0     -
            ata-Samsung_SSD_870_EVO_2TB-part3            ONLINE       0     0     0     0  (0% trimmed, started at Sun 04 Jan 2026 10:36:00 AM AST)
            ata-CT2000MX500SSD1_2301E698F084-part3       ONLINE       0     0     0     0  (0% trimmed, started at Sun 04 Jan 2026 10:36:00 AM AST)

3. After Trim

Once finished, the drive status returns to normal and the available space is accurate.

root@qs385:/vz/qs25777# zpool  status
  pool: vz
 state: ONLINE
 scan: resilvered 1.41T in 01:29:22 with 0 errors on Tue Dec 30 19:51:29 2025
config:

        NAME                                             STATE     READ WRITE CKSUM
        vz                                               ONLINE       0     0     0
          mirror-0                                       ONLINE       0     0     0
            ata-Samsung_SSD_870_EVO_2TB-part3            ONLINE       0     0     0
            ata-CT2000MX500SSD1_2301E698F084-part3       ONLINE       0     0     0

How to Configure Trim

To take advantage of trim completely, your system needs to be mounted with the discard option, and you should run fstrim through a cron job or a system timer.

1. Mount with Discard (fstab)

The discard option tells the filesystem to issue Trim commands immediately when files are deleted. You add this to your /etc/fstab file.

Example fstab entry:

# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/sda1       /               ext4    defaults,discard 0       1

2. Schedule fstrim

While discard works in real-time, running a scheduled fstrim ensures nothing is missed. You can do this via a system timer or a cron job.

Using Cron (Weekly):

# Run fstrim on the root directory once a week
@weekly fstrim -v /

Using Systemd Timer:

systemctl enable fstrim.timer
systemctl start fstrim.timer

Need Assistance?

If you are unsure about editing system files or need help enabling trim on your server, please reach out to InterServer support. We can check your current configuration and help you reclaim your disk space.

Related guides

Account services are unavailable until the production backend is configured.