EXT3 & EXT4 filesystems are NOT safe.
Posted in 2009
Friends, Colleagues, Clients: According to Linus Torvalds, Linux's EXT3 filesystem is not safe since it writes its meta data to disk before committing the related data changes to the file. This can mean corrupted files if the system crashes between the two non-atomic writes to disk. About this EXT3 algorithm, Linus says: "Whoever came up with that solution was a moron. No ifs, buts, or maybes about it." According to Slash-Dot, the new EXT4 filesystem suffers from a different but related problem. It also writes its meta data first, but also does note physically allocate disk blocks to a new or expanding file until the data is committed (ie synced) to disk in order to facillitate optimized elevator writes. The result is the same after an inconveniently timed crash as it is in EXT3. The developer of EXT4 has added a new mount mode to EXT4 but it is not expected to make it into any current kernel releases until the next experimental release sometime next year. About EXT4 Linus says: 'ext4 just defaults to the crappy "writeback" behavior, which is insane." This risk of data loss is despite (and partly because of) both of these filesystems being journaled! I'm not even going to go into the wisdom (or lack thereof) of using a journaled filesystem for chunks of a database that does its own logging. I hate to say I told you so, but I have continued to recommend that IDS chunks ONLY use RAW devices and NOT filesystems all along, even since the incorporation of DIRECT IO support in IDS. If you MUST use COOKED chunks, and with Linus still trying to get rid of RAW altogether, we may not have a choice at some point, at least use COOKED device files NOT filesystem files. Art Art S. Kagel Oninit (www.oninit.com) IIUG Board of Directors (art@iiug.org) Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on my employer, Oninit, the IIUG, nor any other organization with which I am associated either explicitly or implicitly. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves.