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.