how to do I force-yes on fsck

28,469

Solution 1

The answer to your question is here How can I make fsck run non-interactively at boot time?

To force ubuntu to fix all disk errors at boot you need to add FSCKFIX=yes to the file /etc/default/rcS. This tells fsck to run with the -y flag.

Solution 2

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 ;)

Share:
28,469

Related videos on Youtube

richmb
Author by

richmb

Updated on September 18, 2022

Comments

  • richmb
    richmb over 1 year

    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.

  • richmb
    richmb about 9 years
    Is there a way I can disable time related fsck errors?
  • richmb
    richmb about 9 years
    setting FSCKFIX=yes in /etc/default/rcS seems to correct my issue. Is this a sensible approach?
  • Panther
    Panther about 9 years
    If you have to run fsck it is more likely then not an indication your hard drive is failing. Look at the links I gave you on data recovery and smartmontools. Back up any data you value.