Running FSCK in single-user mode

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!
chunkyshuAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

wnrossCommented:
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
#
AUTOFSCK_TIMEOUT=5
AUTOFSCK_DEF_CHECK=yes

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.

Cheer,
-Bill

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pjedmondCommented:
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:

single

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.

HTH:)

chunkyshuAuthor Commented:
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!
wnrossCommented:
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: 192.168.100.2 [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

Cheers,
-Bill
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.