Overclock.net banner

SSD optimizations in Linux

1172 Views 7 Replies 5 Participants Last post by  enorbet2
There are some recommended optimizations in Linux for save writes on the SSD and extend the lifespan?

I tried to move /home , /tmp, var/tmp, var/log and SWAP to a mechanical drive. However the performance hit was really significant and I just reinstalled the entire OS with all the system mounting points on an SSD. I am using the ext4 filesystem, I guess it makes less writes than the newer BTRFS.

I am curious about manual optimizations for SSD to do like in Windows (disable disk indexing, disable superfetch, disable hibernation and verify that TRIM is on) and how to do them in Linux.
1 - 8 of 8 Posts

· Overclocking Enthusiast
Joined
·
7,047 Posts
Most ssds will out live their capacity. So don't be too worried about writes. Unless you are using a qlc based SSD that has low endurance. That being said. I believe you can move your swap to ram.
 

· Registered
Joined
·
87 Posts
Discussion Starter · #3 · (Edited)
I am using mostly mid range TLC models with 3D Nand. Expected lifespan by the manufacturer for the drives I am using is between 80 and 180 TBW depending on the drive. I think swap, hibernate and some temporal files can do very significant writes (hibernate directly copies the entire RAM to the drive). Mount swap directly to the RAM sounds interesting but it defeats one of the purposes of swap (to prevent a system crash when the RAM is full).
 

· Registered
Joined
·
4,352 Posts
There are some recommended optimizations in Linux for save writes on the SSD and extend the lifespan?
File system will have some effect, but I wouldn't worry too much.

I normally just leave stuff alone, but if I know I'll be writing endless logs, I'll move them to RAM (care, lost on reboot/crash) or if truly desperate a mechanical disk.

There are various flags you can set to reduce metadata writes such as noatime, nodiratime etc... but I once caught someone doing something they shouldn't at a previous job by checking access time of files, so don't like turning it off.

F2FS (flash friendly file system) might be worth looking at if you're really worried.

I usually run ext4, but I've recently been investigating ZFS, which, if you've got enough RAM, is great.

I've never had an SSD die from exceeding writes, even QLC (and I've got some QLC drives at work which get hammered...)

I believe you can move your swap to ram.
Rather defeats the point in having swap... ;)
 

· Registered
Joined
·
87 Posts
Discussion Starter · #6 ·
How much system ram do you have? If you have enough ram where the operating system is happy, you dont have to worry much about ssd life. Most of the folks who make the more modern linux distro's are doing a good job of maintaining ssd life span potential.
It is the second PC on my signature. Currently it have a kit of 8 GB but I am replacing it soon with a better speed and latencies 16 GB kit (I opened another thread for that). I set a 17-18 GB swap partition.

File system will have some effect, but I wouldn't worry too much.

I normally just leave stuff alone, but if I know I'll be writing endless logs, I'll move them to RAM (care, lost on reboot/crash) or if truly desperate a mechanical disk.

There are various flags you can set to reduce metadata writes such as noatime, nodiratime etc... but I once caught someone doing something they shouldn't at a previous job by checking access time of files, so don't like turning it off.

F2FS (flash friendly file system) might be worth looking at if you're really worried.

I usually run ext4, but I've recently been investigating ZFS, which, if you've got enough RAM, is great.

I've never had an SSD die from exceeding writes, even QLC (and I've got some QLC drives at work which get hammered...)


Rather defeats the point in having swap... ;)
Thanks I will look on other filesystems like the ones you mentioned if I need to do a fresh install again. I am a bit biased towards ext4 because I have been using it for a lot of time and despite system crashes or energy shutdowns years ago never lost personal data in ext4 partitions.
 

· Registered
Joined
·
4,352 Posts
Thanks I will look on other filesystems like the ones you mentioned if I need to do a fresh install again. I am a bit biased towards ext4 because I have been using it for a lot of time and despite system crashes or energy shutdowns years ago never lost personal data in ext4 partitions.
For the record, I usually run ext4 on root, and while I previously ran ext4 on everything else as well, I am shifting toward using ZFS on my SSD RAID and HDD RAID arrays, simply because it's easier (ZFS is super easy to set up and manage, don't even need to format the disks, (software) RAID arrays can be assembled and managed super quickly as well).

But like it said, ZFS needs RAM. The usual guideline is 1GB per 1TB storage, although that becomes less important as you start to exceed 50TB or so. The default settings for ZFS in Ubuntu based distros (which you'll probably want to use for simplicity, as Ubuntu put a lot of effort into making ZFS-on-Linux easier) will end up caching around 50% of your RAM, although it will free that up if you do something which really eats up memory.

That said, so far the only systems I'm running ZFS on have 256GB+ of RAM.
 

· 10 year OCN Vet
Joined
·
3,445 Posts
Hello BuranC. It's my understanding that decent quality modern SSDs no longer require Trim and all the other protective applications anymore. The only caveat is don't let them get too close to full. As long as they have room to move stuff around they will outlast most mechanical drives.

I have a couple Samsung EVO M.2 drives that are great and I installed NVMECLI to keep special track of them. It became boring they run so well. I did lear a pretty cool trick for maintaining speed though. You can add this kernel option to just about any bootloader

Code:
 nvme_core.default_ps_max_latency_us=0"
Enjoy
 
1 - 8 of 8 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top