Badblocks command
From NetworkStuff
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 |
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
Usage Examples
Usage Notes
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.
Typical Output
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
Related Files
The badblocks executable is normally found here: XXX
Related Commands
Related Articles
Information on other Linux commands
Information on F5 BigIP commands
Information on Cisco commands
Information on Windows commands
Information on Vyatta commands
Information on Extreme commands
Information on Nortel commands
Information on Zebra commands
Information on Secure Platform commands
Information on Blue Coat SGOS commands
Information on Nokia IPSO commands





