Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
DrKrieger01
New Contributor

Fortimail VM - VM Disk TRIM/Discard options?

Hello!
I've been operating a Fortimail as a VM now for a little over a year, and I'm wondering if there's any way to issue any 'TRIM' commands to the virtual drives to keep the underlying storage freed up? I'm very interested if there's a way to script it and run a cron job, or if there's a built in feature to do this already.

Can anyone elaborate?

Thanks!! :)

4 REPLIES 4
Jean-Philippe_P
Moderator
Moderator

Hello DrKrieger01, 

 

Thank you for using the Community Forum. I will seek to get you an answer or help. We will reply to this thread with an update as soon as possible. 

 

Thanks, 

Jean-Philippe - Fortinet Community Team
Jean-Philippe_P
Moderator
Moderator

Hello,

 

We are still looking for an answer to your question.

 

We will come back to you ASAP.

 

Thanks,

Jean-Philippe - Fortinet Community Team
Jean-Philippe_P
Moderator
Moderator

Hello again DrKrieger01,

 

I found this solution. Can you tell us if it helps, please?

 

TRIM commands are typically used in SSDs to inform the drive which blocks of data are no longer considered in use and can be wiped internally. When it comes to virtual machines (VMs), the ability to issue TRIM commands can depend on the underlying storage and the virtualization platform you are using.

 

  1. Virtual Environment: Ensure that your virtualization platform (such as VMware, Hyper-V, or KVM) supports TRIM commands. Some platforms pass these commands directly to the underlying storage.

  2. File System Support: The file system used within your Fortimail VM must also support TRIM. For example, ext4 and Btrfs on Linux support TRIM.

  3. Scripting TRIM: You can typically issue TRIM commands using the fstrim command in Linux. You can script this command and set it to run as a cron job. Here’s a basic example:

    #!/bin/bash
    fstrim -v /
    


    Save this script as trim.sh, make it executable with chmod +x trim.sh, and then add it to your crontab:

    crontab -e
    


    Add a line like this to run it weekly:

    0 2 * * 0 /path/to/trim.sh
    


    This example runs the TRIM command every Sunday at 2 AM.

  4. Built-in Features: Some systems may have built-in features to periodically run TRIM, but this varies by configuration. Check the documentation for your specific Fortimail version and the underlying OS.

Jean-Philippe - Fortinet Community Team
DrKrieger01

I'm unable to run these commands directly in the Fortimail console; I suspect there's only a limited command list due to the system being a modified Unix/Linux distro. 
When I try and run any of these commands, I get a parsing error. 
I've even tried 'exec fstrim -v /', but it also throws a parsing error at 'fstrim'. 

Is there a command that I can run to get me into the actual Unix/Linux command line environment, not the limited command shell of the Fortimail system?

Announcements
Check out our Community Chatter Blog! Click here to get involved
Labels
Top Kudoed Authors