5

Will a 100GB disk with 1,000,000 files take longer than a 100GB disk with 100 files when running fsck?

3
  • To be clear: Would the 1,000,000 files and the 100 files occupy the same amount of space?
    – Dennis
    Apr 11, 2013 at 22:06
  • @Dennis Yes, same space occupied.
    – IMB
    Apr 11, 2013 at 22:07
  • most likely it will be slower. It has to go through the list of filenames 1 at a time and verify they are correct. How much slower is also dependent on the file system, and hard drive speed and processor speed. Also if the filesystem code is code for multi threaded or not.
    – cybernard
    Apr 11, 2013 at 22:23

1 Answer 1

9

That depends on the file system and the switches you use with fsck.

What fsck Checks and Tries to Repair gives a pretty detailed explanation of what fsck does when invoked without switches.

Some of the checks take a constant amount of time (e.g., super block check), many of them depend on the number of inodes fsck has to process (e.g., link count checks), others on the file system's size (e.g., regular data block checks).

Without the -c switch, fsck does not check the contents of regular files, so the size of the files is irrelevant. Even when checking for bad blocks, the execution time only increases with the file system's size. Which portion of the of the partition is occupied does not affect the execution time.1

The number of inodes of a file system is constant, i.e., decided upon at creation time. Each file's metadata is stored in one of such inodes. According to ext4, unused inodes are marked as such in ext4, but not in ext3. Thus, fsck's execution time increases with the file count in ext4, but is constant (and high) in ext3.

The following figure illustrates this:

comparison

Observe that the different file counts are represented by different colors. The graphs for ext3 with 2.1 million, 100 thousand and even zero files are identical. The graph for ext4 with 2.1M and 100k files respectively show a significant difference.

In contrast, execution time increases with the number of inodes with ext3, while unused inode do not impact execution time with ext4.


1 Verified empirically by running fsck -c on an empty partition.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .