Running FSCK in single-user mode

Posted on 2006-04-04
Medium Priority
Last Modified: 2013-12-16
I have a FC3 system that is giving me disk errors. I'm new to linux and I know I need to run FSCK. I tried to do this by SSH'ing in, but then got the error that if I don't run FSCK in single-user mode I could corrupt the disk and/or files. So my question is, how do I start the system in runlevel1 ~ i.e. single-user mode.
I know that currently I'm using runlevel 5 (with the gui) how do I switch to single-user mode so I can run FSCK and repair any errors that there may be.
Thanks in advance!
Question by:chunkyshu
  • 2

Accepted Solution

wnross earned 1000 total points
ID: 16377934
use the init command:

1) open a terminal as root (su root)
2) type init 1
The system will shut down to a single command prompt.,  now you can run your disk commands.
WHen finished, type init 5 to restore the GUI

By the way, running fsck on mounted filesystems is a bad idea, try this instead

1) umount -a                   # unmount all filesystems except rootfs
2) mount / -oremount,ro   # now even root is ro, this is safe to use fsck on
3) fsck -a -f                      # force fsck to run on all drives
4) mount / -oremount,rw   # remount the rootfs again
5) mount -a                       # bring rest of filesystems back online
6) init 5 (or even better init 3)

Note:  if fsck says ** REBOOT LINUX **, always obey.

One final comment, I always prefer a integral system over a fast booting one, so add the following to the
file "/etc/sysconfig/autofsck", this file does not exist by default:

# Force autofsck in case of system failure

Now if the system reboots on you and the drives were not unmounted, an fsck is done by default.
Why this is not the builtin behavior is beyond me.

LVL 22

Expert Comment

ID: 16379530
Might be easier to do it from the consol instead of via ssh as in run mode 1, (init 1), you may find that ssh will not run (or at least is a lot of hassle to get running!) Also, if you need to run fsck on the partition that contains the operating system, you need to unmount the partition before you can carry out the fsck process.

To that end, I will normally boot from CD1 and usse rescue mode, or you could run a 'live distro' such as Knoppix and type:


at the linux: prompt. This will boot the live distro in single mode from which you can run fsck on the unmounted discs that you need to check/repair.



Author Comment

ID: 16382482
This worked perfectly... thanks for the help.

My disk showed now errors after running FSCK. Is there anything else I can try to check for "bad" things happening on the system?

Again, Thanks!

Expert Comment

ID: 16384279
fsck -f does a more thorough check than the boot fsck does, so you've got the filesystem checked

Check dmesg and /var/log/messages for
- IDE errors, DMA timeouts, etc.   (Check for bad cables)
- paging errors (bad ram)

check netstat -antp | more
start looking for ports open that you are not aware of, in particular if you see some ports without processes check pmap_dump and match up your extra ports with this list.

add to hosts.deny
sshd : all
add to hosts.allow
sshd: [dont do this, use YOUR ip address]

check by using ssh before closing your connection or you won't get back in if you make a mistake


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month13 days, 9 hours left to enroll

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question