Jump to content


Photo

SSD TRIM


  • Please log in to reply
22 replies to this topic

#1 Dimitrij

  • PLi® Core member
  • 10,020 posts

+338
Excellent

Posted 22 April 2016 - 08:01

Information

 

Install enigma2-plugin-systemplugins-mountmanager (available with feed)

Menu/Setup/System/Mount manager

Open plugin /press menu/ select your SSD/press green 'TRIM'

select option:

Set discard mount option

Unset discard mount option

Show discard status

 

filesystem need ext4


Edited by Dimitrij, 22 April 2016 - 08:01.

GigaBlue UHD Quad 4K /Lunix3-4K/Solo 4K


Re: SSD TRIM #2 christophecvr

  • Senior Member
  • 3,131 posts

+140
Excellent

Posted 22 April 2016 - 08:22

p.s.  I do not know for an stb , but it is not adviced on linux to use the discard option in mount anymore by recent ssd's.

 

Do this :

 

1) daily  (whit a cronjob) or at boottime (but since linux pc's and devices are rarely booted it's best with cronjob).



Re: SSD TRIM #3 christophecvr

  • Senior Member
  • 3,131 posts

+140
Excellent

Posted 22 April 2016 - 08:29

By my pc's (ubuntu 14.04) i just use now in fstab

UUID=f71bdde8-d4e4-44d0-b977-a46535f8631c /               ext4    noatime,nodiratime,errors=remount-ro 0       1

for stb the UUID is off course the /dev/xxx (the aktif partition)

 

To trim is done once a day nightly.



Re: SSD TRIM #4 MiLo

  • PLi® Core member
  • 14,045 posts

+298
Excellent

Posted 22 April 2016 - 08:50

For STB the simplest thing to do is completely ignore trim. The box doesn't require 500MB/s write transfers.
Real musicians never die - they just decompose

Re: SSD TRIM #5 christophecvr

  • Senior Member
  • 3,131 posts

+140
Excellent

Posted 22 April 2016 - 09:07

For STB the simplest thing to do is completely ignore trim. The box doesn't require 500MB/s write transfers.

Yes the speed we do not really need but :

 

Whithout the trim we will have after time serious fragmentation off ssd  this will reduce lifetime off not directly a cheap hdd (usually I higher cost then stb self)

 

The fstrim  command is installed to stb standard  located in /sbin

 

If You do a daily trim by cronjob (cause most users do not shutdown and reboot each day the stb) Trimming only takes a couple off seconds.

 

So to have a ssd long life and working optimum there is not much to do anymore on modern linux kernels.

 

1) In despit the fact that modern ssd's have an extra build mem in for or say reserved space for overprovisioning its best to keep at the en 7% up to max 10 GB unallocated space.

2) mount options noatime into fstab (or by hotplug to be set during mount)

3) use off fstrim once in 24 hours.

 

More is not needed.

 

note : never defragment an ssd which is done typical in windows , that's the best way to make you're ssd very fast end off life.


Edited by christophecvr, 22 April 2016 - 09:08.


Re: SSD TRIM #6 MiLo

  • PLi® Core member
  • 14,045 posts

+298
Excellent

Posted 22 April 2016 - 12:01

Fragmentation is not an issue in the box, it tend to manage huge files, and if formatted by OpenPLi, will use 256k clusters anyway which is about the erase size of most devices. Besides that, lifetime expectation is not affected by the trim commands.
Real musicians never die - they just decompose

Re: SSD TRIM #7 christophecvr

  • Senior Member
  • 3,131 posts

+140
Excellent

Posted 22 April 2016 - 12:20

Fragmentation is not an issue in the box, it tend to manage huge files, and if formatted by OpenPLi, will use 256k clusters anyway which is about the erase size of most devices. Besides that, lifetime expectation is not affected by the trim commands.

woow that are small clusters on ubuntu pc for ssd it's by default 4096k

 

But trough with big files not so many problems .

 

I do not have an ssd (in my stb) but if I would invest an ssd in my stb I would well do trim and noatime it's to expensive to take any risk.


Edited by christophecvr, 22 April 2016 - 12:20.


Re: SSD TRIM #8 Rob van der Does

  • Senior Member
  • 7,766 posts

+184
Excellent

Posted 22 April 2016 - 13:08

Fragmentation is not an issue in the box, it tend to manage huge files, and if formatted by OpenPLi, will use 256k clusters anyway which is about the erase size of most devices. Besides that, lifetime expectation is not affected by the trim commands.

And alignment will be fine for SSD then? If not it results in excessive writing/wear.



Re: SSD TRIM #9 MiLo

  • PLi® Core member
  • 14,045 posts

+298
Excellent

Posted 22 April 2016 - 13:14

Fragmentation is not an issue in the box, it tend to manage huge files, and if formatted by OpenPLi, will use 256k clusters anyway which is about the erase size of most devices. Besides that, lifetime expectation is not affected by the trim commands.

woow that are small clusters on ubuntu pc for ssd it's by default 4096k


Without the "k". Default is 4k which is 4096 bytes.
Real musicians never die - they just decompose

Re: SSD TRIM #10 MiLo

  • PLi® Core member
  • 14,045 posts

+298
Excellent

Posted 22 April 2016 - 13:23

Fragmentation is not an issue in the box, it tend to manage huge files, and if formatted by OpenPLi, will use 256k clusters anyway which is about the erase size of most devices. Besides that, lifetime expectation is not affected by the trim commands.

And alignment will be fine for SSD then? If not it results in excessive writing/wear.


Partitions are 1M (that's 4 clusters) aligned by default (if the disk is larger than some minimum size that most USB sticks will exceed).

Even if the clusters were tiny and misaligned, it would not cause problems in the box because it (in general) handles huge files. The OS will write the file(s) in multimegabyte sized chunks, so the disk will never have to read-write-modify any sector, that would only happen near the end of the file.
Real musicians never die - they just decompose

Re: SSD TRIM #11 Rob van der Does

  • Senior Member
  • 7,766 posts

+184
Excellent

Posted 22 April 2016 - 13:30

True; usage in an STB is quite different from using the drive in a PC. I keep forgetting that we (almost) only talk about large files.



Re: SSD TRIM #12 christophecvr

  • Senior Member
  • 3,131 posts

+140
Excellent

Posted 22 April 2016 - 13:48

 

 

Fragmentation is not an issue in the box, it tend to manage huge files, and if formatted by OpenPLi, will use 256k clusters anyway which is about the erase size of most devices. Besides that, lifetime expectation is not affected by the trim commands.

woow that are small clusters on ubuntu pc for ssd it's by default 4096k

 


Without the "k". Default is 4k which is 4096 bytes.

 

Yes whitout the k :P

 

But anyway indeed the missing trim will not reduce life time but in time the disk will become slower. Trough is that cause bassically speaking we only use it for recording in pli4 and that's always big data. It's less important.

But still I would do a trim about once a week actually once a day is better it's hardly a second if done so. Since all basic stuff for cron job is on board by default except the job self (cron tab) and the not basic loaded crond at boottime (that's can be solved).

just using a crontab :

* 5 * * * /sbin/fstrim

will do  . means daily at 05:00 hr.



Re: SSD TRIM #13 christophecvr

  • Senior Member
  • 3,131 posts

+140
Excellent

Posted 22 April 2016 - 13:52

and  by mounting off the ssd noatime option must be used. (that is very important for life time a bit less due to the fact that we are using big files but that's much more crucial then the trim)



Re: SSD TRIM #14 christophecvr

  • Senior Member
  • 3,131 posts

+140
Excellent

Posted 22 April 2016 - 14:33

To resume this whole toppic.

 

Do not use discard !!! option (that was only for very old ssd drives) and is nowadays an absolute not option.

 

The only real and very important extra parameter even crucial for life time is the noatime option when mounting.

 

Then adviced:

 

Use fstrim once in 24 hours however it's a minor fact by a stb (see MiLo's explanations why it's minor)

  If I have a ssd in my stb it would do it.

 

Then there is one extra issue:

 

That's about formating.

 

If You have a high quality off ssd no problem. But : today they come out with cheaper versions and obviousely manufacturers will not keep enough reserved space by default for overprovisioning. But they will keep some.

 

The high quality will be ok, but the low quality they will not block enough space for that , then its not a bad idea to keep 7 % up to max 10 GB of space unallocated at the end off the ssd. (lifetime issue) not enough overprovisioning will leed to increased read/write operation.


Edited by christophecvr, 22 April 2016 - 14:34.


Re: SSD TRIM #15 MiLo

  • PLi® Core member
  • 14,045 posts

+298
Excellent

Posted 22 April 2016 - 18:42

and  by mounting off the ssd noatime option must be used. (that is very important for life time a bit less due to the fact that we are using big files but that's much more crucial then the trim)


The default mount option is "relatime" which only updates the access time after the modification time changes. This already avoids the problems that the old atime system caused, while still providing consistent information for backup tools.\
Real musicians never die - they just decompose

Re: SSD TRIM #16 christophecvr

  • Senior Member
  • 3,131 posts

+140
Excellent

Posted 22 April 2016 - 19:30

 

and  by mounting off the ssd noatime option must be used. (that is very important for life time a bit less due to the fact that we are using big files but that's much more crucial then the trim)


The default mount option is "relatime" which only updates the access time after the modification time changes. This already avoids the problems that the old atime system caused, while still providing consistent information for backup tools.\

 

Yes but really all expert topics about ssd do really stress ver very hard upon the noatime (even the relatime is to much and not required on ssd) .

 

But for shure that only for ssd and not a default hdd option.

 

I think that only if really can be determined if a hdd is a ssd drive whitout 0 % error margin that can be automated trough hdd***py . but else ... Think user best set a fstab rule into his stb if he's using a ssd hdd. gues it will be partition /dev/sda1 .


Edited by christophecvr, 22 April 2016 - 19:30.


Re: SSD TRIM #17 MiLo

  • PLi® Core member
  • 14,045 posts

+298
Excellent

Posted 22 April 2016 - 19:58

Actually, I think 'noatime' should be default behavior for the box. After all, this is an embedded system and isn't likely to be running file-based mail software from the 1980s.

AFAIK the only way to accomplish this is to patch the kernel (it's not even a config), which means messing around with all the BSPs.

Next best thing would be to just put this in the mdev-mount script, which mounts about everything on most user's systems.

Other suggestions (that don't require writing custom fstab files) are welcome...

I'd gladly accept a tested patch that does so :)
Real musicians never die - they just decompose

Re: SSD TRIM #18 christophecvr

  • Senior Member
  • 3,131 posts

+140
Excellent

Posted 22 April 2016 - 21:57

THIS IS JUST BRAIN STORM :

 

Well I do not have a ssd drive and ok I do have a internal hdd(platern) on my dm8000 , but not on my duo2.

 

As far I can I develop on dm8000 and crosscheck with duo2 if nothings is broken into modern boxes. (this I only can do so long the actual kernel of the dm8000 is capable off following the gcc libc and g++ evolution which it does till now)

 

In general : then I do speak about linux ubuntu.

Now ubuntu 14.04.

A hdd platern main boot disk is mounted with : (by default up on install) platern

errors=remount-ro

any other hdd is mounted with

defaults

when You have a ssd  user must change the defaults off ssd into : (read so what all linux manuals ubuntu,debian,slackware and ...)

 

for boot drive :

noatime,errors=remount-ro 0 

for other ssd drive

noatime

for platerns

defaults

question is what are the defaults

 

gues that's another philosophy and strongly depended on which mount binary is used. the fact that on a stb we are using busy-box it may become a very space defaults :P

 

when a googled a bit around looks that noatime is not the best for a platern drive but a must for ssd.

Sorry guys on this point it's a bit off a jungle if you're self are not a real expert in the mather.

 

But :

 

@Dimitij

 

can you find a way on you're stb to check if you're drive is platern or ssd , if so this could be used just like @MiLo told into for example the mdev-mount script that's pretty easy.

 

Then if it's a ssd drive always it will be mounted with noatime . the rest of devices with relatime.

 

For the trim ??? well we could just make a optional e2-plugin-extention which up on install will just excecute the trimfs every day .

 

Then if I user decides to start with a real unformated new drive straight into stb. Perhaps make a formating option which uses only all space - the last 7 % limited to  max 10 GB to have the last part unallocated


Edited by christophecvr, 22 April 2016 - 21:58.


Re: SSD TRIM #19 Dimitrij

  • PLi® Core member
  • 10,020 posts

+338
Excellent

Posted 23 April 2016 - 16:35


@Dimitij

 

can you find a way on you're stb to check if you're drive is platern or ssd , if so this could be used just like @MiLo told into for example the mdev-mount script that's pretty easy.

 

Then if it's a ssd drive always it will be mounted with noatime . the rest of devices with relatime.

 

For the trim ??? well we could just make a optional e2-plugin-extention which up on install will just excecute the trimfs every day .

 

Then if I user decides to start with a real unformated new drive straight into stb. Perhaps make a formating option which uses only all space - the last 7 % limited to  max 10 GB to have the last part unallocated

Then if it's a ssd drive always it will be mounted with noatime .
I do not know where it is added.
Standard mount command:
mount - t auto device folder
dev/sdc1 on /media/sdc1 type ext4 (rw,relatime,data=ordered)
Where does the option relatime?

Edited by Dimitrij, 23 April 2016 - 16:35.

GigaBlue UHD Quad 4K /Lunix3-4K/Solo 4K


Re: SSD TRIM #20 blzr

  • PLi® Core member
  • 2,269 posts

+118
Excellent

Posted 23 April 2016 - 21:09

default mount option is defined in kernel (as @MiLo already wrote)

../fs/namespace.c

    /* Default to relatime unless overriden */
    if (!(flags & MS_NOATIME))
        mnt_flags |= MNT_RELATIME;

True sarcasm doesn't need green font...


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users