1

I've got my laptop in dual booting, and whenever I boot into Linux (Ubuntu or Linux Mint), there's a decent chance that it will run the file system check (more than the default once every 30 times), and it'll be a definite run if I'm booting after letting the laptop run out of battery. This has happened over two different laptops.

The Windows partition on the other hand, never does anything visibly, so I was wondering:

Is it the case that the file system on my Linux partition (ext2/3) is more fragile than the file system on my windows partition (NTFS)?

Is it the case that Windows checks for errors and solves them in the background?

Is it the case that Windows doesn't check for errors, and Ubuntu is just more vigilant in terms of file system health?

Thanks

Seth
  • 58,122
Peter
  • 407
  • Are you sure you are using ext3 or 4 and not ext2, and that it is in fact, that partition that is being fscked? With ext3/4 it should not be, but with ext2 it will be. Windows does the same thing, for the same reason if you are using FAT instead of NTFS. – psusi Jan 31 '13 at 19:03
  • I am using ext 2 now, but was using ext 3 on my last laptop (I'm not sure why). I think it is being fscked. – Peter Jan 31 '13 at 19:09
  • 1
    Why are you using ext2? Why not ext3 or even 4? – Drake Clarris Jan 31 '13 at 21:04

2 Answers2

4

It'll be a definite run [of a file system check] if I'm booting after letting the laptop runs out of battery.

On every mount, Ext3 will simply replay the journal, eliminating the need to do a full file system check. But really, please avoid a hard shut down of the system! It's not a good practice if your data is valuable. Instaed, let Ubuntu just shut down your system gracefully on a low battery.

To see if your file system will be checked on the next boot, run

dumpe2fs -h /dev/sda1 | grep -iE "(mount count|check|state)"

If you really need to hard shut down without taking the time to going through the shut down procedure, then at least shut down your file systems cleanly before pulling the power - e.g. by doing Alt + sysrq + REISUB (but use O instead of B to halt).

Is it the case that the file system on my Linux partition (ext2/3) is more fragile than the file system on my windows partition (NTFS)?

No. I believe the Ext3 file system is very stable and very unlikely to break. The checks just make sure the structure is intact and that possibly corrupt blocks are being hidden (moved to lost+found) and that the files will be in a known consistent state.

Is it the case that Windows checks for errors and solves them in the background?

It's not the right place to ask how Windows works, but I really prefer to know whether my file system can be recovered to a known state before my applications are allowed to start and write to the disk. Doing a check afterwards while applications are already writing, it can make things a lot worse.

Long story short: checking the file system before it goes "live" and writeable, is of your own benefit.

Is it the case that Windows doesn't check for errors, and Ubuntu is just more vigilant in terms of file system health?

See above.

About Ext2

As became clear later in the comments, you appear to be using Ext2 still. That version does not feature any form of a journal, as psusi points out. The above does only apply to Ext3/4 and most other journaled file systems. Please avoid the use of such and old file systems if your data is valuable in the conditions of unclean shut downs. There's no reason to use it still for regular Ubuntu desktop installations.

Newer generation file systems

Additionally, I wanted to point out that a newer generation of file systems is starting to become more and more mainstream. For Ubuntu/Linux this is Btrfs, a design similar to ZFS. It will be way more intelligent in fixing corruptions and is self-healing on-line. However, it will not be able to do magic on pulling the power from a running system - there's still risk in losing data you wrote just before you pulled the plug.

gertvdijk
  • 67,947
  • The journal is replayed during mount, and a fsck is not performed after an unclean shutdown. – psusi Jan 31 '13 at 19:01
  • By letting the laptop run out of battery, I had assumed that Ubuntu shut it down (normally it hits 5%, then suddenly hits 0% and turns itself off). I'm not holding the power button. – Peter Jan 31 '13 at 19:10
  • @Peter If a low-battery state does not shut down your laptop, then check your power settings. If it's set to do so, but it doesn't - file a bug report: How do I report a bug? – gertvdijk Jan 31 '13 at 19:12
2

Don't use ext2. It has no journal, so like FAT, has to be checked after an unclean shutdown.

psusi
  • 37,551