6

ext4 with journaling is a robust file system that avoids corruption after power loss. However, this doesn't seem to work for Raspberry Pi's. I assume this is because memory cards (and/or our memory card controller) are lying to the filesystem about when writes are actually committed to permanent storage.

Since journeling is not effective for Raspbian, why not turn it off to avoid the extra disk writes that it involves?

Is there any brand/model/whatever of memory card out there which does NOT lie to the filesystem and makes journaling robust?

  • PS: I've had experience with a number of cheap MMC controllers which do out of order writes, and which will lie to the OS about when those writes are actually committed to permanent storage. The combination is enough to corrupt nearly any file system. – DonGar Jun 17 '14 at 3:14
5

I doubt that swapping the SD card for another solves the filesystem corruption issue. The following citation from Do journaling filesystems guarantee against corruption after a power failure? pretty much highlights the issue:

There are no guarantees. A Journaling File System is more resilient and is less prone to corruption, but not immune.

The corruption that you are experiencing is likely because the data has not fully been written yet, although the journal was correctly updated. If you did not have a journal, your file would probably be filled with garbage.

As for why Raspbian uses journaling with ext4, that is likely because it has been the default in Debian.

0

for me ext4 is working quite well on my RPI. In most cases I simply pull the power plug instead of a regular shutdown. Journalling then avoids annoying fsck when the FS is mounted next time.

0

Journaling file systems should NEVER repeat NEVER be used on a flash drive. The journal is a small section of the fs that gets re written EVERY time that you write data to the disk. This gives you a maximum of about 11,000 writes anywhere on the disk before you start to burn out the section that was used for the journal. I've managed to burn a card out in 5 days due to this. I'm going to find out how to force ext 2 on raspian for all my future projects.

  • 5
    don't be silly, most contemporary SD cards use wear leveling, that spreads the write operations all over the empty space on the card. hence the recommendation to get the biggest size you could afford. – lenik May 26 '14 at 7:20
  • Agreed with @lenik, anonymous user15086 is confusing MTD devices (where this is an issue, and where you should use an MTD-aware filesystem like jffs2) with SD cards, where the Flash memory is hidden behind a block device interface. If it's a block device, you can use any of the regular block device filesystems, so ext4 is quite adequate. – Amedee Van Gasse Jul 24 '14 at 13:30

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.