Linuxiarze.pl Forum

Dystrybucje Linux => Debian => Wątek zaczęty przez: linux4ever w Październik 28, 2025, 07:34:23 AM

Tytuł: Deuvan jak włączyć trim
Wiadomość wysłana przez: linux4ever w Październik 28, 2025, 07:34:23 AM
Jak włączyć trim na Devuanie z sys V init ?

EDIT: Aktualnie się nie da więc trzeba discard.

CytatTo enable discard in
/etc/fstab, add discard to the options for the relevant filesystem entry. For example, a line in /etc/fstab would look like this: /dev/sda1 /mnt/ssd ext4 defaults,discard 0 0. While this is a direct way to enable discard, the fstrim command run via a scheduled task is now the preferred method for most users, as continuous discard can cause performance issues on some SSDs.
Edit /etc/fstab

    Open the /etc/fstab file with a text editor with root privileges.
    Find the line corresponding to the filesystem you want to enable discard for.
    Add the discard option to the fourth column (the options column). If there are other options, separate them with a comma, for example: defaults,discard.
    Save the file.
    Run sudo mount -o remount,discard /your/mount/point to apply the changes to the currently mounted filesystem, or reboot the system to apply the changes to all relevant filesystems.

Alternative: Use fstrim

    This method is often recommended over the discard mount option as it can be scheduled to run at set intervals, like once a day, and avoids the performance issues of continuous discard.
    To enable this, run the fstrim command manually or use a cron job or a systemd timer to schedule fstrim -a to run regularly.

Important considerations

    Performance: Continuous discard can cause write performance issues on some SSDs because it can try to trim when it is writing.
    Alternatives: The fstrim command or a periodic timer is a better option for most users as it is less disruptive to performance.
    Filesystem and hardware support: Ensure that your filesystem (e.g., ext4, btrfs) and hardware support discard. Some older or enterprise RAID controllers may not pass TRIM commands correctly.
    Encryption: Using discard can weaken some types of encryption. If you are concerned about security, consider alternatives like LVM without thin LVs