They are doing this because of the supposed advantages of journaling, however I had a reminder a couple of days ago not to rely too much that journaling will save the day.
The power went off my RP unexpectedly, and even after I had done a filesystem check, I still had some corruption. A couple of files were truncated, due to the filesystem buffers in RAM being unable to flush completely.
Also, journaling is bad for Flash memory as there are more writes to memory. It is also slower.
Then there is Execute In Place (xip) suggested by technosaurus. This will be very good for a system with not much RAM. Xip is only available for ext2 I think.
Puppy will do a f.s. check at bootup if there was an abnormal shutdown. This is done by creating a mini-Linux in a ramdisk, chrooting into that, unmounting the main partition then doing a f.s. check, then reboot. This all happens automatically. Fortunately, as I have compiled my own kernel, I set the ramdisk big enough (I think).
All of the above indicates to me that ext2 is the best choice for the RP. My kernel also has enabled ext2 support, with xip enabled. So, I reckon this will be the next thing to try.
Comments:Posted on 2 Jul 2012, 22:16 by BarryK
From the official kernel documentation:
This implementation is limited to storage devices that are cpu addressable at all times (no highmem or such). It works well on rom/ram, but enhancements are needed to make it work with flash in read+write mode.
Posted on 2 Jul 2012, 22:28 by BarryK
According to this page, ext2 and ext3 also support xip:
...that is a mistake?
Posted on 3 Jul 2012, 2:27 by Ted Dog
open source xip filesystem
was learning about xip and came across this.
looking foreward to mele version. If we need to roll with wolf does it go on the target machine or is it cross compiled? never could grasp how to start development with wolf.
Posted on 3 Jul 2012, 5:55 by K Godt
I had put a
several times into rc.sysinits and it seems that like reiserfs-3.6 everytime ext2 is mounted it automatically gets marked 'unclean' in the superblock . Therefore i have abandoned ext2 and switched to journals . ext4 is much faster while fscking it than ext3 . Sad to hear that ext4 could give problems . Since ext4 was implemented into 2.6.30 kernel i don't think kernel-3.x versions are the "real absolute need" for a 700MHz processor kernel . Puppy 4.3.1 sill has it's supporters ! Also glibc-2.6.1 is much smaller for the initial ramdisk .
dumpe2fs /dev/sda# | grep -i 'state'
Posted on 3 Jul 2012, 6:02 by BarryK
Re glibc in initrd
Also glibc-2.6.1 is much smaller for the initial ramdisk
Puppy doesn't have glibc in the initrd, everything is compiled statically with uClibc or dietlibc.
However, Debian and Ubuntu do have glibc in their enormous initrds.
Note, our SD card installation of Puppy for the RP does not use an initrd at all. Nor does Debian for RP.
Posted on 3 Jul 2012, 7:05 by K Godt
oops meant /dev/ram0
mini-Linux in a ramdisk != initrd
Posted on 3 Jul 2012, 7:11 by BarryK
ext2 is best for Flash
For Puppy booting off Flash drives, I have always used ext2 for the save-file. Always, ever since the project started.
Others lobbied for ext3 (and recently ext4) support, so I obliged them. However, I recognised that the journal in ext3 and ext4 offers limited protection, and my reconsideration in this blog thread reconfirms my opinion.
A journal at best only offers partial protection, unless it is able to mirror all of the RAM filesystem buffers. Actually, I think that I read ext4 is capable of doing that, but that option is not used due to the performance penalty.
So, a journal gives you a false sense of security.
A journal, by its very nature is going to hammer the Flash very hard with frequent writes. SD cards are going to fail very quickly.
In the current situation, booting off a Flash SD card, with a "full installation" of Puppy (no save-file, no initrd, no unionfs/aufs), the situation is worse, as all writes go directly to the Flash memory. Even /tmp. The RP has so little RAM that I haven't even mounted a tmpfs (filesystem in RAM) on /tmp. Then there is the swap partition on the Flash drive also.
I should mention that all those other Flash filesystems, FFS2, JFFS2, LogFS, YAFFS, are for Flash NAND and NOR memory (MTD) chips, not for block-filesystem Flash drives such as SD and CF cards (these have their own intermediate electronic hardware in the card, and may include wear-leveling).
A note for those who choose ext3 or ext4 for their save-file when booting off Flash drive on a PC. The journal is in the save file, and the save-file is copied to RAM (if sufficient RAM). All work is done in RAM, with periodic flushes to the Flash drive. This makes the journal basically useless.
In the case of the save-file not being copied to RAM, then the journal will work, but your Flash memory is going to get hammered.
I should point that my recent experience with file corruption on my SD card went "unreported". The journal appeared to have recovered everything, no errors were reported at next bootup. It was only because I didn't believe that recovery could be complete, that I checked the files that I had been working on at the time of power failure, and found a couple of them were truncated.
Read this to learn more about how journaling gives us a false sense of security:
Posted on 3 Jul 2012, 8:39 by K Godt
QUOTE : In the current situation, booting off a Flash SD card, with a "full installation" of Puppy (no save-file, no initrd, no unionfs/aufs),
Wondering why PUPMODE=2 and not PUPMODE=3 possible ?
Debian limitations ?
Posted on 3 Jul 2012, 8:01 by BarryK
Yes, I don't see any reason why we can't do PUPMODE=3 on the RP.
I have have been taking small steps, just doing it the same way as the other distros so far.
PUPMODE=3 would give us an initrd and a layered f.s., which means that we can load and unload sfs files. I will probably experiment with that a bit later. We would also have the choice of saving the session to either a save-file or the entire partition.
Posted on 3 Jul 2012, 14:47 by mavrothal
I'm using SDcards with my XOs 4 years now, to both hold the OS and the swap partition. The story about the cards wearing off from the read/writes is pretty much a myth but has several caveats.
The modern cards are pretty good in wear leveling and ext2 or ext3 does not make a lot of difference in that front (~20% more writes) if the card is "good" and "properly formatted". The older of my cards runs for 3 years now without any issues.
What is really important is the card characteristics, mainly the simultaneous open allocation units, and if it is properly formatted to the erase block boundaries. Linux formating utilities are doing a terrible job on this and can exponentially increase read/writes and decrease card performance (thus, although user-friendly, I think is a bad idea to to distribute the ARM OSs as dd images even if properly formatted your your specific card).
Unfortunately the crucial card characteristics (page and erase block size, open allocation units etc) are very inconsistent even for cards of the same brand and type, and they are not reported anywhere. Even if known though, formating utilities just ignore them.
Here you can see a relevant LWN article from the Linaro project developers about optimizing SDcards for Linux.
At the bottom of this page there a list with various SDcard characteristics (and their huge diversity), though unless you have the exact same card, is not much help.
Finally, this post has some formating instructions based on the card characteristics and at the bottom, links to the (a bit old by now) compiled flashbench utility that can tell you the important characteristics of your specific SDcard.
Posted on 3 Jul 2012, 15:10 by Tony
Keystroke / timer for save
Re wear and tear on flash drives would it be possible to count keystrokes?
If so perhaps there could be a setting to say "After so many keystrokes commit to flash" in addition to the normal write to flash timer?
Posted on 3 Jul 2012, 16:22 by K Godt
Quote : count keystrokes?
I think some people would like to tar and feather you for that idea . It may be possible to use the kernel/drivers/input/evbug.ko if compiled and shipped with the distro, that would make it possible to log or show up in console or /var/log/syslog.log all keystrokes even your PINs and Security Passwds ...
Posted on 3 Jul 2012, 17:21 by BarryK
More on journals
While I'm bashing journaled filesystems, a couple more points. The Linux documentation informed us right from the start that journaled filesystems are incompatible with loop-mounted files.
I can see why. The journal is being maintained inside the file, not directly on the physical disk as it should be. This means that the protection that the journal offers in the case of a crash, is absent.
So, another reason why ext3 and ext4 are pointless, or perhaps nearly pointless, for our PUPMODEs that have a save-file. Regardless of whether the save-file is on USB or hard drive, the same problem exists.
Then there is speed and size. A journaled f.s. is inherently slower, and the journal occupies a very large portion of the f.s. storage space.
Heh heh, you guessed it, Puppy alpha3/beta1 for the RP will use ext2!
Posted on 3 Jul 2012, 17:43 by ttuuxxx
ext2 vs ext3 vs ext4
I only use ext3 on all my linux hard drives, I won't use ext4 because it doesn't work on older puppies eg puppy2,3,and early 4 series, ext 3 will work with all of them.
Posted on 3 Jul 2012, 17:54 by BarryK
Flash card life
Yes, I am wondering whether I should be that concerned about number of writes these days.
I did read recently that there is an enormous difference in the quality of SD cards, which translates into lifetime. The order of 50x. One Microsoft link stated that using a top quality USB Flash pen drive as cache, it will last "up to" 10 years. But, if you divide that by 50 for the worst card, then you get about 2-3 months.
That link you posted: https://lwn.net/Articles/428584/
...very interesting, particularly that partitions should be on 4MB boundaries.
My SD card partitions are not -- I used a Rasbian SD image as the basis of mine, I think, other Linux distros for RP will be having the same potential problem.
I might as well align the partitions on 4MB boundaries for my SD skeleton image. Also, when using 'dd' I should set block-size to 4MB (instead of 1MB that I currently use).
Posted on 3 Jul 2012, 20:04 by Tony
Hi K Godt, lucky I am a Cloud A.I. and not a real person 8-)
Yes I see what you mean about evbug.ko but I was thinking of something simpler, as last time I mucked around with interrupts it was on an 8085 board and I had to write my own code just to read the hex keyboard!
I was thinking about adding code to keyboard interrupt routine that increments a counter that would then trigger a different interrupt to operate the write to flash. Probably way to low level stuff to be easily do-able?
Posted on 3 Jul 2012, 21:51 by Jota
While we are at this fs subject, I would like your opinion about reiserfs 3.6 compared to ext2, specially on older hardware, eg. IDE drives.
Is reiserfs much slower/worse than ext2?
Posted on 3 Jul 2012, 22:18 by jamesbond
advantage of ext4
In ext4, journalling can be turned off:
tune2fs -O ^has_journal /dev/sda2
The main advantage of ext4 against ext2 is that ext4 uses "extents" to manage file allocation instead of bitmaps, providing better performance when transferring large files.
Posted on 4 Jul 2012, 6:32 by 01micko
Interesting... maybe fixing the block-size was enough to fix the performance issues ???
Posted on 4 Jul 2012, 6:54 by kirk
A journaled f.s. is not inherently slower, there's a lot of other design factors that impact that. Ext4 is very fast on flash, look up some of the benchmarks that have been done.