Results 1 to 5 of 5

Thread: Trim Command

  1. #1
    Join Date
    Jan 2017
    Beans
    54

    Trim Command

    I have an nvme drive with 5 partitions ( different OS's ) and when I run the trim command, does that just trim the running OS partition or does it trim all partitions, ie the whole drive ?

    The command I'm using is sudo fstrim -a -v

    Just curious to know !

  2. #2
    Join Date
    Jun 2007
    Location
    Arizona U.S.A.
    Beans
    4,894

    Re: Trim Command

    Quote Originally Posted by scriber View Post
    I have an nvme drive with 5 partitions ( different OS's ) and when I run the trim command, does that just trim the running OS partition or does it trim all partitions, ie the whole drive ?

    The command I'm using is sudo fstrim -a -v

    Just curious to know !
    It will trim / and mounted partitions. I let systemd manage the trim. The results are in the systemd journal:
    Code:
    dmn@Tyana-vm:~$ journalctl | grep fstrim
    Dec 28 06:11:02 Tyana-vm fstrim[590]: /mnt/Common-Files: 7.9 GiB (8482734080 bytes) trimmed on /dev/vdb1
    Dec 28 06:11:02 Tyana-vm fstrim[590]: /: 7.4 GiB (7945121792 bytes) trimmed on /dev/vda2
    Dec 28 06:11:02 Tyana-vm fstrim[590]: /boot/efi: 71 MiB (74432000 bytes) trimmed on /dev/vda1
    /mnt/Common-Files is my shared data partition on another disk.
    Last edited by Dennis N; February 4th, 2021 at 07:45 PM. Reason: corrected to include efi partition

  3. #3
    Join Date
    Jan 2017
    Beans
    54

    Re: Trim Command

    So I guess I would just trim the OS that is mounted then, as the other OS's are hidden, and when I check it shows the other partitions as unallocated.

    Thanks for the reply, much appreciated !

  4. #4
    Join Date
    Jun 2007
    Location
    Arizona U.S.A.
    Beans
    4,894

    Re: Trim Command

    Right. You only trim the OS in use + anything mounted to it at the time the trim is run. I notice the EFI system partition is also trimmed. I missed copying that line (I have edited the original post). You can always run the command shown and see what was trimmed. See below.

    Code:
    dmn@Tyana-vm:~$ journalctl | grep trim
    Dec 28 06:11:02 Tyana-vm fstrim[590]: /mnt/Common-Files: 7.9 GiB (8482734080 bytes) trimmed on /dev/vdb1
    Dec 28 06:11:02 Tyana-vm fstrim[590]: /boot/efi: 71 MiB (74432000 bytes) trimmed on /dev/vda1
    Dec 28 06:11:02 Tyana-vm fstrim[590]: /: 7.4 GiB (7945121792 bytes) trimmed on /dev/vda2
    Last edited by Dennis N; February 4th, 2021 at 07:45 PM.

  5. #5
    Join Date
    Jan 2017
    Beans
    54

    Re: Trim Command

    Okay, thanks for the useful info !

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •