shutdown -rF now

Force an fsck on reboot

Force an fsck on reboot. Useful on a system where / has mounted read-only because of file system issues.

2
By: SuperFly
2009-10-05 15:02:36

These Might Interest You

  • If the machine is hanging and the only help would be the power button, this key-combination will help to reboot your machine (more or less) gracefully. R - gives back control of the keyboard S - issues a sync E - sends all processes but init the term singal I - sends all processes but init the kill signal U - mounts all filesystem ro to prevent a fsck at reboot B - reboots the system Save your file before trying this out, this will reboot your machine without warning! http://en.wikipedia.org/wiki/Magic_SysRq_key


    106
    <alt> + <print screen/sys rq> + <R> - <S> - <E> - <I> - <U> - <B>
    dizzgo · 2009-02-20 07:28:56 10
  • Get out of jail for VMs that won't reboot. Warning: I have no idea why this works or what the implications of the 'destroy_domain' command are but this is how I'm recovering my hung VMs: xe vm-list Locate the UUID of broken VM by name. list_domains Locate ID of broken VM by UUID. destroy_domain -domid <ID> Destroy the domain. xe vm-reboot uuid=<UUID> --force Force a reboot of the VM.


    0
    /opt/xensource/debug/destroy_domain -domid <id>
    rik · 2012-02-23 11:21:49 0
  • To check the total number of mounts, maximum number of mounts before performing the fsck and last time when the fsck was performed. Show Sample Output


    0
    dumpe2fs -h /dev/xvda1 | egrep -i 'mount count|check'
    manju712 · 2014-10-22 08:38:43 0
  • Nothing fancy, just a regular filesystem scan that calls the badblocks program and shows some progress info. The used options are: -c ? check for bad sectors with badblocks program -D ? optimize directories if possible -f ? force check, even if filesystem seems clean -t ? print timing stats (use -tt for more) -y ? assume answer ?yes? to all questions -C 0 ? print progress info to stdout /dev/sdxx ? the partition to check, (e.g. /dev/sda1 for first partition on first hard disk) NOTE: Never run fsck on a mounted partition!


    10
    fsck.ext4 -cDfty -C 0 /dev/sdxx
    mtron · 2011-05-18 13:13:29 0
  • This will cause your machine to INSTANTLY reboot. No un-mounting of drives or anything. Very handy when something has gone horribly wrong with your server in that co-location facility miles away with no remote hands! Suspect this works with all 2.2, 2.4 and 2.6 Linux kernels compiled with magic-syskey-request support.


    7
    echo 1 > /proc/sys/kernel/sysrq; echo b > /proc/sysrq-trigger
    tsaavik · 2009-02-20 00:37:18 1
  • Sometimes we may want to run a script when a system reboots . We can simply do this by just scheduling the script using vixie cron with the @reboot option . e.g @reboot I use it to send me an alert message on our prod hosts to send an alert message when the system reboots . @reboot zaman uptime | echo `uptime` | mail -s "`uname -n` got rebooted" me@myhost.com


    15
    @reboot <yourscript.sh>
    bzaman · 2010-08-23 10:37:44 0

What Others Think

doesn't work with upstart. use touch /forcefsck
Escher · 450 weeks and 2 days ago
Can't use "touch /forcefsck". Root file system is mounted read-only due to disk problems. Cannot write to /. Cannot "mount -o remount,rw /" either. What now? :)
SuperFly · 450 weeks and 2 days ago
at grub boot screen, hit 'a', append 'init=/bin/sh', after booting into shell you should be able to do the fsck, or do the remount and touch /forcefsck also try single user mode (just append '1')
Escher · 450 weeks and 1 day ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: