After a few SD cards thrown away with failure symptoms, I had a look at what the web has to say about reducing the amount of write operations – because SD cards have their life limited to the amount of write operations.I’ve compiled in this post a list of tweaks and tips to the Raspberry Pi configuration to help on this issue.Note: The tips below must not be treated as mandatory nor as a “we all should do this otherwise ” attitude. Please be very careful and understand what you’re doing, some of these tips might significantly decrease the Raspberry Pi performance and stability.DISCLAIMER: Use at your own risk, I cannot be held accountable if anything goes wrong. 1 – Use tmpfsRaspbian is now using SystemD to manage its startup processes, so I’ll only cover that, there are other blog posts (see references) that will help you on a SysVinit system.Using tmpfs means that you’ll be using RAM instead of the SD card. If this will reduce the amount of writes in the SD card it will also increase the memory usage, take this into account if your Raspberry Pi usage is very intensive in terms of RAM. Move /tmp to tmpfsBy default Raspbian is already mounting several mount points in tmpfs, /dev/shm, /run, /sys/fs/cgroup, but some applications do use /tmp to create temporary files to keep their internal state on while running.
Files located in /tmp should be temporary, and not permanent, then this is something that you don’t need to keep between reboots.systemctl enable tmp.mount Move /var/log to tmpfsAnother tweak is to move all the log files to tmpfs, that has a huge impact on the writes, however after every reboot you lose log files from basically anything running in your Raspberry Pi. Usually they are not needed, but if needed by any case this can be reverted at any time.Add this entry in /etc/fstabtmpfs /var/log tmpfs defaults,noatime,mode=0755 0 0Don’t forget to reboot for the changes to take effect. 2 – fstab and noatimeThe noatime option on the fstab entries that use the SD card is essential to reduce the number of writes. Linux updates the last access time when a file is accessed.
Although this is already the default in Raspbian for the SD card partition, this option might also be very useful for USB connected SD Cards and NFS/SMB mounts as the network is usually slower and this option improves a bit the network performance. 3 – Turn off swap Note: Don’t turn swap off unless you know what you’re doing!!!
Thinking that you know what you’re doing is not enough!Swap memory is only used when the RAM is fully used, depending on the application we are giving to the Raspberry Pi this might or might not be a concern.
Raspbian is a free Debian-based operating system optimized for the Raspberry Pi, and Stretch is the development code name for Debian 9. In this guide, we'll download and install Raspbian Stretch for use on the Raspberry Pi. Install ROS and OpenCV in Raspberry Pi(Raspbian Stretch) Posted on December 20, 2017 December 20, 2017 by Zichun This instruction covers the installation of ROS Kinetic (Robot Operating System ) and OpenCV-3.3.1 on the Raspberry Pi 2 or 3 with Raspbian Stretch.