Technically that would be a trim operation. Fragmentation is not a thing on an ssd as it can read from multiple blocks. And forcing it to run will only burn up your write cycles.

On Thu, Oct 29, 2020 at 7:15 PM Seabass via PLUG-discuss <plug-discuss@lists.phxlinux.org> wrote:
Defragmentation should be an issue for you on an SSD, even if there is some, right?


------------------------------

Message: 4
Date: Wed, 28 Oct 2020 17:08:03 -0700
From: Matt Graham <mhgraham@crow202.org>
To: <plug-discuss@lists.phxlinux.org>
Subject: Re: swap file vs swap partition
Message-ID: <064f92165a42d6f88a3430b42a5211f6@crow202.org>
Content-Type: text/plain; charset=UTF-8; format=flowed

On 2020-10-28 16:24, Steve Litt via PLUG-discuss wrote:
> On Wed, 28 Oct 2020 13:43:22 -0700
> Bob Elzer via PLUG-discuss <plug-discuss@lists.phxlinux.org> wrote:
>> The biggest difference is, files can become fragmented while
>> partitions don't.
> I had no idea there was such a thing as a Linux swap file. I guess
> that's a recent thing.

You could use a file as swap space in the early 2000s. I remember
doing that on a few machines then.

> If my partition file becomes fragmented, is there a way for me
> to defragment it?

Probably not. However, file fragmentation is not generally a problem
on modern machines because disks and CPUs are much faster than they were
in 1998. If you use ext4 and have a disk that's less than 10 years old
and less than 95% full, you will not notice anything. /swapfile on my
laptop has 11 extents and it doesn't seem to have any problems.

--
Crow202 Blog: http://crow202.org/wordpress
There is no Darkness in Eternity
But only Light too dim for us to see.

---------------------------------------------------------------------------------
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
https://lists.phxlinux.org/mailman/listinfo/plug-discuss


--
A mouse trap, placed on top of your alarm clock, will prevent you from rolling over and going back to sleep after you hit the snooze button.

Stephen