11

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?

1 Answer 1

17

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.

2
  • 2
    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
    Commented Jul 28, 2023 at 13:33
  • Let's say I have no idea how to "manually repair" a filesystem.. I mean.. are there books about that stuff or does it take like 10 years to learn anyways?
    – dersimn
    Commented Dec 14, 2023 at 0:22

You must log in to answer this question.

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