LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 05-05-2018, 04:55 PM   #1
Polazhinets.A
LQ Newbie
 
Registered: May 2018
Posts: 1

Rep: Reputation: Disabled
Badblocks rough check


Not sure if Linux-Newbie is the right place. Well, here is the problem..

I've hit my laptop a couple times and damaged currently used 160gb partition.
Now I'm on "Try Ubuntu without install" (from USB), doing the following:
# badblocks -wsv -o bblocks /dev/sdb7
to do this next:
# mkfs.ext4 -l bblocks /dev/sdb7
But the first step very much seems to take forever when it gets to place where error collecting begins.

I would like to do some kind of rough check, make 'badblocks' work some way like this:
once it gets on trouble with read/write/anything - consider all the 4096 blocks bad, write the correspoding info into bblocks text file and test the next 16mb (not spend much time at every single bad peace, keep moving from beginning to end at reasonable speed).

The question is: IS IT POSSIBLE?
 
Old 05-05-2018, 05:27 PM   #2
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth? I would say I hope so but I'm not so sure about that... I could just be a figment of your imagination too.
Distribution: CentOS at the time of this writing, but some others over the years too...
Posts: 2,025

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
Quote:
Originally Posted by Polazhinets.A View Post
Not sure if Linux-Newbie is the right place. Well, here is the problem..

I've hit my laptop a couple times and damaged currently used 160gb partition.
Now I'm on "Try Ubuntu without install" (from USB), doing the following:
# badblocks -wsv -o bblocks /dev/sdb7
to do this next:
# mkfs.ext4 -l bblocks /dev/sdb7
But the first step very much seems to take forever when it gets to place where error collecting begins.

I would like to do some kind of rough check, make 'badblocks' work some way like this:
once it gets on trouble with read/write/anything - consider all the 4096 blocks bad, write the correspoding info into bblocks text file and test the next 16mb (not spend much time at every single bad peace, keep moving from beginning to end at reasonable speed).

The question is: IS IT POSSIBLE?
You should start by telling us exactly what you want to do; for example, do you want to test Linux with the view to possibly installing it onto your laptop? Do you already have Linux installed? Do you have Windows currently installed?

You should make sure you understand what any command's options and indeed any command is going to do, before you run it.

If you've "hit and damaged" your laptop and think there could be damage to it's drive(s), you should check the hardware's health. The following command may give us some idea of that:

Code:
smartctl -a /dev/sdb
If your system says it cannot find "smartctl", install the package for it - it's usually called "smartmontools". And post the output using CODE tags.

It's taking "forever" because of the following from the man page for badblocks

Quote:
Originally Posted by badblocks man page
-w Use write-mode test. With this option, badblocks scans for bad blocks by writing some patterns
(0xaa, 0x55, 0xff, 0x00) on every block of the device, reading every block and comparing the con‐
tents. This option may not be combined with the -n option, as they are mutually exclusive.
You could likely write a script to make badblocks behave in the way you want.

Last edited by jsbjsb001; 05-05-2018 at 05:56 PM. Reason: a correction and addtions
 
Old 05-06-2018, 08:49 AM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 9,911
Blog Entries: 7

Rep: Reputation: 2438Reputation: 2438Reputation: 2438Reputation: 2438Reputation: 2438Reputation: 2438Reputation: 2438Reputation: 2438Reputation: 2438Reputation: 2438Reputation: 2438
Quote:
Originally Posted by Polazhinets.A View Post
But the first step very much seems to take forever when it gets to place where error collecting begins.
see the -b and -c options for badblocks, e.g. here.
 
Old 05-06-2018, 06:56 PM   #4
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,482

Rep: Reputation: 997Reputation: 997Reputation: 997Reputation: 997Reputation: 997Reputation: 997Reputation: 997Reputation: 997
Badblocks does take forever. If you damaged the drive, I wouldn't continue to use it. Drive manufacturers write utilities to check their own drives. You can run 'hdparm -I /dev//sda' to check the manufacturer. Then download the correct utility from their website and run it. It will take minutes instead of days to mark and relocate any bad blocks.
 
Old 05-07-2018, 04:26 AM   #5
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth? I would say I hope so but I'm not so sure about that... I could just be a figment of your imagination too.
Distribution: CentOS at the time of this writing, but some others over the years too...
Posts: 2,025

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
Why run "hdparm -I /dev//sda" when they can get the drive manufacturer's name from "smartctl" ? A/so, I think that should be "/dev/sdb" rather than "/dev//sda".

The "smartctl" command should give us some idea of the likely health status of their drive. When that was the whole point of me asking in post #2 for it.

If their drive has been damaged, then there's little point in running some drive manufacturer's utility software on it. As, depending on how damaged it is, it maybe better on the OP's part to buy a new drive instead. But, we won't know until they get back to us with their "smartctl" output.
 
Old 05-07-2018, 01:21 PM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 9,911
Blog Entries: 7

Rep: Reputation: 2438Reputation: 2438Reputation: 2438Reputation: 2438Reputation: 2438Reputation: 2438Reputation: 2438Reputation: 2438Reputation: 2438Reputation: 2438Reputation: 2438
Quote:
Originally Posted by ondoho View Post
see the -b and -c options for badblocks, e.g. here.
to clarify: specifying block and chunk sizes to something way larger than the default helps speed things up.
of course badblocks is still slow - because it's thorough, duh.
1.5h for one (old, slow) 250GB drive - it's bearable, imo, even if you count it up to, say, 1TB.
 
Old 05-07-2018, 03:28 PM   #7
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,482

Rep: Reputation: 997Reputation: 997Reputation: 997Reputation: 997Reputation: 997Reputation: 997Reputation: 997Reputation: 997
The manufacturer's drive utility will read the SMART registers, recommend a course of action, and repair the drive if possible. I had a drive that endured a mechanical shock while in a laptop. Smartctl reported that the drive was within 24 hours of failure.

I ran the Seagate drive tools diagnostic program on the drive, and it reported that it could repair the drive. In the process of repairing it, it reset the relevant SMART registers, so when I checked it again with smartctl it checked out OK.

The drive utility will also check the serial number to see if the drive is under warranty. If it is, and it cannot be repaired by the program, it will generate a RMA form, with accompanying instructions on how to return the drive for a replacement. It also has an option to wipe the drive before returning it.

Last edited by AwesomeMachine; 05-07-2018 at 03:30 PM.
 
Old 05-07-2018, 04:40 PM   #8
jefro
Moderator
 
Registered: Mar 2008
Posts: 18,559

Rep: Reputation: 2778Reputation: 2778Reputation: 2778Reputation: 2778Reputation: 2778Reputation: 2778Reputation: 2778Reputation: 2778Reputation: 2778Reputation: 2778Reputation: 2778
I tend to use the OEM diags. It's logical that they have the best means to diag since they have inside information.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
***** FILE SYSTEM WAS MODIFIED ***** on e2fsck -c (badblocks check) alpha01 Linux - Server 4 03-22-2012 06:35 PM
check for badblocks cccc Linux - Hardware 1 10-18-2008 02:02 PM
RAM badblocks check. bruse Linux - Newbie 2 07-11-2005 04:45 PM
Badblocks check in Linux ssampurna Red Hat 5 02-28-2005 02:27 AM
badblocks check... wrongman Linux - Hardware 3 05-20-2004 11:38 AM

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

All times are GMT -5. The time now is 01:55 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration