New IT forum
25 June 2022, 10:51:51 pm *
Welcome, %1$s. Please login or register.

: PiHub now in stock.
 
Pages: [1]

Author Topic: Rpi Swap File  (Read 6273 times)

apemberton

  • Full Member
  • ***
  • Posts: 187
Rpi Swap File
« on: 22 September 2012, 09:39:35 am »

The from the RPi foundation kernel setup has a swapfile partition on a flash card. I see from setups, /etc/sysctl.conf has the custom settings:-
Code: [Select]
# rpi tweaks
# Economize the SSD
# Strongly discourage swapping (default 60)
vm.swappiness = 1
vm.dirty_writeback_centisecs = 1500

With my aversion to flash wear (OK I am using 8GB SLC cards removed from sheevaplugs) I worry about swapping. I note that a Sheevaplug does not use a swapfile and 'vm.swappiness = 0'.

I have modified the Rpi /etc/sysctl.conf viz:-
Code: [Select]
# rpi tweaks
# Economize the SSD
# Strongly discourage swapping (default 60)
vm.swappiness = 1

# Don't shrink the inode cache aggressively (default 100)
vm.vfs_cache_pressure = 50

# (default 499)
vm.dirty_writeback_centisecs = 1500

# (default 10)
vm.dirty_ratio = 20

# (default 5)
vm.dirty_background_ratio = 10

vm.dirty_expire_centisecs=1500
vm.min_free_kbytes = 8192
Unashamedly ripped from Sheevaplug settings.

However, if vm.swappiness is set to zero, would a swapfile and swap partition be required?

Logged
Tony Pemberton

Confusticated

  • New IT customer
  • Hero Member
  • *
  • Posts: 663
Re: Rpi Swap File
« Reply #1 on: 07 December 2012, 12:30:47 pm »

Linux won't attempt to use a swap file\device that isn't enabled regardless of the vm.swappiness setting.
There is only one good reason for enabling (a very low rate of) swap on a flash device, running programs with leaky memory on a system that is up 24/7.
The leaked data will eventually get flushed out to the swap, rather than bringing the system crashing down.
Far better not to run leaky programs in the first place ;)
Logged
Advocatus Diaboli - My agenda is not to give you the answer, but to guide your thoughts so you derive it for yourself!

apemberton

  • Full Member
  • ***
  • Posts: 187
Re: Rpi Swap File
« Reply #2 on: 16 December 2012, 10:24:39 am »

Leaky programs? Would I run such things?  ::)

So far so good though I still feel unhappy about flash wear. I have had instances of Rpi unreliability after a reboot but I don't think that is related to swap files. I have had SDHC cards fail after a period and a reboot but I can't find out why yet. I don't think it is flash wear but bad writes. I use both Kingston and Integral SDHC cards and both types have been corrupted. Not good as I have my Rpi's monitoring room temperature around the house. In the near future, switching on or off radiator valves/fans. I have made my own i2c/1Wire adaptors but there is a nice kit http://sheepwalkelectronics.co.uk/RPI2.shtml.

Ooops drifting off-topic!
Logged
Tony Pemberton
Pages: [1]
 
 

Powered by MySQL Powered by PHP SMF 2.0.10 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!