Welcome to Linux Knowledge Base and Tutorial
"The place where you learn linux"
Linux Magazine: The source for advanced Linux know-how

 Create an AccountHome | Submit News | Your Account  

Tutorial Menu
Linux Tutorial Home
Table of Contents

· Introduction to Operating Systems
· Linux Basics
· Working with the System
· Shells and Utilities
· Editing Files
· Basic Administration
· The Operating System
· The X Windowing System
· The Computer Itself
· Networking
· System Monitoring
· Solving Problems
· Security
· Installing and Upgrading
· Linux and Windows

Man Pages
Linux Topics
Test Your Knowledge

Site Menu
Site Map
Copyright Info
Terms of Use
Privacy Info
Masthead / Impressum
Your Account

Private Messages

News Archive
Submit News
User Articles
Web Links


The Web

Who's Online
There are currently, 76 guest(s) and 0 member(s) that are online.

You are an Anonymous user. You can register for free by clicking here




       badblocks [ -svwnf ] [ -b block-size ] [ -c blocks_at_once
       ] [ -i input_file ] [ -o output_file ] [ -p num_passes ] [
       -t test_pattern ] device [ last-block ] [ start-block ]


       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.  start-
       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.

       Important  note: If the output of badblocks is going to be
       fed to the e2fsck or mke2fs programs, it is important that
       the block size is properly specified, since the block num­
       bers which are generated are very dependent on  the  block
       size in use.   For this reason, it is strongly recommended
       that users not run badblocks directly, but rather use  the
       -c option of the e2fsck and mke2fs programs.


       -b block-size
              Specify the size of blocks in bytes.

       -c number of blocks
              is the number of blocks which are tested at a time.
              The default is 16.   Increasing  this  number  will
              increase  the efficiency of badblocks but also will
              increase its memory usage.  Badblocks needs  memory
              proportional  to  the  number  of  blocks tested at
              once, in read-only mode, proportional to twice that
              number  in  read-write  mode,  and  proportional to
              three times that number  in  non-destructive  read-
              write mode.  If you set the number-of-blocks param­
              eter to too  high  a  value,  badblocks  will  exit
              almost  immediately  with  an  out-of-memory  error
              "while allocating buffers".  If you set it too low,
              however,  for  a  non-destructive-write-mode  test,
              then it's possble for  questionable  blocks  on  an
              unreliable  hard  drive to be hidden by the effects
              of the hard disk track buffer.

       -f     Normally, badblocks will refuse to do a  read/write
              or  a  non-destructive  test  on  a device which is
              mounted, since  either  can  cause  the  system  to
              potentially crash and/or damage the filesystem even
              if it is mounted read-only.  This can be  overriden
              using  the -f flag, but should almost never be used
              dumpe2fs(8)  can  be  used  to retrieve the list of
              blocks currently marked bad on an existing filesys­
              tem, in a format suitable for use with this option.

       -o output_file
              Write the list of bad blocks to the specified file.
              Without this option, badblocks displays the list on
              its standard output.  The format of  this  file  is
              suitable  for  use by the -l option in e2fsck(8) or

       -p num_passes
              Repeat scanning the disk until  there  are  no  new
              blocks  discovered  in num_passes consecutive scans
              of the disk.  Default is 0, meaning badblocks  will
              exit after the first pass.

       -t test_pattern
              Specify  a test pattern to be read (and written) to
              disk blocks.   The test_pattern  may  either  be  a
              numeric  value between 0 and ULONG_MAX-1 inclusive,
              or the word  "random",  which  specifies  that  the
              block  should  be filled with a random bit pattern.
              For read/write (-w) and non-destructive (-n) modes,
              one  or  more  test  patterns  may  be specified by
              specifiying the -t option  for  each  test  pattern
              desired.   For read-only mode only a single pattern
              may be specified and it may not be "random".  Read-
              only testing with a pattern assumes that the speci­
              fied pattern has previously  been  written  to  the
              disk  -  if  not, large numbers of blocks will fail
              verification.  If multiple patterns  are  specified
              then  all blocks will be tested with an one pattern
              before proceeding to the next pattern.

       -n     Use non-destructive read-write  mode.   By  default
              only  a  non-destructive  read-only  test  is done.
              This option  must  not  be  combined  with  the  -w
              option, as they are mutually exclusive.

       -s     Show  the  progress  of the scan by writing out the
              block numbers as they are checked.

       -v     Verbose mode.

       -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.

       badblocks is part of the e2fsprogs package and  is  avail­
       able from http://e2fsprogs.sourceforge.net.


       e2fsck(8), mke2fs(8)

E2fsprogs version 1.34      July 2003                BADBLOCKS(8)



Security Code
Security Code
Type Security Code

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Help if you can!

Amazon Wish List

Did You Know?
You can choose larger fonts by selecting a different themes.


Tell a Friend About Us

Bookmark and Share

Web site powered by PHP-Nuke

Is this information useful? At the very least you can help by spreading the word to your favorite newsgroups, mailing lists and forums.
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters. Articles are the property of their respective owners. Unless otherwise stated in the body of the article, article content (C) 1994-2013 by James Mohr. All rights reserved. The stylized page/paper, as well as the terms "The Linux Tutorial", "The Linux Server Tutorial", "The Linux Knowledge Base and Tutorial" and "The place where you learn Linux" are service marks of James Mohr. All rights reserved.
The Linux Knowledge Base and Tutorial may contain links to sites on the Internet, which are owned and operated by third parties. The Linux Tutorial is not responsible for the content of any such third-party site. By viewing/utilizing this web site, you have agreed to our disclaimer, terms of use and privacy policy. Use of automated download software ("harvesters") such as wget, httrack, etc. causes the site to quickly exceed its bandwidth limitation and are therefore expressly prohibited. For more details on this, take a look here

PHP-Nuke Copyright © 2004 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.12 Seconds