What kind of file system check should I use?

Linode Staff

What is the difference between fsck and e2fsck? I'm not sure which one to use.

1 Reply

It's good to first know that fsck (File System Consistency Check) is a utility designed to find and fix file system errors. This can be because of myriad reasons, but often times is necessary in the event of corruption.

The short answer here is that both fsck and e2fsck basically do the same thing, except e2fsck specifically checks a different file system type (ext2, ext3, or ext4). Each file system is formatted differently, and sometimes you need to specify which one you want to run a check on. fsck can automatically attempt to determine the type of file system, but it's not always successful in doing so, thus the need for some extra TLC. Another way to run e2fsck is with the following syntax:

fsck -t ext4 /dev/sdc1

As you can see, it's running fsck, specifying the ext4 type with the -t flag, and then running the check on the (unmounted) sdc1 partition.

If you're not sure what type of file system type to run a check on, you can check the format from the "Advanced" tab on your Linode's summary page while logged into the Linode Cloud Manager. The "Disks" section will list out the specific type of file system for each disk.

You can also run the df -Th command while logged into your Linode to see each disk listed with the file system type next to it. Here's a link to a TecMint article that has some other ways to figure this out:

7 Ways to Determine the File System Type in Linux (Ext2, Ext3 or Ext4)

A note on this: Before running any file system check, it's super important to make sure you're doing it on an unmounted disk; otherwise, fsck could lead to potential data loss. The easiest way to avoid this is by booting your Linode into Rescue Mode and forego the disk mounting option.

There's a really great article from computerhope.com that goes over common/useful fsck syntax:

Linux fsck command

And here's a Stack Exchange superuser post that goes into a bit more detail about the differences between the two consistency checks:

What is the difference between fsck and e2fsck?

Additionally, we have an awesome guide that goes into a ton of detail about how to go about using fsck:

How to use fsck to Find and Repair Disk Errors and Bad Sectors

Hope this helps!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct