Ubuntu: how to do I force-yes on fsck



Question:

I have bunch of headless ubuntu server instruments. When various hardware changes happen sometimes we get this error. I'm guessing it was a motherboard replacement that had a slightly different RTC in this case.

fsck from util-linux 2.20.1  /dev/sda1: Superblock last mount time (Web Feb 18 09:02:07 2015,          now = Sun Jan 19 19:33:44 2014) is in the future.    /dev/sda1: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.          (i.e., without -a or -p options)  mountall: fsck / [292] terminated with status 4  mountall: Filesystem has errors: /    Errors were found while checking the disk drive for /.  Press F to attempt to fix the errros, I to ignore, S to skip mounting, or M for manual recovery  

Pressing F resolves the disk problem(I still have a changed RTC issue but that can be solved separately), but I'd rather not have to have a software engineer standing next to every instrument that has a board change on it, especially if it can fix itself.

Is there a way I can have the system do a "force-yes" or allways try to fix options. If so where would I make this change.


Solution:1

As the message states :

fsck -p /dev/sda1  fsck -py /dev/sda1  

-a attempts to repair any problems ,

See man fsck or https://wiki.archlinux.org/index.php/fsck for details

-a Automatically repair the file system without any questions (use this option with caution). Note that e2fsck(8) supports -a for backwards compatibility only. This option is mapped to e2fsck's -p option which is safe to use, unlike the -a option that some file system checkers support.

-y For some filesystem-specific checkers, the -y option will cause the fs-specific fsck to always attempt to fix any detected filesystem corruption automatically. Sometimes an expert may be able to do better driving the fsck manually. Note that not all filesystem-specific checkers implement this option. In particular fsck.minix(8) and fsck.cramfs(8) does not support the -y option as of this writing.

If those options do not resolve the problem, then you have to run it "manually", review the output, and attempt a manual repair.

In practice, if the -a / -p option does not work, often there is a hardware problem and you may be looking at data recovery

https://help.ubuntu.com/community/DataRecovery

If -ay or -py does not work, I often advise you replace the hard drive and seek professional help for data recovery.

You can attempt data recovery yourself, but, take care as you can also make the problem worse if you do not understand the options with the recovery tools. Start with the data recovery page I linked, and read ALL of it before you do anything else.

You can also run smartmontools

https://help.ubuntu.com/community/Smartmontools

Run from a live CD ;)


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »