Posts: 1
Joined: Tue Nov 28, 2017 11:28 am

Raspbian change may increase wear on SD

Wed Nov 29, 2017 11:09 am

I think as part of a patch in September 2016 the default value for vm.swappiness was changed from 1 (almost always avoid using swap) to 60 (OK to use swap) which means its possible that your Pi will now use swap space a lot more often. If you are using the default 100M swap on your SD and are pushing your Pi hard you should probably reset this back to 1 to avoid undue wear on your SD.

You can easily check swappiness with:

Code: Select all

sysctl vm.swappiness
And check if swap is being used with:

Code: Select all

free -h
or with:

Code: Select all

vmstat 10

Note that I found this issue while tracking down some odd MMC errors being reported by the kernel on a few Pi running Chromium continuously showing a series of slides:

Code: Select all

Workqueue: events_freezable mmc_rescan

Code: Select all

Workqueue: kmmcd mmc_rescan
I'd ruled out problems with the Pis, power supplies, and SD cards... and found the swappiness change while searching possible causes of high disk usage. I'm still not sure changing swappiness back to 1 will help with this particular issue - time will tell.

(Nov 30 2017 - changed Subject)

Posts: 1
Joined: Thu Jan 11, 2018 3:33 pm

Re: Raspbian change may increase wear on SD

Thu Jan 11, 2018 3:52 pm

I also noticed that swap was being utilized even though there was plenty of free ram on my Pi. This is how I changed the swappiness:

Code: Select all

pi@pi:~$sudo nano /etc/sysctl.conf
A swappiness value wasn't defined in there, so I added the following lines to the end of sysctl.conf:

Code: Select all

# Changed swappiness from a default of 60 to 10 to decrease swap usage
vm.swappiness = 10
Save the file, then reboot or turn swap off and back on.

More information in the answer here: https://askubuntu.com/questions/103915/ ... swappiness

Return to “Advanced users”