Log in Go to the main page Page History Go to the file list Go to the site toolbox

Badblocks command

From NetworkStuff


Tux 64x64.png

A CLI command available on most some Cisco Extreme F5 BigIP Linux Nokia Blue Coat ProxySG platforms; used to... create, modify, display, administer or delete

Contents

Preferences-desktop-font-v2-22.png Usage Syntax

[options]

Common options include;

  • ' -
  • ' -
  • ' -
  • ' -
  • ' -

Read-only Test

This is a non-destructive read-only test which can be run on disk even if it contains a mounted filesystem. It simply verifies that each block can be read; it does not test for write errors.

   * sudo badblocks -s -v -c 10240 /dev/sdx
         o -s = show progress
         o -v = verbose mode
         o -c 10240 - check 10K blocks at a time

Read-write Test

This test is non-destructive read-write test which reads each block, writes it, then verifies it. It should not be used on block devices with mounted filesystems as it can lead to filesystem corruption.

   * sudo badblocks -n -s -v -c 10240 /dev/sdx
         o -n = non-destructive read-write mode
         o -s = show progress
         o -v = verbose mode
         o -c 10240 - check 10K blocks at a time

Write-mode Test

Using this command will erase all data on the device so only use it if that is what you want. This will write a few patterns to each block, verifying that each one is written and read correctly.

   * sudo badblocks -w -s -v -c 10240 /dev/sdx
         o -w = destructive write-mode test
         o -s = show progress
         o -v = verbose mode
         o -c 10240 - check 10K blocks at a time

Prepare a disk for encryption

The command will completely erase the data on a disk and replace it with random data. This is often a preferred way to prepare a disk for encryption as it is faster than other methods of filling a disk with random data and serves the purpose of checking the disk for errors before the encryption process.

   * sudo badblocks -w -t random -s -v -c 10240 /dev/sdx
         o -w = destructive write-mode test
         o -t random = write random data onto the disk
         o -s = show progress
         o -v = verbose mode
         o -c 10240 - check 10K blocks at a time

Vm-power-on-medium.png Usage Examples

Accessories-text-editor-v2-medium.png Usage Notes

Accessories-text-editor-v2-medium.png Linux Usage Notes

With most Linux or Unix commands;

  • Non root users may need to prefix commands with the sudo command, for example: sudo chmod 644 *
  • Brief help can be displayed using the -h or --help parameter, for example: chmod --help
  • A full command manual can be displayed using the man command followed by the command name, for example: man chmod
  • Sometimes 'info' pages are used instead of or to provide more information than man pages; for example: info chmod
  • Version information can normally be display using the -v, -V or --version parameter, for example: chmod --version. However, this paramater is also frequently used to display verbose output.

Utilities-terminal-medium-v2.png Typical Output

Insert-object-medium.png Installation

XXX can be installed or upgraded as follows, depending on your platform;

   * Ubuntu: apt-get install XXX 
   * Fedora Core: yum install XXX 
   * FreeBSD: pkg_add -v -r XXX 

Folder-medium.png Related Files

The badblocks executable is normally found here: XXX

Icemon-medium.png Related Commands

fsck command

Icemon-medium.png Related Articles

Information on other Linux commands Tux-small.png

Information on F5 BigIP commands F5-logo-small.png

Information on Cisco commands Cisco-logo-small.png

Information on Windows commands Preferences-system-windows-small.png

Information on Vyatta commands Vyatta-logo-small.png

Information on Extreme commands Extreme-logo-small.png

Information on Nortel commands Nortel-logo-small.png

Information on Zebra commands

Information on Secure Platform commands

Information on Blue Coat SGOS commands

Information on Nokia IPSO commands


Internet-group-chat-small.png We really do appreciate all feedback so please do send your comments, suggestions or corrections to steve#networkstuff.eu (replacing the # with an @)


Personal tools
This page was last modified on 9 March 2009, at 15:17. - Disclaimers - About Network Stuff
Powered by MediaWiki