Optimize SSD's for Longer Lifespan
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Optimize SSD's for Longer Lifespan
Step 0:
sudo apt install util-linux
Most distros has this package installed OOTB so you can skip this step.
Step 1:
sudo systemctl enable fstrim.timer
sudo systemctl start fstrim.timer
Configured OOTB in Linux Mint so you can skip this step.
Step 2:
xed admin:///etc/fstab
Add noatime mount option.
Noatime mount option fully disables writing file access times to SSD every time you read a file, this reduces the writes to SSD therefore greatly increasing lifespan of SSD’s.
Add noatime mount option to all partitions except swap partition.
Step 3:
xed admin:///etc/sysctl.conf
Add vm.swappiness=10
So writing to swapfile/swap partition only occurs after RAM is filled 90% instead of default 60%. Good if you do lot of web browsing, video editing and gaming and do not want contents of RAM frequently written to swapfile/swap partition on SSD after RAM is filled only 60%.
Step 4:
Enable write cache from Gnome Disks.
sudo apt install util-linux
Most distros has this package installed OOTB so you can skip this step.
Step 1:
sudo systemctl enable fstrim.timer
sudo systemctl start fstrim.timer
Configured OOTB in Linux Mint so you can skip this step.
Step 2:
xed admin:///etc/fstab
Add noatime mount option.
Noatime mount option fully disables writing file access times to SSD every time you read a file, this reduces the writes to SSD therefore greatly increasing lifespan of SSD’s.
Add noatime mount option to all partitions except swap partition.
Step 3:
xed admin:///etc/sysctl.conf
Add vm.swappiness=10
So writing to swapfile/swap partition only occurs after RAM is filled 90% instead of default 60%. Good if you do lot of web browsing, video editing and gaming and do not want contents of RAM frequently written to swapfile/swap partition on SSD after RAM is filled only 60%.
Step 4:
Enable write cache from Gnome Disks.
Re: Optimize SSD's for Longer Lifespan
That's a great exaggeration. Linux Mint by default uses relatime, which only updates access time if the file is being modified (and thus the file information block would be rewritten anyway) or the previous access time is older than 1 day.dark wrote: ⤴Thu Nov 08, 2018 7:21 am Step 2:
sudo xed /etc/fstab
Add noatime mount option.
Noatime mount option fully disables writing file access times to SSD every time you read a file, this reduces the writes to SSD therefore greatly increasing lifespan of SSD’s.
Add noatime mount option to all partitions except swap partition.
Adding noatime leads to an insignificant difference in lifespan.
Re: Optimize SSD's for Longer Lifespan
I didn't know about Linux Mint using relatime by default.
- Pjotr
- Level 24
- Posts: 20129
- Joined: Mon Mar 07, 2011 10:18 am
- Location: The Netherlands (Holland) 🇳🇱
- Contact:
Re: Optimize SSD's for Longer Lifespan
Don't use
sudo xed
, but xed admin://
instead.Tip: 10 things to do after installing Linux Mint 21.3 Virginia
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Re: Optimize SSD's for Longer Lifespan
Good catch. I've updated it in OP's post.
Re: Optimize SSD's for Longer Lifespan
That parameter does not define a free RAM percentage (check the kernel sources, that parameter is used as part of a number of formulas, but none of them are about what you claim). If you decrease this value you'll probably see less caching and thus have a good chance of more disk activity, both depending on your use case.dark wrote: ⤴Thu Nov 08, 2018 7:21 am Add vm.swappiness=10
So writing to swapfile/swap partition only occurs after RAM is filled 90% instead of default 60%. Good if you do lot of web browsing, video editing and gaming and do not want contents of RAM frequently written to swapfile/swap partition on SSD after RAM is filled only 60%.
Write caching is enabled by default.
- Pjotr
- Level 24
- Posts: 20129
- Joined: Mon Mar 07, 2011 10:18 am
- Location: The Netherlands (Holland) 🇳🇱
- Contact:
Re: Optimize SSD's for Longer Lifespan
This is a good article in the wiki of Arch Linux (which is almost always a great resource), about the effects of swappiness reduction:gm10 wrote: ⤴Thu Nov 08, 2018 11:27 am That parameter does not define a free RAM percentage (check the kernel sources, that parameter is used as part of a number of formulas, but none of them are about what you claim). If you decrease this value you'll probably see less caching and thus have a good chance of more disk activity, both depending on your use case.
https://wiki.archlinux.org/index.php/Swap#Swappiness
The article it refers to is worth reading as well:
http://rudd-o.com/en/linux-and-free-sof ... o-fix-that
Tip: 10 things to do after installing Linux Mint 21.3 Virginia
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Re: Optimize SSD's for Longer Lifespan
He wrote 11 years ago, when the kernel's paging strategy was different:Pjotr wrote: ⤴Thu Nov 08, 2018 1:05 pm The article it refers to is worth reading as well:
http://rudd-o.com/en/linux-and-free-sof ... o-fix-that
Do try this with a present day kernel. He even provides a test script. I think you'll find it doesn't behave the way he experienced it back then, I know it doesn't on my laptop at least. That aside very nice article.On a desktop computer, you want swappiness to be as close to zero as possible. The reason you want to do this (even though it might hurt actual performance) is because this will immunize your computer to memory shortages caused by temporary big file manipulations (think copying a big video file to another disk).
Last edited by gm10 on Thu Nov 08, 2018 3:02 pm, edited 2 times in total.
- Pjotr
- Level 24
- Posts: 20129
- Joined: Mon Mar 07, 2011 10:18 am
- Location: The Netherlands (Holland) 🇳🇱
- Contact:
Re: Optimize SSD's for Longer Lifespan
Last modified five years ago, so that makes it less ancient....gm10 wrote: ⤴Thu Nov 08, 2018 2:13 pmHe wrote 11 years agoPjotr wrote: ⤴Thu Nov 08, 2018 1:05 pm The article it refers to is worth reading as well:
http://rudd-o.com/en/linux-and-free-sof ... o-fix-that
Can you perhaps give some links that elaborate on this change of the kernel's paging strategy?gm10 wrote: ⤴Thu Nov 08, 2018 2:13 pm, when the kernel's paging strategy was different:To try this with a present day kernel. He even provides a test script. I think you'll find it doesn't behave the way he experienced it back then, I know it doesn't on my laptop at least. That aside very nice article.Code: Select all
On a desktop computer, you want swappiness to be as close to zero as possible. The reason you want to do this (even though it might hurt actual performance) is because this will immunize your computer to memory shortages caused by temporary big file manipulations (think copying a big video file to another disk).
Tip: 10 things to do after installing Linux Mint 21.3 Virginia
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Re: Optimize SSD's for Longer Lifespan
...at least on my own laptop, i do find that the default value of 60 makes it crawl from time to time (also, article is last modified June 2013).
My question though would be different:
exactly what do people do in their 'desktop' to somehow need to achieve a longer SSD lifespan?
Pretty much every 'scientific' & reliable article i've read about SSDs refers to...numerous decades of lifespan -
unless of course it borks out of the blue one morning, which can happen with any digital device.
I can understand concerns for such if someone runs a database with thousands of writes per hour,
or maybe if someone has turned his/her machine to a dedicated 24/7 torrents' seedbox with tons of HD rips...
But for common installations?...
My question though would be different:
exactly what do people do in their 'desktop' to somehow need to achieve a longer SSD lifespan?
Pretty much every 'scientific' & reliable article i've read about SSDs refers to...numerous decades of lifespan -
unless of course it borks out of the blue one morning, which can happen with any digital device.
I can understand concerns for such if someone runs a database with thousands of writes per hour,
or maybe if someone has turned his/her machine to a dedicated 24/7 torrents' seedbox with tons of HD rips...
But for common installations?...
Re: Optimize SSD's for Longer Lifespan
I tried to google something but it's surprisingly hard to find something on the evolution of this. Here's 2 write-ups about changes done back in the 2.6 series:
https://www.kernel.org/doc/gorman/html/ ... html#toc27
https://linux-mm.org/PageReplacementDesign
Also ancient but still more recent than 11 years ago.
Re: Optimize SSD's for Longer Lifespan
...the swappiness value has been debated way too frequently in those forums here -
which is also something i don't really understand as to why it should somehow be controversial, especially since...
Edit: also from Red Hat...a simplified explanation of how swappiness gets calculated...
...all in all, i believe that SSDs are configured pretty reasonably out-of-the-box for 'desktops',
and as for swappiness, it you experience slow-downs with 60, just set it to something lower, yet without overdoing such...
which is also something i don't really understand as to why it should somehow be controversial, especially since...
Edit: also from Red Hat...a simplified explanation of how swappiness gets calculated...
...all in all, i believe that SSDs are configured pretty reasonably out-of-the-box for 'desktops',
and as for swappiness, it you experience slow-downs with 60, just set it to something lower, yet without overdoing such...
- Pjotr
- Level 24
- Posts: 20129
- Joined: Mon Mar 07, 2011 10:18 am
- Location: The Netherlands (Holland) 🇳🇱
- Contact:
Re: Optimize SSD's for Longer Lifespan
Excellent information! Thanks.thx-1138 wrote: ⤴Thu Nov 08, 2018 2:56 pm ...the swappiness value has been debated way too frequently in those forums here -
which is also something i don't really understand as to why it should somehow be controversial, especially since...
Edit: also from Red Hat...a simplified explanation of how swappiness gets calculated...
More elaborate than the Arch wiki, yet simplified enough to be understandable for me.
On my machines, I keep track of swap use by means of Conky:
https://sites.google.com/site/easylinux ... forxubuntu
I usually apply a swappiness of 10 for HDD's and 1 for SSD's. On one machine with an SSD and little RAM (2 GB) I even had to set swappiness to 0, in order to prevent frequent use of the swap....
Tip: 10 things to do after installing Linux Mint 21.3 Virginia
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Re: Optimize SSD's for Longer Lifespan
hey Hi @Pjotr.Pjotr wrote: ⤴Fri Nov 09, 2018 5:22 amExcellent information! Thanks.thx-1138 wrote: ⤴Thu Nov 08, 2018 2:56 pm ...the swappiness value has been debated way too frequently in those forums here -
which is also something i don't really understand as to why it should somehow be controversial, especially since...
Edit: also from Red Hat...a simplified explanation of how swappiness gets calculated...
More elaborate than the Arch wiki, yet simplified enough to be understandable for me.
On my machines, I keep track of swap use by means of Conky:
https://sites.google.com/site/easylinux ... forxubuntu
I usually apply a swappiness of 10 for HDD's and 1 for SSD's. On one machine with an SSD and little RAM (2 GB) I even had to set swappiness to 0, in order to prevent frequent use of the swap....
I noticed that on your older https://sites.google.com/site/easylinux ... forxubuntu I'm getting a 404 error nowadays. ?
Is this: https://easylinuxtipsproject.blogspot.com/p/1.html your new tutroial tipsntricks for LinuxMint?
Anyway, your older tips for LinuxMint on sites.google.com was a very handy site for me.
Just wanna say a big thanks for all that too, meaning, I hope you keep it up.
MATE 21.3 | Lenovo Legion 5 17ACH6
- Pjotr
- Level 24
- Posts: 20129
- Joined: Mon Mar 07, 2011 10:18 am
- Location: The Netherlands (Holland) 🇳🇱
- Contact:
Re: Optimize SSD's for Longer Lifespan
Yes.scjet45 wrote: ⤴Mon Mar 11, 2019 4:31 pm hey Hi @Pjotr.
I noticed that on your older https://sites.google.com/site/easylinux ... forxubuntu I'm getting a 404 error nowadays. ?
Is this: https://easylinuxtipsproject.blogspot.com your new tutorial tipsntricks for LinuxMint?
Everything has been moved to my new site, so no information has been lost.
Tip: 10 things to do after installing Linux Mint 21.3 Virginia
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
- Pjotr
- Level 24
- Posts: 20129
- Joined: Mon Mar 07, 2011 10:18 am
- Location: The Netherlands (Holland) 🇳🇱
- Contact:
Re: Optimize SSD's for Longer Lifespan
In your case, only add
noatime
to the root partition:
Code: Select all
/dev/mapper/mint--vg-root / ext4 noatime,errors=remount-ro 0 1
Tip: 10 things to do after installing Linux Mint 21.3 Virginia
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Re: Optimize SSD's for Longer Lifespan
Increase your RAM size to 8 or 16 GB and you'll need swap only as cheap extend of real RAM for the rare case that existent RAM needs to be extend a bit.
Current SSDs have in default less live time than the best existent server drives. They run with guarantee more than 5 years 24h 7d/week. Ony 3 or more years old SSD may have noteable livetime when they get constantly switching power on/off. Never by writing to it.
Current SSDs have in default less live time than the best existent server drives. They run with guarantee more than 5 years 24h 7d/week. Ony 3 or more years old SSD may have noteable livetime when they get constantly switching power on/off. Never by writing to it.
Re: Optimize SSD's for Longer Lifespan
The net result on Mint 19.1 with Ext4 with the 2 operations below, have resulted in ~70% reduction in browser writes to my SSD. From about 4.3GB/day to 1GB/day
Profile-sync-daemon and cache to RAM are the 2 simple changes.
The outline I've created here is a guide for people with some skills and not perfect notes.
http://manpages.ubuntu.com/manpages/cos ... psd.1.html
install profile-sync-daemon using software manager
In terminal without root privileges:
systemctl --user start psd.service
systemctl --user enable psd.service
This creates your ~/.config/psd/psd.conf and then edit it by showing hidden files and navigating to /home/username/.config/psd.conf
only edits needed for 70% reduction (my recommendation but options are available on the psd manpages):
change #BROWSERS="" to
BROWSERS="google-chrome" note: (default enables all browsers, i use chrome)
Restart computer and in terminal:
to check: psd p (it should say active except OVERLAYFS
for help psd help
to uninstall:
systemctl --user disable psd.service
restart computer
uninstall psd using software manager
restart computer and check psd p it should be gone
The creator of psd states sometimes changes due to updates cause changes to the default config file at /usr/share/psd/psd.conf
and would need to be diffed against the
($XDG_CONFIG_HOME/psd/psd.conf) available by navigating there via /home/username/.config/psd.conf
--------
some browsers use separate cache, like chromium and chrome. To save more writes to SSD, do the following:
all cache to ram
edit the /etc/fstab file and at the end put:
tmpfs /home/lance/.cache tmpfs noatime,nodev,nosuid,size=400M 0 0 note: (lance is my username and would need changed of course)
to uninstall, just remove the edit above and restart computer.
can be checked by sudo df -Th to see % usage of the 400Mb
Profile-sync-daemon and cache to RAM are the 2 simple changes.
The outline I've created here is a guide for people with some skills and not perfect notes.
http://manpages.ubuntu.com/manpages/cos ... psd.1.html
install profile-sync-daemon using software manager
In terminal without root privileges:
systemctl --user start psd.service
systemctl --user enable psd.service
This creates your ~/.config/psd/psd.conf and then edit it by showing hidden files and navigating to /home/username/.config/psd.conf
only edits needed for 70% reduction (my recommendation but options are available on the psd manpages):
change #BROWSERS="" to
BROWSERS="google-chrome" note: (default enables all browsers, i use chrome)
Restart computer and in terminal:
to check: psd p (it should say active except OVERLAYFS
for help psd help
to uninstall:
systemctl --user disable psd.service
restart computer
uninstall psd using software manager
restart computer and check psd p it should be gone
The creator of psd states sometimes changes due to updates cause changes to the default config file at /usr/share/psd/psd.conf
and would need to be diffed against the
($XDG_CONFIG_HOME/psd/psd.conf) available by navigating there via /home/username/.config/psd.conf
--------
some browsers use separate cache, like chromium and chrome. To save more writes to SSD, do the following:
all cache to ram
edit the /etc/fstab file and at the end put:
tmpfs /home/lance/.cache tmpfs noatime,nodev,nosuid,size=400M 0 0 note: (lance is my username and would need changed of course)
to uninstall, just remove the edit above and restart computer.
can be checked by sudo df -Th to see % usage of the 400Mb