However, the above command execution might take several hours to run depending on your disk partition size and health of your disk. sudo e2fsck -l bad_sectors.txt /dev/sda1įor other file systems (such as FAT32), you can use fsck. You can also specify the bad_sectors.txt file created in the earlier steps as well to force e2fsck to repair those in the file only via the below command. The “p” parameter repairs anything if possible and “v” is the verbose mode which gives you the terminal output of the command progress. The parameters “c” searches for bad blocks and add it to a list, “f” does a check on the file system. Make sure to replace sda1 with the proper device identifier. In the terminal run below command with admin privilege to check and repair. sudo badblocks -v /dev/sda1 > ~/bad_sectors.txt Repair Bad Sectorsįor ext2, ext3, and ext4 file systems, you can use e2fsck utility to check and repair bad sectors. This is just a verification whether you have bad sectors in the hard drive or not. And save the output to a text file for further investigation. Then you can run badblocks command as below with the verbose (-v) switch. Typically HDD should be defined as /dev/sda. If you are running above command via LIVE USB, make sure you can identify your HDD and USB stick. sudo lsblk -o name,mountpoint,label,size,uuid Otherwise, you can run below command (lsblk – List block devices) to view your disk partitions. If you have GParted installed, it is easy to find out. Scan for Bad SectorsĪs a first step, identify the disk partition which you want to scan for bad sectors. However, you can still run these commands in your installed Linux distribution but you should not scan or mark the mounted “/” root filesystem. You can create a LIVE USB using this guide with any Linux operating system of your choice (recommended: Ubuntu). Hence I would suggest, you try this using LIVE operating system boot from a USB stick. It is better to run below commands when your disk is not mounted with the operating system. In Linux (Ubuntu, Fedora, and other distributions), you can easily do this via below terminal commands. Hence, you should periodically scan your hard drive (especially aging ones) for bad sectors if you feel your system is slowing down, or, disk IO is increasing. However, there is still a huge number of hard disk drives in use today which is aging and might slowly start having bad sectors. Also if you have data stored in those areas of the hard drive, it is very difficult to recover those as well.Īlthough, the latest computer storage technology such as SSD, etc almost eliminates this problem. However, the operating system still can write to those sectors unless you specifically mark them as ‘bad’ or unusable. You can scan and mark them as unusable as well using these utilities.īad sectors or bad blocks are damaged portion of your mechanical hard disk drive which can not be used at all for data storing purposes. There are terminal utilities available in Linux which can help you to manage hard disk bad sectors.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |