You are Here: FAQ ->Dedicated Servers->Linux Root Server->How To?->Article #15


How to run badblocks


Please note
Never use the -w option on a device containing an existing file system. This option erases data! If you want to do write-mode testing on an existing file system, use the -n option instead. It is slower, but it will preserve your data.


Tip
This tutorial is for servers that do not use raid or use software raid. If you are using hardware raid you will need to get the software from the card's manufacturer if not already installed. Running badblocks will most likely report an issue if there is an issue with one of the drives but you will not known which drive is bad. So, potentially run badblocks and if there is an error reported, install the associated software for the hardware raid controller card to determine the drive that is reporting errors. However, it may be a good idea to install the monitering software from the card's manufacturer in either case.


To print a list of drives in command line

fdisk -l

Read-only mode: This will test the drive and write the contents of that test into a text file named aa.txt The drive designation in these examples is an example. Specify a drive from the list printed by the fdisk command in place of /dev/sda which may actually be /dev/sda depending on your server. If you have more then 1 drive do not name both text files aa.txt

badblocks -o aa.txt -vs /dev/sda

This test can be done while in local mode.


Non-destructive read-write mode:

badblocks -o bb.txt -nvs /dev/sdb

Non-destructive read-write mode requires that the server be in rescue. Remember to dowload the text file created by this process as it will not exist after you boot the machine back into local mode.

Related articles:

How to boot the machine into the rescue system.
What is the recovery tool?

How to log into the machine over ssh as if you are logged in locally to the machine (not all system error messages are sent across a normal ssh connection).
Using PuTTY to Log onto the Serial Console


Print Article
How useful was this article?
(From 5 = Very Useful to 1 = Not useful at all):
1 2 3 4 5