Optimizing Linux with cheap flash drives (2011)
lwn.net
lwn.net
And you can set the noop scheduler using echo noop > /sys/block/<device e.g. sda>/queue/scheduler. Whether that's the best option for you depends, but if you have an SSD it might be.
Finally if you're using full disk software encryption, do check if your SSD supports hardware-level encryption instead and if your BIOS allows you to set its key.
I guess the controller needs some temporary space to do its magic and below that point it will struggle.
The odd fact is that freeing space didn't allow for normal behavior until "forcing" an actual trim.
I even started somewhat relying on atime being the (otherwise non-existant at the time) "inode creation time" when using 'noatime', and was a bit upset when I realized that mounts created with "mount --bind" would lose the noatime setting (an explicit "mount -o remount,noatime" is required on the new mount point).
I also used Samba around 2002, but am not sure whether I used noatime already with it.
IMO a file's last access time is inherently unreliable anyway, a file could have been read by a backup process or file indexer at any time. Your file browser might well peek at every file in a folder to make thumbnails or determine file types.
You likely won't see any problems with Samba or with office documents, these all work fine with filesystems that don't have last access times at all (and Windows disabled last access times in Vista onwards, apparently)
At the time, all but the worst 'real' (for want of a better word) SSD hard drives had enough local RAM and firmware smarts to do proper I/O ordering, buffering and manipulation. This effectively hides all the complexities of the flash storage, allowing any OS to work well.
The cheap USB sticks and their ilk couldn't do this because of their lack of RAM, decent firmware and all associated money-saving build choices. But as the hardware gets cheaper, I wonder if this is still true? Do USB sticks and SD cards nowadays have more RAM & better firmware?
Phison's new S11 controller is also a DRAM-less design that will be used in low-end internal SATA SSDs.
My RPI have a somewhat expensive Sandisk Ultra 32GB microSD card, however even them it was still slow to respond on random I/O (like installing a new package in it). I decided to use F2FS instead of ext4, however it didn't do much better: for some reason, the RPI kernel disable the majority of performance enhancements from F2FS by default. You can re-enable them in /etc/fstab, however after a unclear poweroff my filesystem was completely messed up. RPI wouldn't even boot. This is unacceptable.
So I decided to go back to ext4, however try to optimize for flash media. This article put me in the correct way, basically thanks to this part:
> When a filesystem wants to optimize its block allocation to the geometry of a flash drive, it needs to know the position of the segments on the drive. On partitioned media, this also implies that each partition is aligned to the start of a segment, and this is true for all preformatted SD cards and other media that require special care for segment optimizations.
Searching Google for "aligned partition Raspberry Pi" and I found those articles below that really helped to optimize my SD card performance:
* https://thelastmaimou.wordpress.com/2013/05/19/optimizing-ar...
* https://blogofterje.wordpress.com/2012/01/14/optimizing-fs-o...
After aligning my partition, the RPI seems faster and much more similar behavior to a traditional HDD (however, not so fast as a SSD, of course). However, I didn't disable ext4's journal, though, since I want to reduce the chance of getting my filesystem in a unbootable state.
Excuse me, I was dreaming. Sometimes I have the most absurd dreams. Hello reality, good to be back.
The SD cards I use in my RPi are always mounted read-only. Not sure why I do that. Stupid I guess.