Administration of Raspberry Pi like Computers
Flash Memory card Related Issues
If the power supply is not powerful enough, then the data on the Flash memory card gets corrupted. The memory cells of flash memory cards can only be written to a limited number of times, id est flash memory cards wear out. To minimize the wear, SWAP partition should be disabled and on 2015 edition of Raspbian that can be done by root by using following commands:
swapoff --all dphys-swapfile uninstall update-rc.d dphys-swapfile remove
To minimize the wear of the flash memory card, the
should be mounted as RAM partition. An excerpt of the /etc/fstab :
# The 'blkid' can be used for printing 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. Please see fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> tmpfs /tmp tmpfs nodev,nosuid,size=50M 0 0 # An example, how to auto-mount an USB storage # device during boot. The USB storage device must # be connected to the computer prior to power-up. Alternatively # the 2015 edition of the Raspbian operating system offers # apt-get install usbmount UUID=4165b262-2e70-460d-aa8e-81b46dcc24f8 /opt/the_mounting_point ext4 errors=remount-ro 0 1
It is discouraged to use the a cronjob for running the fstrim on the flash memory card, because a power failure during fstrim execution might cause data loss. On Raspbian the root user can run the fstrim on the flash memory card by using the following command:
To avoid data corruption it is reccommended to power the system down before unplugging the flash memory card and vice versa, plug the flash memory card in before the system is powered up.
Server Software Related Issues
To minimize the probability of power failure related data loss, it might be useful to add the following line to the system wide cron job list, the /etc/crontab:
* * * * * root sync
User specific cron job lists are edited by using the following command:
crontab -u username_which_in_this_case_is_root -e
User specific cron job lists do not contain the name of the user, because that is determined by the "owner" of the list. An excerpt of a user specific cron job list:
# Edit this file to introduce tasks to be run by cron. # # Each task to run has to be defined through a single line # indicating with different fields when the task will be run # and what command to run for the task # # To define the time you can provide concrete values for # minute (m), hour (h), day of month (dom), month (mon), # and day of week (dow) or use '*' in these fields (for 'any'). # Notice that tasks will be started based on the cron's system # daemon's notion of time and timezones. # # Output of the crontab jobs (including errors) is sent through # email to the user the crontab file belongs to (unless redirected). # # For example, you can run a backup of all your user accounts # at 5 a.m every week with: # 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/ # # For more information see the manual pages of crontab(5) and cron(8) # # m h dom mon dow command * * * * * sync
crontab -u username_which_in_this_case_is_root -l
displays the list of cron jobs of the specified user.
In stead of the classical BIOS, the Raspberry_Pi has a special text file, config.txt, on the memory card Windows partition. Supposedly the configuration parameters can be displayed on a running Raspbian/Linux operating system by using the command vcgencmd.
vcgencmd get_config <config> - lists a specific config value. E.g. vcgencmd get_config arm_freq vcgencmd get_config int - lists all the integer config options that are set (non-zero) vcgencmd get_config str - lists all the string config options that are set (non-null)