Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #188661

Re: how to enable trim for an external encrypted SSD?

From Michael Stone <mstone@debian.org>
Newsgroups linux.debian.user
Subject Re: how to enable trim for an external encrypted SSD?
Date 2017-11-06 23:10 +0100
Message-ID <uIXKF-QL-1@gated-at.bofh.it> (permalink)
References <uIOo1-2L5-5@gated-at.bofh.it> <uIPDr-3uR-9@gated-at.bofh.it> <uIVSx-7Uo-9@gated-at.bofh.it> <uIWvf-8hn-3@gated-at.bofh.it> <uIX7Y-kW-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Nov 07, 2017 at 02:20:56AM +0500, Alexander V. Makartsev wrote:
>As I know SSDs are different in a way HDDs write their data. HDDs write
>directly to the free block and are done. SSDs on the other hand will have to
>erase free block first to get it ready for writing and then write to it. This
>is because how NAND work. It's even worse, if a destination block has some data
>on it already and there is some data needs to be written onto it, then SSD will
>copy data already written, then it will fully erase destination block, then it
>will concatenate copied data with data to be written and finally will write
>merged data to the block.

This is mostly correct. The erasing is done in "erase block" size units 
(much larger than disk blocks), while writing is done in "pages", 
usually with hundreds of pages per erase block. So a 4kbyte write might 
trigger a multi-megabyte erase if there aren't erased pages available 
for writing. If an erase block has been partially written, a write can 
go to an unwritten page without any additional steps. In practice, 
most drive writes go immediately to already-erased blocks, with the garbage 
collector erasing blocks while the drive is idle (rather than actually 
reading, erasing, and writing for every write). The drive then keeps 
track of which physical address is associated with which logical 
address--that relationship changes as blocks are written and rewritten, 
and it is not the case that the data on the drive is physically ordered 
the same way it appears logically.

>TRIM will erase blocks marked as deleted beforehand even if they are not needed
>for writing right now. This overhead is the reason that causes increased drive
>wear and decrease it's lifespan.

No, TRIM does not cause extra erases that wear out a drive. If you don't 
TRIM blocks and mark them as unused, the garbage collector will still 
erase blocks it doesn't need yet in order to have pages available for 
future writes. (Either after the garbage collector decides to launch a 
read & rewrite cycle to consolidate free space, or when all the pages
in the erase block have been rewritten to a new erase block and the old 
erase block is known to be empty) The only differences introduced by 
using TRIM is that the drive can skip the possible read & rewrite step, 
and the drive can increase the free pool so more new pages can be 
written before a garbage collection is forced.

Mike Stone

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

how to enable trim for an external encrypted SSD? Joerg Desch <news@jdesch.de> - 2017-11-06 13:10 +0100
  Re: how to enable trim for an external encrypted SSD? Christian Seiler <christian@iwakd.de> - 2017-11-06 14:30 +0100
    Re: how to enable trim for an external encrypted SSD? "Alexander V. Makartsev" <avbetev@gmail.com> - 2017-11-06 21:10 +0100
      Re: how to enable trim for an external encrypted SSD? Michael Stone <mstone@debian.org> - 2017-11-06 21:50 +0100
        Re: how to enable trim for an external encrypted SSD? "Alexander V. Makartsev" <avbetev@gmail.com> - 2017-11-06 22:30 +0100
          Re: how to enable trim for an external encrypted SSD? Michael Stone <mstone@debian.org> - 2017-11-06 23:10 +0100
            Re: how to enable trim for an external encrypted SSD? "Alexander V. Makartsev" <avbetev@gmail.com> - 2017-11-07 00:20 +0100
              Re: ow to enable trim for an external encrypted SSD? dekkzz78@gmail.com - 2017-11-07 13:40 +0100
          Re: how to enable trim for an external encrypted SSD? Henrique de Moraes Holschuh <hmh@debian.org> - 2017-11-07 02:10 +0100
      Re: how to enable trim for an external encrypted SSD? Joerg Desch <news@jdesch.de> - 2017-11-07 08:20 +0100
    Re: how to enable trim for an external encrypted SSD? Joerg Desch <news@jdesch.de> - 2017-11-07 08:10 +0100
    Re: how to enable trim for an external encrypted SSD? Joerg Desch <news@jdesch.de> - 2017-11-11 14:10 +0100
      Re: how to enable trim for an external encrypted SSD? Christian Seiler <christian@iwakd.de> - 2017-11-11 14:20 +0100
        Re: how to enable trim for an external encrypted SSD? Joerg Desch <news@jdesch.de> - 2017-11-11 14:40 +0100
          Re: how to enable trim for an external encrypted SSD? Christian Seiler <christian@iwakd.de> - 2017-11-11 15:30 +0100
            Re: how to enable trim for an external encrypted SSD? Joerg Desch <news@jdesch.de> - 2017-11-11 16:50 +0100
              Re: how to enable trim for an external encrypted SSD? Stefan Monnier <monnier@iro.umontreal.ca> - 2017-11-16 04:10 +0100
                Re: how to enable trim for an external encrypted SSD? Joerg Desch <news@jdesch.de> - 2017-11-21 18:40 +0100
    Re: how to enable trim for an external encrypted SSD? Christian Seiler <christian@iwakd.de> - 2017-12-18 13:20 +0100

csiph-web