LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-05-2010, 12:03 PM   #1
Timmi
Member
 
Registered: Apr 2009
Distribution: under review
Posts: 230

Rep: Reputation: 19
Fix disk surface


I am looking for the Linux equivalent to deep scan and repair a hard disk surface (bad sectors). Preferably a program with a GUI that I can install from Ubuntu repositories and run myself, but I'll go into terminal if I have to.

Backgrounder:

Recently, my laptop's fan quit.
(maybe dust accumulation or something, because eventually I got it to start turning again by simply prodding through the vent holes with a toothpick).

It would overheat, and go into emergency immediate shutdown at 255 degrees.

This created LOTS of bad sectors on my hard disk. I am way above the "normal OK" threshold of 100, at about 800. "S.M.A.R.T." thinks my hard disk is bad, and tells me it's about to fail, replace immediately, and hit F1 to continue each time I boot.

I am about certain my hard disk is just fine, as these bad sectors only appeared and multiplied after several overheating shutdowns.

In MS-DOS, we used to run the command "FDISK C: /F" (/f was to fix bad sectors and if bad to permanently exclude them from a format so they are skipped and not used or seen).

How can this be done in Linux?

GParted does not appear to do this: it is way too fast to delete and recreate a partion to be doing any deep surface scanning and repairing. It's a quick MBR write and quick format at best.
 
Old 04-05-2010, 12:15 PM   #2
Bratmon
Member
 
Registered: Jul 2009
Location: 75.126.162.205:80
Distribution: Arch / Mint 17
Posts: 297
Blog Entries: 3

Rep: Reputation: 50
The command line utility you want is "fsck". There might be a frontend somewhere you can use, but I don't know of any.
 
Old 04-05-2010, 01:13 PM   #3
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,
Quote:
Originally Posted by Bratmon View Post
The command line utility you want is "fsck". There might be a frontend somewhere you can use, but I don't know of any.
'fsck' is the frontend!

Quote:
excerpt from 'man fsck';
fsck - check and repair a Linux file system
SYNOPSIS
fsck [ -sAVRTNP ] [ -C fd ] [ -t fstype ] [filesys ... ] [--] [ fs-specific-options ]
DESCRIPTION
fsck is used to check and optionally repair one or more Linux file systems. filesys can be a device name (e.g. /dev/hdc1, /dev/sdb2), a mount point (e.g. /, /usr, /home), or an ext2 label or UUID specifier (e.g. UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root). Normally, the fsck program will try to run filesystems on different physical disk drives in parallel to reduce total amount time to check all of the filesystems.

If no filesystems are specified on the command line, and the -A option is not specified, fsck will default to checking filesystems in /etc/fstab serial. This is equivalent to the -As options.

The exit code returned by fsck is the sum of the following conditions:
0 - No errors
1 - File system errors corrected
2 - System should be rebooted
4 - File system errors left uncorrected
8 - Operational error
16 - Usage or syntax error
32 - Fsck canceled by user request
128 - Shared library error
The exit code returned when multiple file systems are checked is the bit-wise OR of the exit codes for each file system that is checked.

In actuality, fsck is simply a front-end for the various file system checkers (fsck.fstype) available under Linux. The file system-specific checker is searched for in /sbin first, then in /etc/fs and /etc, and finally in the directories listed in the PATH environment variable. Please see the file system-specific checker manual pages for further details.
 
1 members found this post helpful.
Old 04-05-2010, 01:15 PM   #4
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

To the OP. You might want to look at the drive manufactures utilities.
 
0 members found this post helpful.
Old 04-05-2010, 01:26 PM   #5
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
There is also badblocks.
Read the manpage for the available options.

Regards
 
Old 04-06-2010, 01:24 PM   #6
Timmi
Member
 
Registered: Apr 2009
Distribution: under review
Posts: 230

Original Poster
Rep: Reputation: 19
Thanks guys. I'm not home right now to try this out, but I am under the initial impression this isn't exactly what I am looking for:

I really need to do a low-level format. To wipe out any (erroneous) tagging of bad sectors, re-test that surface and prepare it PRIOR to formatting (also called a low-level format), then format with the final file system.

In MS-DOS we could identify and quarantine bad sectors so the format command skips over them. So the "chkdsk /f" was to fix the surface, to prep it, PRIOR to formatting. It also resets incorrectly labelled bad sectors by the OS on a formatted partition.

Riht now after several sudden shutdowns due to overheating many sectors were mislabeled by the OS, and this error has not gone away after reformatting it several times.

So what I am looking for, is something for a low-level format, throw-out any existing parameters, and to re-check that surface, prior to formatting - not the high-level format that is happening now.

Forgive me if my terminology is off or mislead, as I am using old knowledge that may be different in Linux filesystems.
 
Old 04-06-2010, 02:00 PM   #7
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

Your not wanting to do a low level then just a creation of a a filesystem with badblocks check.

If your testing the disk integrity then you should use the manufactures disk utilities.
 
Old 04-06-2010, 04:20 PM   #8
Timmi
Member
 
Registered: Apr 2009
Distribution: under review
Posts: 230

Original Poster
Rep: Reputation: 19
Quote:
Originally Posted by onebuck View Post
If your testing the disk integrity then you should use the manufactures disk utilities.
Yes I read that, thanks, but Toshiba doesn't seem to offer a manufacturer's utility for LINUX to check the integrity of the disks in their notebooks. I'm not even sure what model hdd is in there to begin with. In MS-DOS this would not have been an issue.
 
Old 04-06-2010, 04:38 PM   #9
Timmi
Member
 
Registered: Apr 2009
Distribution: under review
Posts: 230

Original Poster
Rep: Reputation: 19
Thanks @onebuck.
fsck responds it wants an ext2 filesystem. my first partition is a fat32.
 
Old 04-06-2010, 04:42 PM   #10
Timmi
Member
 
Registered: Apr 2009
Distribution: under review
Posts: 230

Original Poster
Rep: Reputation: 19
Quote:
Originally Posted by onebuck View Post
If your testing the disk integrity then you should use the manufactures disk utilities.
Toshiba doesn't offer manufacturers dist utilities for Linux. Under MS-DOS that was never an issue ("chkdsk /f").
 
Old 04-06-2010, 04:48 PM   #11
Timmi
Member
 
Registered: Apr 2009
Distribution: under review
Posts: 230

Original Poster
Rep: Reputation: 19
Quote:
Originally Posted by bathory View Post
Read the manpage for the available options.
Good idea. Why not take it a step further, post a big notice on the startpage of linuxquestions reading: "attention newbies: go away! read manpages, and when you are linux-fluent, come back!". Lets keep Linux to the geeks, and keep the former windows users where they belong, back in the windows world.
 
Old 04-06-2010, 04:55 PM   #12
Timmi
Member
 
Registered: Apr 2009
Distribution: under review
Posts: 230

Original Poster
Rep: Reputation: 19
Quote:
Originally Posted by onebuck View Post
Your not wanting to do a low level then just a creation of a a filesystem with badblocks check.
ou can look at 'Linux Command Guide' or 'Ultimate Linux Newbie Guide' to assist with system work.
Thanks for those, but:

Ultimate Linux Newbie Guide will gladly tell me the difference between Unix and Linux, but a search on "badblocks" comes up empty.

In the Linux Command Guide, it says that badblocks is a command for high-density (1.44MB) floppies. Not quite what I had in mind.
 
Old 04-06-2010, 05:03 PM   #13
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Quote:
Originally Posted by Timmi View Post
Toshiba doesn't offer manufacturers dist utilities for Linux. Under MS-DOS that was never an issue ("chkdsk /f").
In my experience, manufacturers disk utilities are OS-independent -- they are standalone tools that you burn to a CD or otherwise put onto a removable media, and boot. The installed OS has no bearing on these tools.

One thing I'd like to point out, is that repeatedly mentioning "..in MSDOS this is not an issue.." will not further your cause; We aren't dealing with MSDOS here.

Being encouraged to read the manpages for a tool or command, is not an insult or a brush-off -- the suggestion is so that maybe you will see the functionality you desire, IN the man pages, and if so, you now know what tool & options you need to do/use, and can ask for more specific help using that tool/options.

The man page for `mkfs` (a direct relation to mke2fs) indicates that it can also make MSDOS or FAT filesystems, and when used with the -c option, will do a bad-blocks check before building the filesystem on the device. Perhaps this is what you would like?

Kind regards,
Sasha
 
1 members found this post helpful.
Old 04-07-2010, 12:32 AM   #14
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
In the Linux Command Guide, it says that badblocks is a command for high-density (1.44MB) floppies. Not quite what I had in mind.
I cannot tell what guide you read, but here is what the manpage you didn't read says:
Quote:
DESCRIPTION
badblocks is used to search for bad blocks on a device (usually a disk partition). device is the special file corresponding to the device (e.g /dev/hdc1). last-block is the last block to be checked; if it is not specified, the last block on the device is used as a default. first-block is an optional parameter specifying the starting block number for the test, which allows the testing to start in the middle of the disk. If it is not specified the first block on the disk is used as a default.
So you can run
Code:
badblocks /dev/hda
assuming hda is your disk, to mark the bad blocks.
 
1 members found this post helpful.
Old 04-07-2010, 01:18 PM   #15
brucehinrichs
Member
 
Registered: Mar 2008
Location: US
Distribution: Debian Sid; Sabayon, UbuntuStudio, Slackware-multilib 13.1, Peppermint Ice, CentOS
Posts: 575

Rep: Reputation: 69
Timmi, I suggest you read http://linux.oneandoneis2.org/LNW.htm

Post #1:
Quote:
In MS-DOS, we used to run the command "FDISK C: /F" (/f was to fix bad sectors and if bad to permanently exclude them from a format so they are skipped and not used or seen).
Post #6:
Quote:
In MS-DOS we could identify and quarantine bad sectors so the ...
Post #8:
Quote:
In MS-DOS this would not have been an issue.
Post #10:
Quote:
Under MS-DOS that was never an issue ("chkdsk /f").
I suggest this not to insult, but to help you realize that linux is not a "better windows", but it is a replacement OS that is better. It is different.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What can I surface scan a hard disk with under Linux? lectraplayer Linux - Software 8 07-10-2009 01:38 PM
MBR Fix when Rescure Disk Not Available SGlassman Linux - General 2 07-31-2008 02:20 PM
How does one test the disk surface of the swap partition? gregmcavoy Linux - Hardware 22 01-17-2005 01:59 AM
Use rescue disk to fix x problem? General Dude Linux - Newbie 2 08-14-2003 12:34 PM
Disk Surface Scan Routine - Quickie! Svha Linux - Hardware 2 08-08-2003 02:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:12 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