10

The ext2/3/4 filesystem checker has two options that seem to be very similar, -p and -y.

Both seem to perform an automatic repair, but the manpage states that -p can exit when it encounters certain errors while for -y no such thing is mentioned. Is this the only difference?

AndreKR
  • 1,010
  • 3
  • 13
  • 28

1 Answers1

16

There is a specific difference which when we read it twice might make more sense.

-p - Automatically repair the file system without any questions.
-y - Assume an answer of `yes' to all questions.

So fsck -p will try to fix the file system automatically without any user intervention. It is most likely to take decisions such as yes or no by itself.

However, fsck -y will just assume yes for all questions.

An example can be thought like,

If some changes need to be made in a partition, fsck -y will just go ahead and assume yes and make the changes.

However, fsck -p will take the correct decision which can be either yes or no.

Ramesh
  • 38,687
  • 43
  • 140
  • 215
  • Actually `fsck` cannot make a *correct* decision (not even admins can in all cases); instead if chooses the presumably *safer* choice, and if it cannot decide what to do you still need to do a manual repair (delegating the decision to a human). In contrast `-y` will guarantee to exit with a "consistent" filesystem in more cases, possibly loosing some files that could be saved. To the safety hierarchy most likely is: (1) manual repair, (2) `-p`, (3) `-y` Some people don't care and just use `-y`, however. – U. Windl Jul 28 '23 at 13:33