Wiki source for FlashMemory
{{include tonguesStorage}}
[[HomePage]] > [[ComponentHowTo Components and HowTos]] > [[Storage Memory and Storage]]
{{image url="http://www.murga-linux.com/puppy/viewtopic.php?mode=attach&id=57682" title="filetype icon" alt="filetype icon"}}
==== Flash Memory ====
https://bkhome.org/news/202404/qv-strategies-to-reduce-ssd-writes.html:
"EasyOS and the pups are able to run in RAM, saving to the storage media only when you want to. That is very good for Flash media. QV does not have a aufs or overlay layered filesystem, so writes are direct to the storage media.
Back in the Quirky Linux days, I implemented strategies to minimize writes to Flash media. In those days, was using ext4, so did things like disable the journal. QV though, is using btrfs, which from a bit of reading does seem pretty good running on Flash.
When a btrfs partition is mounted, it auto-detects if it is Flash, and makes certain decisions. What those decisions are, I don't know. Anyway, here are actions that I have taken:
Set the "noatime" option
An operation that trawls through files, such as grep, will set the access-time on files. That is a write operation, so have disabled it. Apparently, mounting with noatime is particularly important with how btrfs works.
Set "commit" to high value
The default commit value for btrfs is 30 seconds, which is how often RAM file buffers are flushed to the storage media. I have changed it, if there is more RAM than 3GB then set commit to 240; that's 4 minutes. I presume that a "sync" operation, such as running 'sync' utility, will flush immediately -- at least I hope so.
zstd compression
I am mounting with zstd, compression-level 3. This actually makes reading and writing faster, due to smaller files. Another benefit is less bytes written to the Flash media.
Caches in /tmp
/tmp is a tmpfs, and I have setup all cache folders that I can find as symlinks inside /tmp. This includes /var/cache, /root/.cache and /home/*/.cache. /run is a symlink inside /tmp
These strategies will greatly reduce writes to the Flash media, but not entirely, so it is recommended to use a reasonable quality drive. Most SSDs should be OK. Bargain-bin USB Flash sticks, well, I don't know how long they will last -- they are really only intended for occasional writes, like keeping ones collection of photos.
On past occassions, I have recommended SanDisk Ultra and Extreme USB Flash drives. However, have discovered something disturbing; a couple of Ultra model that I bought in the last year, from a reputable local retailer, have considerably slower write speed than those I purchased a few years ago. In EasyDD, I am getting about half the speed of the older ones, just over 7MB/sec.
I really do need to buy another Ultra drive, from a different local retailer. Also need to buy another Extreme model, see if that has also degraded. Extreme model is the best, if you can afford it; they have an SSD type of controller chip and very fast read/write -- presume they still do.
A quality Flash drive will also have spare storage locations, that are substituted when parts of the memory start to fail. The controller chip handles this automatically. A very cheap Flash stick may have little or none of this spare storage. Also, I'm not sure, but if you partition an SSD to use less than it's rated capacity, the left-over memory will then become spare capacity -- read that somewhere. But maybe very cheap Flash sticks don't have that kind of clever management."
----
==Categories==
CategoryStorage
[[HomePage]] > [[ComponentHowTo Components and HowTos]] > [[Storage Memory and Storage]]
{{image url="http://www.murga-linux.com/puppy/viewtopic.php?mode=attach&id=57682" title="filetype icon" alt="filetype icon"}}
==== Flash Memory ====
https://bkhome.org/news/202404/qv-strategies-to-reduce-ssd-writes.html:
"EasyOS and the pups are able to run in RAM, saving to the storage media only when you want to. That is very good for Flash media. QV does not have a aufs or overlay layered filesystem, so writes are direct to the storage media.
Back in the Quirky Linux days, I implemented strategies to minimize writes to Flash media. In those days, was using ext4, so did things like disable the journal. QV though, is using btrfs, which from a bit of reading does seem pretty good running on Flash.
When a btrfs partition is mounted, it auto-detects if it is Flash, and makes certain decisions. What those decisions are, I don't know. Anyway, here are actions that I have taken:
Set the "noatime" option
An operation that trawls through files, such as grep, will set the access-time on files. That is a write operation, so have disabled it. Apparently, mounting with noatime is particularly important with how btrfs works.
Set "commit" to high value
The default commit value for btrfs is 30 seconds, which is how often RAM file buffers are flushed to the storage media. I have changed it, if there is more RAM than 3GB then set commit to 240; that's 4 minutes. I presume that a "sync" operation, such as running 'sync' utility, will flush immediately -- at least I hope so.
zstd compression
I am mounting with zstd, compression-level 3. This actually makes reading and writing faster, due to smaller files. Another benefit is less bytes written to the Flash media.
Caches in /tmp
/tmp is a tmpfs, and I have setup all cache folders that I can find as symlinks inside /tmp. This includes /var/cache, /root/.cache and /home/*/.cache. /run is a symlink inside /tmp
These strategies will greatly reduce writes to the Flash media, but not entirely, so it is recommended to use a reasonable quality drive. Most SSDs should be OK. Bargain-bin USB Flash sticks, well, I don't know how long they will last -- they are really only intended for occasional writes, like keeping ones collection of photos.
On past occassions, I have recommended SanDisk Ultra and Extreme USB Flash drives. However, have discovered something disturbing; a couple of Ultra model that I bought in the last year, from a reputable local retailer, have considerably slower write speed than those I purchased a few years ago. In EasyDD, I am getting about half the speed of the older ones, just over 7MB/sec.
I really do need to buy another Ultra drive, from a different local retailer. Also need to buy another Extreme model, see if that has also degraded. Extreme model is the best, if you can afford it; they have an SSD type of controller chip and very fast read/write -- presume they still do.
A quality Flash drive will also have spare storage locations, that are substituted when parts of the memory start to fail. The controller chip handles this automatically. A very cheap Flash stick may have little or none of this spare storage. Also, I'm not sure, but if you partition an SSD to use less than it's rated capacity, the left-over memory will then become spare capacity -- read that somewhere. But maybe very cheap Flash sticks don't have that kind of clever management."
----
==Categories==
CategoryStorage