3

I have tried the following with both LinuxMint 13 Cinnamon 32 bit and Trisquel 7.0 Gnome 32 bit and get the same error message:

$ yes | sudo e2fsck /dev/sdax
e2fsck 1.42 (29-Nov-2011)
e2fsck: need terminal for interactive repairs

In each case, the partition /dev/sdax was not mounted.

Is it not possible to use yes with e2fsck?

  • yes - output a string repeatedly until killed what is the reason to use it here? – Costas Jan 20 '15 at 12:06
  • 3
    Based on the error message, I guess it insists on a terminal. Could you trick it in order to be able to use yes with it? Maybe, but you don't need to: it already has a -y option that does the same thing. – Celada Jan 20 '15 at 12:06
  • @Costas: I'd much rather have a program keep feeding 'y' to e2fsck than having to type it over and over again when there are file system errors. – Don Nadie Jan 22 '15 at 16:32
12

If you are sceptical whether e2fsck -y works for you next time, coins might help.

enter image description here

I used to use this trick when there were no yes or -y or equivalent options in MS-DOS.

1

Try using

sudo e2fsck -y /dev/sdax
  • 2
    The first solution is exactly equivalent to the nonworking example in the question (other than outputting "yes" instead of "y," which won't make any difference in this case). – Doorknob Jan 20 '15 at 14:39
  • Yes, I have expected that but I couldn't check it on my drive. But sometimes small details make difference. – Szymon Roziewski Jan 20 '15 at 15:57
  • In the future, I'll try e2fsck -y /dev/sdax but really won't know if it does what I want until the next time I have file system errors and e2fsck repeatedly asks me if I want to perform its suggested fixes. e2fsck can suggest a lot of fixes when a file system is messed up; I just don't want to type 'y' over and over again when there are lots of errors. – Don Nadie Jan 22 '15 at 16:42
  • this answer is too short and is not adding anything to the previous answer – aliceinwire May 12 '17 at 10:52
0

You can try also:

sudo e2fsck -p /dev/sdax

See man e2fsck for description of all arguments.

  • This is something, but it’s not what the question is asking for. – G-Man Jul 4 '18 at 20:54
0

i had to enter "n" (don't abort) before "yes", so i used script:

(echo n; yes) | script --return -c "e2fsck /dev/sda1"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.