3

I've read to never run fsck when the file system is mounted. What about running fsck -N to only identify but not repair the file system when mounted? Is that dangerous? Is fsck -N known to overload a system and slow it down?

2 Answers 2

5

fsck -N only prints the list of filesystems that would be checked. fsck is a front-end to filesystem-specific programs such as fsck.ext2, fsck.btrfs, … The option -N tells fsck not to invoke those programs but to print the command line that it would use instead. fsck itself doesn't actually read those filesystems, so it doesn't matter whether the filesystems are mounted or not.

If you meant fsck -n, then the filesystem-specific programs are called and passed the -n option, which for most of them means “look but don't touch”. If the filesystem is mounted, fsck will usually find spurious errors, because a mounted filesystem tends to be in an inconsistent state as write operations are happening. It won't lock up your system, but it won't report anything useful either.

2
  • Do you happen to know why -n is not documented in man fsck? Or am I just looking in the wrong places?...
    – toraritte
    Jan 11, 2023 at 21:31
  • 1
    @toraritte It's documented as “fs-specific-options”. Jan 12, 2023 at 17:55
1

By definition, a mounted filesystem is in an inconsistent state. So if you were to run that, it would likely print a bunch of spurious and completely meaningless errors.

Really, if you need to check the filesystem, unmount it.

2
  • No, with the option -N (note the capital N), the filesystems are not even read. Oct 14, 2013 at 0:48
  • 1
    Yes, that's what -N does. But it's clear from context that he intends lowercase -n. Oct 14, 2013 at 2:06

You must log in to answer this question.