Yesterday I turned off the Raspbian normally, I expected to stay only the red LED lit, after some time I turned off the power.
Today I had a bad experience!
The RPI was not fully loading the boot and appeared on the screen to manually run ' fsck '.
And I ran the 'fsck' on my Xubuntu.
It worked to recover the boot, the filesystem was clean.
But a folder disappeared
, just that I use to run the script for the expected application to the RPI.
I researched quite a solution to prevent the file system is corrupted to turn off the power abruptly.
Also did not have time to put into practice the idea of backing up the source with batteries or super capacitors.
And I think I found a solution to my problem!
I managed to get the filesystem to read- only mode, and everything seems normal.
Follows the idea:
1 - In Xubuntu I opened the files from the SD card RPI and edited the file /etc/fstab, adding temporary partitions running in RAM:
Code: Select all
proc /proc proc defaults 0 0
/dev/mmcblk0p1 /boot vfat defaults,noatime,ro 0 2
/dev/mmcblk0p2 / ext4 defaults,noatime,ro 0 1
tmpfs /tmp tmpfs defaults,noatime,nosuid,size=100m 0 0
tmpfs /var/tmp tmpfs defaults,noatime,nosuid,size=30m 0 0
tmpfs /var/spool/mqueue tmpfs defaults,noatime,nosuid,mode=0700,gid=12,size=30m 0 0
none /var/run tmpfs size=5M,noatime 0 0
none /var/log tmpfs size=5M,noatime 0 0
2 - I dismounted the SD and insert again in the RPI.
3 - I called several times and hung up the RPI and at different times to test.
1 - I do not need the GUI, so I removed everything related to it.
sudo apt-get remove --purge x11-common (-750MB)
sudo apt-get autoremove (-205MB)
2 - Before editing the fstab file, The RPI was only 44MB of RAM in use.
3 - SD was only 598MB in use (I also removed other small packages).
4 - the GPU is configured to use 16MB.
add to end of file /boot/config.txt:
5 - Remember to always back up the data from sd card. On Windows PC, I use USB Image Tool: