Skip to content

blog.Gudynas.lt

About everything

Menu
  • Home
  • AS215899
  • OpenWebRX SDR
  • ADS-B Tracker
  • About sdr.Gudynas.lt
  • Contacts
Menu

Enable Proxmox weekly containers fstrim

Posted on 2026-04-06 by Justas

What is fstrim?

fstrim tells SSDs or thin-provisioned storage which blocks are no longer used by the filesystem so they can be reclaimed.

Without TRIM/discard:

deleted data still looks “used” to the storage layer
SSD performance slowly degrades
thin storage pools appear full even when files were deleted
write amplification increases (reduces SSD lifespan)

Running fstrim weekly keeps storage clean and efficient.

Why Proxmox Needs Weekly fstrim

Proxmox commonly uses:

SSD/NVMe drives
LVM-thin
ZFS thin provisioning
Ceph RBD
qcow2 images

When VMs delete files, the host storage does not automatically know space is free.

Weekly fstrim:

✅ returns unused blocks to SSDs
✅ frees space in thin pools
✅ improves VM disk performance
✅ prevents storage from filling unexpectedly
✅ reduces SSD wear

Continuous discard (mount -o discard) is slower; periodic fstrim is the recommended approach.

Step 1 — Edit the fstrim Timer

Open the systemd timer configuration:

systemctl edit –full fstrim.timer

Step 2 — Modify the Timer Configuration

Replace or edit the file to look like this:

[Unit] Description=Discard unused filesystem blocks once a week
Documentation=man:fstrim
#ConditionVirtualization=!container
ConditionPathExists=!/etc/initrd-release

[Timer] OnCalendar=weekly
AccuracySec=1h
Persistent=true
RandomizedDelaySec=100min

[Install] WantedBy=timers.target
Important change

Comment out:

#ConditionVirtualization=!container

Why Comment This Line?

ConditionVirtualization=!container

This condition prevents the timer from running inside virtualized/container environments.

In Proxmox setups:

some hosts or nested environments are detected as virtualized
systemd may skip running fstrim
TRIM never executes even though storage supports it

Commenting it out ensures:

✅ fstrim runs reliably on Proxmox hosts
✅ TRIM works in nested or special virtualization setups

Step 3 — Save the File

Save and exit the editor.

Step 4 — Reload systemd

Apply the changes:

systemctl daemon-reload

Step 5 — Enable and Start the Timer

Enable weekly execution:

systemctl enable –now fstrim.timer

Step 6 — Verify Timer Status

Check that it is active:

systemctl status fstrim.timer

or:

systemctl list-timers fstrim.timer

You should see the next scheduled run.

Step 7 — Test Manually (Recommended)

Run fstrim once to confirm it works:

fstrim -av

Example output:

/: 12.3 GiB (13207031808 bytes) trimmed

This confirms TRIM is functioning.

How the Timer Works
Setting Meaning
OnCalendar=weekly runs once per week
AccuracySec=1h systemd may shift execution within 1 hour
Persistent=true runs missed jobs after reboot
RandomizedDelaySec=100min avoids many servers trimming simultaneously
Recommended Proxmox Practice

Best setup:

✅ weekly fstrim.timer
❌ avoid permanent discard mount option
✅ enable SSD emulation + discard in VM disk settings
✅ use virtio-scsi for guests
Quick Summary

What you did:

Edited fstrim.timer
Disabled virtualization restriction
Reloaded systemd
Enabled weekly TRIM

Result:

👉 automatic weekly reclaim of unused disk blocks
👉 better SSD performance
👉 accurate thin-storage usage
👉 longer drive lifespan

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.

Categories

  • sdr.Gudynas.lt Project (6)
  • AS215899 (1)
  • Linux (44)
  • Windows (1)
  • Uncategorized (2)

Archives

  • April 2026 (1)
  • October 2025 (1)
  • August 2025 (2)
  • March 2025 (1)
  • November 2024 (2)
  • January 2024 (2)
  • December 2023 (1)
  • October 2023 (1)
  • September 2023 (2)
  • May 2023 (1)
  • April 2023 (1)
  • March 2023 (1)
  • August 2022 (1)
  • July 2022 (1)
  • March 2022 (1)
  • December 2021 (5)
  • November 2021 (5)
  • September 2021 (4)
  • August 2021 (1)
  • July 2021 (1)
  • May 2021 (1)
  • April 2021 (1)
  • January 2021 (1)
  • October 2020 (2)
  • August 2020 (1)
  • May 2020 (1)
  • November 2019 (2)
  • September 2018 (10)

Recent Posts

  • Looking for BGP IPv6 transit in Lithuania
  • SDR.Gudynas.lt upgrades, ADS-B receiver installed
  • Ready for Winter, Network upgrades, and What was done in 2024 for sdr.gudynas.lt project
  • 2023-10-15 Some SSTV decoding on 10/11m SDR
  • Enabling auto-adjust waterfall colors by default OpenWebRX

Recent Comments

  • Justas on Debian 13 “trixie” sysctl tutorial
  • Marco on Debian 13 “trixie” sysctl tutorial
  • Bruce MAYO on About sdr.Gudynas.lt OpenWebRX project
  • BT on About sdr.Gudynas.lt OpenWebRX project
  • Bernd on About sdr.Gudynas.lt OpenWebRX project
April 2026
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
27282930  
« Oct    
© 2026 blog.Gudynas.lt | Powered by Minimalist Blog WordPress Theme