0

Summary

My Pi has crashed a few times recently. I'm investigating ways to make it stop, but I'm also concerned that there are immediate implications to my file system.

Background

After one crash, I couldn't boot the Pi properly. It complained of filesystem corruption, so I ran fsck on both SD card partitions. It could then boot, but several services didn't run. For example, apache2 wouldn't start, complaining that there was no group www-data.

I noticed that /etc/groups was now a symlink pointing to ../init.d/<something_I_forget>. I restored it, and the Pi now started fine.

How could this file get corrupted in such a strange way? Also, I am now concerned that other files are similarly corrupted, and I'll only notice later down the track. Is this possible? Can I check, or should I restore an older backup?

2

This is somewhat common if your Pi shuts down unexpectedly (perhaps from low voltage) or crashes, or even if you shut it down without stopping Apache gracefully - if this is going to be a common occurrence, you may want to set it up such that the SD card is in read-only mode

alternatively, different file systems have different anti-corruption implementations, and some may be better than others.

Unfortunately detecting a corrupt file is rather difficult to do without trying to actually use the file, and trying to use the file may not occur until "somewhere down the track".

see here fore more info

  • I agree. I'm to the point that I wish the pi had 2 CF card slots so that you could mount the OS and /home separately. As it is after most changes I backup the whole card up to NAS. Since I have extreme NAS storage available I've thought about setting up a cron back up but haven't done it yet. – Tyson Aug 15 '14 at 16:50
  • @Tyson - you can mount different partitions separately (on the same SD card, provided it has sufficient capacity), and move the home location to a separate partition. see here – user2813274 Aug 15 '14 at 16:56
  • I've since noticed other corruption. I ran sudo raspi-config, and was told insserv: warning: script is corrupt or invalid: /etc/init.d/../rc0.d/K01nmbd. OTOH, read-only access to the SD card seems too complicated for me. I need to write frequently to /var/www and numerous other directories. I'd be excluding so many directories that they would be at risk of corruption anyway. – Sparhawk Aug 16 '14 at 4:01
  • @Tyson FWIW I restored from a backintime image, which worked perfectly. I have a cron job to back up nightly. I could then just rsync -aEHAXP --del the / and /boot directories back to the SD card, and was good to go. – Sparhawk Aug 16 '14 at 4:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.