to test and repair an ext2 file system in linux you can use this command i will give you

# e2fsck -y

the -y option helps to assume the answer of yest to all questions

for example, if you didnt put the -y option, you will be prompted to enter an answer at each prompt.