How can I correct logical bad sectors in HDD in Ubuntu?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
0
down vote

favorite
1












During boot time I found that my hard disk had logical errors in different sectors. I did my research and ran this command:



sudo badblocks -sv /dev/sda1 > bad-blocks-result


This command created a file in my home directory called 'bad-blocks-result' which contains a series of numbers, which I guess are bad sectors.



What procedure should I follow next to correct my hard disk?










share|improve this question



























    up vote
    0
    down vote

    favorite
    1












    During boot time I found that my hard disk had logical errors in different sectors. I did my research and ran this command:



    sudo badblocks -sv /dev/sda1 > bad-blocks-result


    This command created a file in my home directory called 'bad-blocks-result' which contains a series of numbers, which I guess are bad sectors.



    What procedure should I follow next to correct my hard disk?










    share|improve this question

























      up vote
      0
      down vote

      favorite
      1









      up vote
      0
      down vote

      favorite
      1






      1





      During boot time I found that my hard disk had logical errors in different sectors. I did my research and ran this command:



      sudo badblocks -sv /dev/sda1 > bad-blocks-result


      This command created a file in my home directory called 'bad-blocks-result' which contains a series of numbers, which I guess are bad sectors.



      What procedure should I follow next to correct my hard disk?










      share|improve this question















      During boot time I found that my hard disk had logical errors in different sectors. I did my research and ran this command:



      sudo badblocks -sv /dev/sda1 > bad-blocks-result


      This command created a file in my home directory called 'bad-blocks-result' which contains a series of numbers, which I guess are bad sectors.



      What procedure should I follow next to correct my hard disk?







      boot grub2 hard-drive fsck badblocks






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 10 '14 at 18:40









      TRiG

      1,38211331




      1,38211331










      asked Dec 10 '14 at 17:45









      user2650973

      83115




      83115




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          For each bad block number, first use dd to verify that it is bad ( and you didn't make some mistake somewhere ):



          sudo dd if=/dev/sda1 skip=##### count=1 of=/dev/null iflag=direct bs=1024


          If that comes back with an error, then you are looking in the right spot.. now it's time to correct it:



          sudo dd if=/dev/zero of=/dev/sda1 seek=###### count=1 oflag=direct bs=1024


          If the second comes back without an error, you should be able to retry the first command and it should also now not error. Repeat for each bad block number listed in the file.



          Make sure to type the commands exactly as shown ( substituting the block number for the #### ) or you can destroy your data



          You also might want to run sudo smartctl -a /dev/sda to read the SMART status of the drive. Of note are the raw values for the reallocated count and pending. If you fixed all of the bad sectors, the pending count will have returned to zero. If they were remapped, the reallocated count will have gone up. If this is more than a handful you probably want to replace the drive as it is likely to get worse. If the reallocated count didn't go up, then there is nothing physically wrong with the drive.



          At this point you also should boot into rescue mode and run a full fsck on the volume to make sure that checks out.






          share|improve this answer




















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "89"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f558923%2fhow-can-i-correct-logical-bad-sectors-in-hdd-in-ubuntu%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote



            accepted










            For each bad block number, first use dd to verify that it is bad ( and you didn't make some mistake somewhere ):



            sudo dd if=/dev/sda1 skip=##### count=1 of=/dev/null iflag=direct bs=1024


            If that comes back with an error, then you are looking in the right spot.. now it's time to correct it:



            sudo dd if=/dev/zero of=/dev/sda1 seek=###### count=1 oflag=direct bs=1024


            If the second comes back without an error, you should be able to retry the first command and it should also now not error. Repeat for each bad block number listed in the file.



            Make sure to type the commands exactly as shown ( substituting the block number for the #### ) or you can destroy your data



            You also might want to run sudo smartctl -a /dev/sda to read the SMART status of the drive. Of note are the raw values for the reallocated count and pending. If you fixed all of the bad sectors, the pending count will have returned to zero. If they were remapped, the reallocated count will have gone up. If this is more than a handful you probably want to replace the drive as it is likely to get worse. If the reallocated count didn't go up, then there is nothing physically wrong with the drive.



            At this point you also should boot into rescue mode and run a full fsck on the volume to make sure that checks out.






            share|improve this answer
























              up vote
              1
              down vote



              accepted










              For each bad block number, first use dd to verify that it is bad ( and you didn't make some mistake somewhere ):



              sudo dd if=/dev/sda1 skip=##### count=1 of=/dev/null iflag=direct bs=1024


              If that comes back with an error, then you are looking in the right spot.. now it's time to correct it:



              sudo dd if=/dev/zero of=/dev/sda1 seek=###### count=1 oflag=direct bs=1024


              If the second comes back without an error, you should be able to retry the first command and it should also now not error. Repeat for each bad block number listed in the file.



              Make sure to type the commands exactly as shown ( substituting the block number for the #### ) or you can destroy your data



              You also might want to run sudo smartctl -a /dev/sda to read the SMART status of the drive. Of note are the raw values for the reallocated count and pending. If you fixed all of the bad sectors, the pending count will have returned to zero. If they were remapped, the reallocated count will have gone up. If this is more than a handful you probably want to replace the drive as it is likely to get worse. If the reallocated count didn't go up, then there is nothing physically wrong with the drive.



              At this point you also should boot into rescue mode and run a full fsck on the volume to make sure that checks out.






              share|improve this answer






















                up vote
                1
                down vote



                accepted







                up vote
                1
                down vote



                accepted






                For each bad block number, first use dd to verify that it is bad ( and you didn't make some mistake somewhere ):



                sudo dd if=/dev/sda1 skip=##### count=1 of=/dev/null iflag=direct bs=1024


                If that comes back with an error, then you are looking in the right spot.. now it's time to correct it:



                sudo dd if=/dev/zero of=/dev/sda1 seek=###### count=1 oflag=direct bs=1024


                If the second comes back without an error, you should be able to retry the first command and it should also now not error. Repeat for each bad block number listed in the file.



                Make sure to type the commands exactly as shown ( substituting the block number for the #### ) or you can destroy your data



                You also might want to run sudo smartctl -a /dev/sda to read the SMART status of the drive. Of note are the raw values for the reallocated count and pending. If you fixed all of the bad sectors, the pending count will have returned to zero. If they were remapped, the reallocated count will have gone up. If this is more than a handful you probably want to replace the drive as it is likely to get worse. If the reallocated count didn't go up, then there is nothing physically wrong with the drive.



                At this point you also should boot into rescue mode and run a full fsck on the volume to make sure that checks out.






                share|improve this answer












                For each bad block number, first use dd to verify that it is bad ( and you didn't make some mistake somewhere ):



                sudo dd if=/dev/sda1 skip=##### count=1 of=/dev/null iflag=direct bs=1024


                If that comes back with an error, then you are looking in the right spot.. now it's time to correct it:



                sudo dd if=/dev/zero of=/dev/sda1 seek=###### count=1 oflag=direct bs=1024


                If the second comes back without an error, you should be able to retry the first command and it should also now not error. Repeat for each bad block number listed in the file.



                Make sure to type the commands exactly as shown ( substituting the block number for the #### ) or you can destroy your data



                You also might want to run sudo smartctl -a /dev/sda to read the SMART status of the drive. Of note are the raw values for the reallocated count and pending. If you fixed all of the bad sectors, the pending count will have returned to zero. If they were remapped, the reallocated count will have gone up. If this is more than a handful you probably want to replace the drive as it is likely to get worse. If the reallocated count didn't go up, then there is nothing physically wrong with the drive.



                At this point you also should boot into rescue mode and run a full fsck on the volume to make sure that checks out.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 10 '14 at 20:27









                psusi

                30.5k14786




                30.5k14786



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f558923%2fhow-can-i-correct-logical-bad-sectors-in-hdd-in-ubuntu%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    pylint3 and pip3 broken

                    Missing snmpget and snmpwalk

                    How to enroll fingerprints to Ubuntu 17.10 with VFS491