Some questions about SSDs & fstrim

Issues and / or general discussion relating to Puppy

Moderator: Forum moderators

Post Reply
User avatar
courtage
Posts: 55
Joined: Thu Jul 16, 2020 10:31 am
Location: Puppy user since 2006
Has thanked: 29 times
Been thanked: 4 times

Some questions about SSDs & fstrim

Post by courtage »

I'm running Bionic64 as a frugal install with a savedir, all from a 1TB Samsung 870 SSD as sda1

The days are long passed that I can remember the ins and outs of the layered fs in Puppy, so I'm slightly confused as to how fstrim will & won't work on my SSD.

~ If I issue "fstrim -v /mnt/sda1" I get "fstrim: /mnt/sda1: the discard operation is not supported"

This is presumably because /dev/sda1 is actually mounted on /initrd/mnt/dev_save and not on /mnt/sda1

~ If I issue "fstrim -v /mnt/home/" , it trims the SSD

~ If I make a directory anywhere as a mountpoint and mount /dev/sda1on it, and then issue the fstrim with that mountpoint as the target, it trims the SSD.

I know theres a pet gui but I don't really need that, I'm just going to set up a cron job.

so is there any reason not to simply run

[/code]
fstrim /initrd/mnt/dev_save
[/code]

?

Last edited by courtage on Mon Apr 04, 2022 12:03 pm, edited 1 time in total.
User avatar
bigpup
Moderator
Posts: 6516
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 790 times
Been thanked: 1353 times

Re: Some questions about SSDs & fstrim

Post by bigpup »

Not sure about the answer to your question.

However, if the save is on sda1.
sda1 is kind of in a soft mount condition, because the save is mounted and it's file system is layered into the operating file system.
So to do trim on sda1.
First do a full mount by clicking on the desktop drive icon for sda1.
then do trim command on /mnt/sda1

Note:
/mnt/home/ is usually to Puppy the location the save is.

So, maybe fstrim /initrd/mnt/dev_save would also work.
Only way to know is try it.

I do wonder if it actually will trim the complete sda1 or just the file system in the save on sda1 :idea:
The save is a Linux file system inside a file or directory(folder).

fstrim is used on a mounted filesystem to discard (or "trim")
blocks which are not in use by the filesystem.

10 ways to do anything, but which one is it the best way to do it. :lol:

Forum Global Moderator
The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

backi
Posts: 593
Joined: Thu Jul 23, 2020 2:28 pm
Has thanked: 72 times
Been thanked: 68 times

Re: Some questions about SSDs & fstrim

Post by backi »

Hi @courtage

Maybe try with:
fstrim -av

Partitions must be mounted.

Maybe useful...more here:

Trimming SSD Manually.(https://easylinu ... /ssd.html)

User avatar
courtage
Posts: 55
Joined: Thu Jul 16, 2020 10:31 am
Location: Puppy user since 2006
Has thanked: 29 times
Been thanked: 4 times

Re: Some questions about SSDs & fstrim

Post by courtage »

yes I know all that, I'm specifically asking about the slight peculiarities that Puppy presents.

dimkr
Posts: 2118
Joined: Wed Dec 30, 2020 6:14 pm
Has thanked: 42 times
Been thanked: 982 times

Re: Some questions about SSDs & fstrim

Post by dimkr »

woof-CE now has https://github.com/puppylinux-woof-CE/w ... nit.d/trim, which runs fstrim once a week.

User avatar
Phoenix
Posts: 339
Joined: Fri Feb 12, 2021 2:03 am
Location: Canada
Has thanked: 4 times
Been thanked: 48 times

Re: Some questions about SSDs & fstrim

Post by Phoenix »

@courtage :
The probable reason as to why it won't fstrim /mnt/sda1 is that you didn't mount it there, and therefore that directory is part of your savefile/folder. Directories do take up data in order to exist. It will not allow trimming or allow that to occur, because the device used to mount the savefile is special. It is a loop device, although the full name is a loopback device. What this enables you to do is to mount a file as if it were an ordinary disk. Actual disk images (like dd'ing an actual drive) take a bit more work to mount. But you cannot issue trims because of this reason.

Reasons as to why you should not run fstrim on /mnt/home:

  1. It's a USB and you'll kill it faster than a standard SSD. (Less cycles!)
  2. It probably won't do any favors for a USB, even with sequential reading. Well, maybe a little bit, but I think burning cycles away just for that little boost isn't worth it.

Reasons why to do so:

  1. SSDs suffer from what is called write amplification, although with some better written code this can be minimized a lot, such as with ext4. To check the fragmentation level of your ext4 partition, run fsck -nvf /dev/device.
  2. Informs SSDs of which cells are free, therefore wear leveling is more accurate. It also improves performance.
  3. Fragmentation tolerance limit: Does not apply to Linux filesystems, but it does to Windows NTFS! (Explains the schedule if you ever checked that)
  4. Lastly it is very very good at ensuring data is deleted, forever. Once you did it almost no one will be able to get it back. Now if you care about your data, you probably will not want TRIM at all. Otherwise tools such as ext4magic won't be able to get it back for you! (Although mkfs does implicitly enable TRIM so now you'll have to manually say, no you don't want it.)

Notes: There are a couple of trips regarding ultimate destruction of data. TRIM only will do it if its configured right and implemented properly. So smashing it to atoms may be a better bet.

Things not to do:
Spamming fstrim, it serves no point and will waste cycles. And it kills poor quality SSDs faster.

IRC: firepup | Time to hack Puppy!

User avatar
gychang
Posts: 554
Joined: Fri Aug 28, 2020 4:51 pm
Location: San Diego, CA
Has thanked: 195 times
Been thanked: 51 times

Re: Some questions about SSDs & fstrim

Post by gychang »

dimkr wrote: Mon Apr 04, 2022 1:18 pm

woof-CE now has https://github.com/puppylinux-woof-CE/w ... nit.d/trim, which runs fstrim once a week.

I am running FP64, does it already have "built-in" fstrim for my SSD as long as it is mounted?

======

Puppy Bytes, utube videos
https://www.youtube.com/channel/UCg-DUU ... u62_iqR-MA

======

User avatar
bigpup
Moderator
Posts: 6516
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 790 times
Been thanked: 1353 times

Re: Some questions about SSDs & fstrim

Post by bigpup »

What is FP64?

Forum Global Moderator
The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

User avatar
gychang
Posts: 554
Joined: Fri Aug 28, 2020 4:51 pm
Location: San Diego, CA
Has thanked: 195 times
Been thanked: 51 times

Re: Some questions about SSDs & fstrim

Post by gychang »

bigpup wrote: Tue Apr 26, 2022 6:02 am

What is FP64?

fossapup64.

======

Puppy Bytes, utube videos
https://www.youtube.com/channel/UCg-DUU ... u62_iqR-MA

======

User avatar
bigpup
Moderator
Posts: 6516
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 790 times
Been thanked: 1353 times

Re: Some questions about SSDs & fstrim

Post by bigpup »

In a terminal (console) use command:

Code: Select all

fstrim -help

If you get the help info, it has fstrim.

I use this in Fossapup64 9.5
viewtopic.php?t=4907

That Woof-CE change is not in Fossapup64.
So you will have to use the command fstrim or the trim program I gave a link for.

Forum Global Moderator
The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

Post Reply

Return to “Users”