if you have a raspberry that is colocated and on 24×7 you might want to perform regular maintenance on it.
Especially the SD card needs to be taken care of if you don’t want to have it die prematurely.
One thing to do is to upgrade the firmware to the latest version which is easy (when you are running raspian) using
‘sudo rpi-update’
followed by a reboot
then the usual apt-get update/upgrade
change pi’s password (or remove pi entirely) > make sure you add your new user to all the groups the “pi” user had!
now, how to extend the life of the sdcard?
UPDATE 2014: raspian does most of these things, see below for more ideas:
sudo dphys-swapfile swapoff
sudo dphys-swapfile uninstall
sudo update-rc.d dphys-swapfile remove
The next thing was to move /tmp to memory. Just issue:
sudo vi /etc/default/tmpfs
And then set this parameter:
RAMTMP=yes
Finally, I wanted the logfiles in memory too. Note that they quietly disappear every time you shutdown, so they are of very little use when your Raspi has crashed. Just issue:
sudo vi /etc/fstab
And make sure it looks like this:
proc /proc proc defaults 0 0
/dev/mmcblk0p1 /boot vfat defaults,noatime 0 2
/dev/mmcblk0p2 / ext4 defaults,noatime 0 1
logfs /var/log tmpfs size=10M,noatime 0 0
this is the old stuff: (2013)
everything that read/writes needs to be restricted.
think of things like:
– disable swap
– disable journaling
– the ‘noatime’ flag
– move often used directories to ram disk or external disk (off the sdcard)
another thing to consider is that modern sdcards spread the read/writes over the entire card to minimize wear of a single area – this works pretty well but the card will not let you know that it is breaking, like a PC harddrive will (sector errors, I/O errors, etc…)
so: leaving space over on the sdcard allows it to perform “wear leveling” more effectively – statistically calculated having a lot of space free on the card will allow it to live a lot longer as it can spread the reads/writes across a larger area
http://electronics.stackexchange.com/a/27626/3774
command to use; ‘df -h’ <-- shows free space on all partitions
now on to my raspberry that crashes weekly and needs a reboot
- noatime seems enabled:
proc /proc proc defaults 0 0
/dev/mmcblk0p5 /boot vfat defaults 0 2
/dev/mmcblk0p6 / ext4 defaults,noatime 0 1
swap file is disabled already, too
what else can I do?