I have used linux extensively in the past so I know my way around the shell, but this is my first time using a Raspberry Pi. Here's the thing. Me and my colleague are trying to setup a monitoring system for some sensors using a Raspberry Pi. I performed a fresh minimal netinstall of the raspbian linux. Now since this device is expected to have a long life I'm trying to minimize the amount of write cycles performed to the SD card.
Among the things I did is the fstab modification where I set some folders (i.e. /tmp, /var/cache/apt and /var/log) to reside in RAM by using tmpfs. Yes yes, I know that the logs won't survive a reboot or a power cut. If the device starts crashing we'll simply disable the tmpfs on /var/log to see what's going on.
Anyway, I'm having some problems running /var/log on tmpfs, because some services (i.e. nginx) refuse to run and complain they can't write to /var/log or create new files in there. I was wondering, if there is a good solution to this. Is it a good idea to mount /var/log folder as world-writable (mode=1777)?
My current fstab looks like this:
Do you have any other tips on how to reduce writes to the SD card?# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# System partitions
/dev/mmcblk0p1 /boot vfat utf8 0 0
/dev/mmcblk0p2 / ext4 noatime,errors=remount-ro 0 1
# Temporary mount points
tmpfs /tmp tmpfs defaults,noatime,nosuid,nodev,noexec,mode=1777 0 0
tmpfs /var/log tmpfs defaults,noatime,nosuid,nodev,noexec,mode=0755 0 0
tmpfs /var/cache/apt tmpfs defaults,noatime,nosuid,nodev,noexec 0 0
# External HDD or USB key
/dev/sda1 /mnt/flash auto defaults,noatime,nosuid,nodev,noexec 0 0