LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-09-2006, 11:13 AM   #1
ratnesh1
LQ Newbie
 
Registered: Jan 2006
Location: Bangalore
Posts: 10

Rep: Reputation: 0
check disk


hi,
i use fc3 .... whenever i have an improper shutdown....the next time it boots ...it asks to press "Y" for checking disk.But it doesnt check ...instead the computer gets hanged.

Can anyone suggest me how to scan the disk after booting is over....in command line.
(similar to chkdsk/f...in windows)

thanks in advance
 
Old 01-09-2006, 11:26 AM   #2
alienDog
Member
 
Registered: Apr 2004
Location: Europe
Distribution: Debian, Slackware
Posts: 505

Rep: Reputation: 48
The program that checks disks in Linux is called fsck (FileSystemChecK), but you shouldn't run it on mounted filesystems. Unmount filesystems and then run fsck /dev/xxxx for all your partitions. Unfortunately you will not be able to run it on root filesystem as it will be mounted when the system is booted up.

What filesystem(s) are you using on your system? Fsck will not be necessary for journaled filesystems (ext3, reiserfs, xfs and such), replaying the journal will be enough (it's done automatically upon mounting).
 
Old 01-11-2006, 07:11 AM   #3
ratnesh1
LQ Newbie
 
Registered: Jan 2006
Location: Bangalore
Posts: 10

Original Poster
Rep: Reputation: 0
I have ext3 on all the linux partitions. Along with that i have mounted a vfat windows partition.
Do you suggest that no scaning of this partions are required even though there was a improprer shutdown.

thanks
 
Old 01-11-2006, 09:41 AM   #4
alienDog
Member
 
Registered: Apr 2004
Location: Europe
Distribution: Debian, Slackware
Posts: 505

Rep: Reputation: 48
Not even after improper shutdown. ext3 keeps a journal that will get replayed after an improper shutdown but it can be hard to notice as it will only take a few seconds. However I do not know why your machine hangs upon checking disks as it should be quite possible to check ext3 partitions if you like. Vfat filesystems won't get checked under linux. There is fcsk.vfat (or something like that), but it does nothing.

Last edited by alienDog; 01-11-2006 at 09:43 AM.
 
Old 01-11-2006, 09:50 AM   #5
spivy66
LQ Newbie
 
Registered: Nov 2004
Posts: 29

Rep: Reputation: 15
I have the same problem. My linux box boots up fine but I know theres something wrong with the hard drive. Iran fsck and it said its not recommand to run while hda1 is mounted. My question is how do I unmount it?( i thouhgt you cannot umount it while its your signon).. Should i boot from a cd and then run it. i'm new at this any helps and steps would be great..
 
Old 01-11-2006, 10:03 AM   #6
alienDog
Member
 
Registered: Apr 2004
Location: Europe
Distribution: Debian, Slackware
Posts: 505

Rep: Reputation: 48
Your machine hangs upon fsck on boot also? Do you have the same distribution as ratnesh1? If you don't have the hanging problem and just want the disk checked, you can reboot your machine with:

shutdown now -rF

What is it that makes you think there is something wrong with your hard drive? Booting up from cd and checking the disks then (without mounting them ofcourse) will work fine.

--edit--

Startup scripts seem to run fsck for root partition when it's mounted read-only and then continue according to the errorlevel that fsck returns. I suppose you could go to single user mode:

telinit 1

remount the root partition read-only:

mount -n -o remount,ro /

at this point you could try to write something to the disk just to make sure it really is readonly (it will still show up as rw on /etc/mtab because mtab can't be written with the partition being read only)

then run fsck for the partition and after that remount the filesystem back rw:

mount -o remount,rw /

and return to your preferred runlevel:

telinit 3 (4 or 5, if you use GDM, XDM, KDM or something like that)

or you could just reboot the machine after the check. I DO NOT KNOW HOW SAFE THIS IS THOUGH! I don't take any blame if you trash your root partition with this Anyway it's more or less the way that startup scripts do it, so I would think it's an acceptable way.

Last edited by alienDog; 01-11-2006 at 10:39 AM.
 
Old 01-11-2006, 12:40 PM   #7
spivy66
LQ Newbie
 
Registered: Nov 2004
Posts: 29

Rep: Reputation: 15
I did what you told me shutdown now -rF. After the reboot it look like it was doing something . But i dont think it fixed any thing. Te reason why iam doing htis and i know theres a problem with the HD is cause the machine crashed 1 or two times. So I took took it apond my self to do a disk image with ghost and while copiing i got a read sector error. So i wanted to check the disk and fisk the errors so that when i do the disk copy all the bad blocks will be fixed and my data will be move out of thoes bad block so the copied can go throught. So anyays after it rebooted ,i tried again and still having issues doing the disk copy. Is there a log i can check to see rusults of the copy? I have not yet tried to boot from cd yet.. thanks for your help
 
Old 01-11-2006, 02:51 PM   #8
alienDog
Member
 
Registered: Apr 2004
Location: Europe
Distribution: Debian, Slackware
Posts: 505

Rep: Reputation: 48
It has been fixed if it was a logical problem, I'm sure. However if it's a hardware problem there is really nothing that fsck can do about it. If you have bad sectors on disk I suggest replacing the disk. Usually you get some more in a very short period of time and sooner or later the disk will fail, it's not safe to use it anymore. I think what you're experiencing is your disk nearing the end of it's lifetime.
 
Old 01-11-2006, 03:03 PM   #9
spivy66
LQ Newbie
 
Registered: Nov 2004
Posts: 29

Rep: Reputation: 15
yes. I also read about something called badblocks? I would like to run this program as well but i'm to to clear on how to this. maybe you can provide me with the steps. I apresheate all your help. I'm running redhat just to let you know. I think this badblocks program might help,so before i get rid on the HD I would like to try this.Tanks again
 
Old 01-11-2006, 05:57 PM   #10
alienDog
Member
 
Registered: Apr 2004
Location: Europe
Distribution: Debian, Slackware
Posts: 505

Rep: Reputation: 48
I have never user badblocks, so I'm unable to help you with that, sorry It seems to have a good manual page, though, so I think you'll do fine if you read that (man badblocks).

--edit--

Oh, on the manpage it says:

it is strongly recommended that users not run badblocks directly, but
rather use the -c option of the e2fsck and mke2fs programs.

so use fsck to do that.

Last edited by alienDog; 01-11-2006 at 05:58 PM.
 
Old 01-13-2006, 11:54 PM   #11
ratnesh1
LQ Newbie
 
Registered: Jan 2006
Location: Bangalore
Posts: 10

Original Poster
Rep: Reputation: 0
thanks alien for those info.......

another thing i would like to ask is ...how to control that "updatedb"
It takes 100% cpu when i will be working and creates problem.

thanks
 
Old 01-14-2006, 08:46 AM   #12
alienDog
Member
 
Registered: Apr 2004
Location: Europe
Distribution: Debian, Slackware
Posts: 505

Rep: Reputation: 48
If it's started from the cron script, you can "nice" if from the script. Most likely it's /etc/cron.daily/slocate or /etc/cron.daily/updatedb. Open the file in your text editor and add:

nice -19

to the beginning of the line that says /usr/sbin/updatedb. This will give it lower priority when it runs. Note that if you are not running anything else, it can still occupy 100% of your CPU. Afterall there is no point in having partially idle CPU when there is a job to be done.

Btw. You should post new thread for new questions unrelated to your original. It makes it easier for the people with similar problems to find the relevant threads in the future.

Last edited by alienDog; 01-14-2006 at 08:54 AM.
 
Old 01-26-2006, 08:37 AM   #13
ratnesh1
LQ Newbie
 
Registered: Jan 2006
Location: Bangalore
Posts: 10

Original Poster
Rep: Reputation: 0
thanks alein..will keep this in mind the next time i post
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Yum - check for disk space maimonoded Linux - Software 0 03-31-2005 09:23 AM
how to check disk SlipAway172 Mandriva 2 03-01-2005 03:16 AM
Disk check question XPediTioN Slackware 2 06-23-2004 09:07 AM
Boot disk; check. CD in drive; check. Doesn't work; check. Hal DamnSmallLinux 7 02-04-2004 02:10 AM
Forced disk check nabil Linux - General 7 05-25-2001 12:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration