UbuntuLinux system check and repair of hard disk bad sectors

Source: Internet
Author: User
Recently, the next 1 TB hard disk has been removed from the server, but it does not work well on the server. Therefore, you must first check whether the hard disk has bad channels. The disk utility provided by ubuntu is a very intuitive tool for viewing the health status of the hard disk. However, if you prefer the command line like me, take a look at the badblocks command. Check whether you have

Recently, the next 1 TB hard disk has been removed from the server, but it does not work well on the server. Therefore, you must first check whether the hard disk has bad channels.

The disk utility provided by ubuntu is a very intuitive tool for viewing the health status of the hard disk.

However, if you prefer the command line like me, take a look at the badblocks command.

Check whether the disk you want to check has been detached. if it is useless, umount it.

Read-only detection for the entire disk:


Sudo badblocks-s-v-c 32/dev/sdb

Because the disk needs to be detected, the speed is very slow. during the detection process, be sure not to perform power outages, do not perform any operations on the hard disk, do not remove the hard disk, do not cause physical damage, do not vibrate, and so on.

The detection process can be terminated midway through, or the block can be specified to start again.


Sudo badblock-s-v-c 32/dev/sd * 976762583 125637824 (note that the ending block is before and the starting block is behind)

Badblocks usage

Syntax:

Badblocks [-svw] [-B <block size>] [-o <output file>] [disk device] [number of disk blocks] [start Block]

Parameters:

-B <block size> specifies the disk block size, in bytes.

-O <output file> writes the check result to the specified output file.

-C <check block count> The number of blocks for each detection. The default value is 16. Adding this quantity can increase the efficiency of the detection block and increase the memory consumption.

-S shows the progress during the check.

-V displays detailed information during execution.

-W performs a write test during the check.

[Disk device] specifies the disk device to be checked.

[Number of disk blocks] total number of blocks of the specified disk device.

[Start Block] specifies the block from which the check starts.

Repair bad track

If it's just a logical bad track, you can

Direct fsck

Or format

If it is a physical bad track, you are really miserable. You need

A. Back up hard disk data

B. delete all hard disk partitions

C. estimate the occupied space based on the location and size of the bad block. Then partition and isolate the damaged parts. Btw: Bad Channels will spread, so try to isolate as much space as possible.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.