How to run a checkdisk?












79















I suspect there might be bad sector on a disk. I used ext3 filesystem.



What tool is the best equivalent of the error checking tool of Windows?










share|improve this question





























    79















    I suspect there might be bad sector on a disk. I used ext3 filesystem.



    What tool is the best equivalent of the error checking tool of Windows?










    share|improve this question



























      79












      79








      79


      36






      I suspect there might be bad sector on a disk. I used ext3 filesystem.



      What tool is the best equivalent of the error checking tool of Windows?










      share|improve this question
















      I suspect there might be bad sector on a disk. I used ext3 filesystem.



      What tool is the best equivalent of the error checking tool of Windows?







      disk






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 1 hour ago









      Pablo Bianchi

      2,97021535




      2,97021535










      asked Aug 29 '11 at 2:38









      Guillaume CotéGuillaume Coté

      1,80662336




      1,80662336






















          4 Answers
          4






          active

          oldest

          votes


















          95














          Disks



          To check for bad sectors check the SMART data, probably the best accessible by launching the Disks utility (Palimpsest). Even if you don't see any bad blocks there, launch a self-test to be sure.



          The program is bundled in the gnome-disk-utility package. Run gksudo gnome-disks



          SMART from Palimpsest



          Or in Ubuntu 16.04 version (3.18):



          SMART from Disks



          Badblocks



          You can also use badblocks



          sudo badblocks -sv /dev/sda


          to just check, or to check and fix first write the result to a temporary file:



          sudo badblocks -sv /dev/sda  > bad-blocks-result
          sudo fsck -t ext4 -l bad-blocks-result /dev/sda1


          will check the whole disk and print out all bad blocks encountered on /dev/sda.



          From badblocks manual:




          Important note: If the output of badblocks is going to be fed to the e2fsck or mke2fs programs, it is important that the block size is properly specified, since the block numbers which are generated are very dependent on the block size in use by the filesystem. For this reason, it is strongly recommended that users not run badblocks directly, but rather use the -c option of the e2fsck and mke2fs programs.




          fsck



          fsck itself will not help you find bad sectors, worse still, if there are a lot of bad sectors it can damage your data even more. Use it only when the disk is healthy.






          share|improve this answer





















          • 1





            Actually badblocks's manual discourages from using it directly and directs users to e2fsck with "-c" (for read only check) or "-cc" (for read write check) option.

            – mrówa
            Apr 29 '13 at 21:01






          • 2





            as a note, on 13.04 you run palimpsest by just running "disks" from the ubuntu menu, however...I dont' see an option to launch a self-test (possibly because I have only one drive, and it's the one running Ubuntu...)

            – rogerdpack
            Oct 11 '13 at 14:04






          • 2





            @mrówa the manual only says to do that if "the output of badblocks is going to be fed to the e2fsck or mke2fs programs"

            – Jon
            Dec 23 '13 at 14:31






          • 1





            Put info that to list all disks use sudo fdisk -l

            – Kangarooo
            Feb 26 '14 at 4:25








          • 2





            this is now called gnome-disks

            – endolith
            Mar 2 '14 at 0:47



















          43














          fsck - check and repair a Linux file system. Invoke it using



          fsck /dev/sda1


          where /dev/sda1 is the drive you want to check. See 'man fsck' for more details.



          There's also 'badblocks' command which checks a device for, you guessed it, bad blocks.



          The drive need to be unmounted when checked, so to check the root partition you need to create a file 'forcefsck' in the root of the partition and reboot. The device will be checked upon the next boot:



          sudo touch /forcefsck
          sudo reboot


          Alternatively, you can boot from a Live CD and run the check from there.






          share|improve this answer
























          • Thanks, the machine is running without a monitor, is there a way to access the output of the check after the reboot?

            – Guillaume Coté
            Aug 29 '11 at 3:58













          • I created the file and rebooted, but it was really quick and there is nothing new in the boot.log.

            – Guillaume Coté
            Aug 29 '11 at 4:14











          • fsck just do a very quick check, I tried option -c to check for the bad block.

            – Guillaume Coté
            Aug 29 '11 at 7:00











          • fsck -c just said : /dev/sda9: Updating bad block inode. I have no info on how many bad node and which proportion of the file system they represent.

            – Guillaume Coté
            Aug 29 '11 at 14:09













          • sudo dumpe2fs -b /dev/sda9. But I think it is better if the disk takes care of faulty sectors, not the filesystem (SMART, badblocks etc, see my post).

            – arrange
            Aug 29 '11 at 16:29



















          20














          badblocks



          You can check for badblocks running the command





          1. sudo badblocks -nsv /dev/[device-partition] > bad-blocks-result for a non-destructive read-write test. That will generate a file called bad-blocks-result with the sectors damaged.



            • -n Use non-destructive read-write mode. By default only a non-destructive read-only test is done.




            • -s Show the progress of the scan by writing out rough percentage completion of the current badblocks pass over the disk.




            • -v Verbose mode.





          2. Then, you can run sudo fsck -t ext3 -l bad-blocks-result /dev/[device-partition] to tell the file system where the bad sectors are and move data away from them, if possible.


          You can find more reading about it here.






          share|improve this answer





















          • 1





            To continue with badblocks later or if you forgot to export the bad sector to a text file (like me) this answer will help you: superuser.com/a/693000/218025

            – chelder
            Jan 21 '15 at 18:22











          • can I use badblocks to check my windows partition? Or will it somehow may damage it ?

            – Private
            Jul 29 '16 at 20:14






          • 1





            @Private If you have a new question, please use the "Ask a question" link at the top.

            – John
            May 28 '17 at 3:45











          • The fsck command fails with btrfs file systems.

            – Luís de Sousa
            Feb 28 at 7:40



















          1














          If you have a partition that you CAN NOT LOOSE THE DATA follow these steps




          1. Determine which partition you want to check for bad sector using the


          $fdisk -l commnd



          Lets assume that the partition to check is called /dev/sdPTC (partition to check)
          and that you have another partition to store the results mounted on /scan/resultPath/ folder



          2.Then you can run this command



          $sudo badblocks -v /dev/sdPTC > /scan/resultPath/badsectors.txt



          which will determine what are the bad blocks of the given device and store them on a file called badsectors.txt




          1. Now you can use fsck command to tell Ubuntu not to use the bad sectors mentioned in the badsectors.txt file.


          $sudo fsck -l /scan_result/badsectors.txt /dev/sda



          That way life of the hard disk is increased a bit until you get a new one for replacement.





          If you have a complete partition that you want to check for bad physical sectors and you CAN AFFORD LOOSE ALL DATA on that partition or is EMPTY follow these steps




          1. $sudo apt-get install gnome-disk-utility


          2. $sudo gnome-disks


          3. Check and double check that there is no important data on that partition


          4. Using gnome-disks DELETE/REMOVE the partition by hand using the "-" sign


          5. Using gnome-disks CREATE a new partition and select the "slow" option that will check the given space for errors



          enter image description here






          share|improve this answer


























          • Does it matter which Ubuntu version it is? Does bionic beaver handle disk checks differently?

            – Gabriel Fair
            Oct 21 '18 at 19:48











          • I have not tried this process on that version.

            – Mauricio Gracia Gutierrez
            Oct 22 '18 at 15:07











          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',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          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%2f59064%2fhow-to-run-a-checkdisk%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          4 Answers
          4






          active

          oldest

          votes








          4 Answers
          4






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          95














          Disks



          To check for bad sectors check the SMART data, probably the best accessible by launching the Disks utility (Palimpsest). Even if you don't see any bad blocks there, launch a self-test to be sure.



          The program is bundled in the gnome-disk-utility package. Run gksudo gnome-disks



          SMART from Palimpsest



          Or in Ubuntu 16.04 version (3.18):



          SMART from Disks



          Badblocks



          You can also use badblocks



          sudo badblocks -sv /dev/sda


          to just check, or to check and fix first write the result to a temporary file:



          sudo badblocks -sv /dev/sda  > bad-blocks-result
          sudo fsck -t ext4 -l bad-blocks-result /dev/sda1


          will check the whole disk and print out all bad blocks encountered on /dev/sda.



          From badblocks manual:




          Important note: If the output of badblocks is going to be fed to the e2fsck or mke2fs programs, it is important that the block size is properly specified, since the block numbers which are generated are very dependent on the block size in use by the filesystem. For this reason, it is strongly recommended that users not run badblocks directly, but rather use the -c option of the e2fsck and mke2fs programs.




          fsck



          fsck itself will not help you find bad sectors, worse still, if there are a lot of bad sectors it can damage your data even more. Use it only when the disk is healthy.






          share|improve this answer





















          • 1





            Actually badblocks's manual discourages from using it directly and directs users to e2fsck with "-c" (for read only check) or "-cc" (for read write check) option.

            – mrówa
            Apr 29 '13 at 21:01






          • 2





            as a note, on 13.04 you run palimpsest by just running "disks" from the ubuntu menu, however...I dont' see an option to launch a self-test (possibly because I have only one drive, and it's the one running Ubuntu...)

            – rogerdpack
            Oct 11 '13 at 14:04






          • 2





            @mrówa the manual only says to do that if "the output of badblocks is going to be fed to the e2fsck or mke2fs programs"

            – Jon
            Dec 23 '13 at 14:31






          • 1





            Put info that to list all disks use sudo fdisk -l

            – Kangarooo
            Feb 26 '14 at 4:25








          • 2





            this is now called gnome-disks

            – endolith
            Mar 2 '14 at 0:47
















          95














          Disks



          To check for bad sectors check the SMART data, probably the best accessible by launching the Disks utility (Palimpsest). Even if you don't see any bad blocks there, launch a self-test to be sure.



          The program is bundled in the gnome-disk-utility package. Run gksudo gnome-disks



          SMART from Palimpsest



          Or in Ubuntu 16.04 version (3.18):



          SMART from Disks



          Badblocks



          You can also use badblocks



          sudo badblocks -sv /dev/sda


          to just check, or to check and fix first write the result to a temporary file:



          sudo badblocks -sv /dev/sda  > bad-blocks-result
          sudo fsck -t ext4 -l bad-blocks-result /dev/sda1


          will check the whole disk and print out all bad blocks encountered on /dev/sda.



          From badblocks manual:




          Important note: If the output of badblocks is going to be fed to the e2fsck or mke2fs programs, it is important that the block size is properly specified, since the block numbers which are generated are very dependent on the block size in use by the filesystem. For this reason, it is strongly recommended that users not run badblocks directly, but rather use the -c option of the e2fsck and mke2fs programs.




          fsck



          fsck itself will not help you find bad sectors, worse still, if there are a lot of bad sectors it can damage your data even more. Use it only when the disk is healthy.






          share|improve this answer





















          • 1





            Actually badblocks's manual discourages from using it directly and directs users to e2fsck with "-c" (for read only check) or "-cc" (for read write check) option.

            – mrówa
            Apr 29 '13 at 21:01






          • 2





            as a note, on 13.04 you run palimpsest by just running "disks" from the ubuntu menu, however...I dont' see an option to launch a self-test (possibly because I have only one drive, and it's the one running Ubuntu...)

            – rogerdpack
            Oct 11 '13 at 14:04






          • 2





            @mrówa the manual only says to do that if "the output of badblocks is going to be fed to the e2fsck or mke2fs programs"

            – Jon
            Dec 23 '13 at 14:31






          • 1





            Put info that to list all disks use sudo fdisk -l

            – Kangarooo
            Feb 26 '14 at 4:25








          • 2





            this is now called gnome-disks

            – endolith
            Mar 2 '14 at 0:47














          95












          95








          95







          Disks



          To check for bad sectors check the SMART data, probably the best accessible by launching the Disks utility (Palimpsest). Even if you don't see any bad blocks there, launch a self-test to be sure.



          The program is bundled in the gnome-disk-utility package. Run gksudo gnome-disks



          SMART from Palimpsest



          Or in Ubuntu 16.04 version (3.18):



          SMART from Disks



          Badblocks



          You can also use badblocks



          sudo badblocks -sv /dev/sda


          to just check, or to check and fix first write the result to a temporary file:



          sudo badblocks -sv /dev/sda  > bad-blocks-result
          sudo fsck -t ext4 -l bad-blocks-result /dev/sda1


          will check the whole disk and print out all bad blocks encountered on /dev/sda.



          From badblocks manual:




          Important note: If the output of badblocks is going to be fed to the e2fsck or mke2fs programs, it is important that the block size is properly specified, since the block numbers which are generated are very dependent on the block size in use by the filesystem. For this reason, it is strongly recommended that users not run badblocks directly, but rather use the -c option of the e2fsck and mke2fs programs.




          fsck



          fsck itself will not help you find bad sectors, worse still, if there are a lot of bad sectors it can damage your data even more. Use it only when the disk is healthy.






          share|improve this answer















          Disks



          To check for bad sectors check the SMART data, probably the best accessible by launching the Disks utility (Palimpsest). Even if you don't see any bad blocks there, launch a self-test to be sure.



          The program is bundled in the gnome-disk-utility package. Run gksudo gnome-disks



          SMART from Palimpsest



          Or in Ubuntu 16.04 version (3.18):



          SMART from Disks



          Badblocks



          You can also use badblocks



          sudo badblocks -sv /dev/sda


          to just check, or to check and fix first write the result to a temporary file:



          sudo badblocks -sv /dev/sda  > bad-blocks-result
          sudo fsck -t ext4 -l bad-blocks-result /dev/sda1


          will check the whole disk and print out all bad blocks encountered on /dev/sda.



          From badblocks manual:




          Important note: If the output of badblocks is going to be fed to the e2fsck or mke2fs programs, it is important that the block size is properly specified, since the block numbers which are generated are very dependent on the block size in use by the filesystem. For this reason, it is strongly recommended that users not run badblocks directly, but rather use the -c option of the e2fsck and mke2fs programs.




          fsck



          fsck itself will not help you find bad sectors, worse still, if there are a lot of bad sectors it can damage your data even more. Use it only when the disk is healthy.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 12 '17 at 3:28









          Pablo Bianchi

          2,97021535




          2,97021535










          answered Aug 29 '11 at 6:53









          arrangearrange

          11.7k33327




          11.7k33327








          • 1





            Actually badblocks's manual discourages from using it directly and directs users to e2fsck with "-c" (for read only check) or "-cc" (for read write check) option.

            – mrówa
            Apr 29 '13 at 21:01






          • 2





            as a note, on 13.04 you run palimpsest by just running "disks" from the ubuntu menu, however...I dont' see an option to launch a self-test (possibly because I have only one drive, and it's the one running Ubuntu...)

            – rogerdpack
            Oct 11 '13 at 14:04






          • 2





            @mrówa the manual only says to do that if "the output of badblocks is going to be fed to the e2fsck or mke2fs programs"

            – Jon
            Dec 23 '13 at 14:31






          • 1





            Put info that to list all disks use sudo fdisk -l

            – Kangarooo
            Feb 26 '14 at 4:25








          • 2





            this is now called gnome-disks

            – endolith
            Mar 2 '14 at 0:47














          • 1





            Actually badblocks's manual discourages from using it directly and directs users to e2fsck with "-c" (for read only check) or "-cc" (for read write check) option.

            – mrówa
            Apr 29 '13 at 21:01






          • 2





            as a note, on 13.04 you run palimpsest by just running "disks" from the ubuntu menu, however...I dont' see an option to launch a self-test (possibly because I have only one drive, and it's the one running Ubuntu...)

            – rogerdpack
            Oct 11 '13 at 14:04






          • 2





            @mrówa the manual only says to do that if "the output of badblocks is going to be fed to the e2fsck or mke2fs programs"

            – Jon
            Dec 23 '13 at 14:31






          • 1





            Put info that to list all disks use sudo fdisk -l

            – Kangarooo
            Feb 26 '14 at 4:25








          • 2





            this is now called gnome-disks

            – endolith
            Mar 2 '14 at 0:47








          1




          1





          Actually badblocks's manual discourages from using it directly and directs users to e2fsck with "-c" (for read only check) or "-cc" (for read write check) option.

          – mrówa
          Apr 29 '13 at 21:01





          Actually badblocks's manual discourages from using it directly and directs users to e2fsck with "-c" (for read only check) or "-cc" (for read write check) option.

          – mrówa
          Apr 29 '13 at 21:01




          2




          2





          as a note, on 13.04 you run palimpsest by just running "disks" from the ubuntu menu, however...I dont' see an option to launch a self-test (possibly because I have only one drive, and it's the one running Ubuntu...)

          – rogerdpack
          Oct 11 '13 at 14:04





          as a note, on 13.04 you run palimpsest by just running "disks" from the ubuntu menu, however...I dont' see an option to launch a self-test (possibly because I have only one drive, and it's the one running Ubuntu...)

          – rogerdpack
          Oct 11 '13 at 14:04




          2




          2





          @mrówa the manual only says to do that if "the output of badblocks is going to be fed to the e2fsck or mke2fs programs"

          – Jon
          Dec 23 '13 at 14:31





          @mrówa the manual only says to do that if "the output of badblocks is going to be fed to the e2fsck or mke2fs programs"

          – Jon
          Dec 23 '13 at 14:31




          1




          1





          Put info that to list all disks use sudo fdisk -l

          – Kangarooo
          Feb 26 '14 at 4:25







          Put info that to list all disks use sudo fdisk -l

          – Kangarooo
          Feb 26 '14 at 4:25






          2




          2





          this is now called gnome-disks

          – endolith
          Mar 2 '14 at 0:47





          this is now called gnome-disks

          – endolith
          Mar 2 '14 at 0:47













          43














          fsck - check and repair a Linux file system. Invoke it using



          fsck /dev/sda1


          where /dev/sda1 is the drive you want to check. See 'man fsck' for more details.



          There's also 'badblocks' command which checks a device for, you guessed it, bad blocks.



          The drive need to be unmounted when checked, so to check the root partition you need to create a file 'forcefsck' in the root of the partition and reboot. The device will be checked upon the next boot:



          sudo touch /forcefsck
          sudo reboot


          Alternatively, you can boot from a Live CD and run the check from there.






          share|improve this answer
























          • Thanks, the machine is running without a monitor, is there a way to access the output of the check after the reboot?

            – Guillaume Coté
            Aug 29 '11 at 3:58













          • I created the file and rebooted, but it was really quick and there is nothing new in the boot.log.

            – Guillaume Coté
            Aug 29 '11 at 4:14











          • fsck just do a very quick check, I tried option -c to check for the bad block.

            – Guillaume Coté
            Aug 29 '11 at 7:00











          • fsck -c just said : /dev/sda9: Updating bad block inode. I have no info on how many bad node and which proportion of the file system they represent.

            – Guillaume Coté
            Aug 29 '11 at 14:09













          • sudo dumpe2fs -b /dev/sda9. But I think it is better if the disk takes care of faulty sectors, not the filesystem (SMART, badblocks etc, see my post).

            – arrange
            Aug 29 '11 at 16:29
















          43














          fsck - check and repair a Linux file system. Invoke it using



          fsck /dev/sda1


          where /dev/sda1 is the drive you want to check. See 'man fsck' for more details.



          There's also 'badblocks' command which checks a device for, you guessed it, bad blocks.



          The drive need to be unmounted when checked, so to check the root partition you need to create a file 'forcefsck' in the root of the partition and reboot. The device will be checked upon the next boot:



          sudo touch /forcefsck
          sudo reboot


          Alternatively, you can boot from a Live CD and run the check from there.






          share|improve this answer
























          • Thanks, the machine is running without a monitor, is there a way to access the output of the check after the reboot?

            – Guillaume Coté
            Aug 29 '11 at 3:58













          • I created the file and rebooted, but it was really quick and there is nothing new in the boot.log.

            – Guillaume Coté
            Aug 29 '11 at 4:14











          • fsck just do a very quick check, I tried option -c to check for the bad block.

            – Guillaume Coté
            Aug 29 '11 at 7:00











          • fsck -c just said : /dev/sda9: Updating bad block inode. I have no info on how many bad node and which proportion of the file system they represent.

            – Guillaume Coté
            Aug 29 '11 at 14:09













          • sudo dumpe2fs -b /dev/sda9. But I think it is better if the disk takes care of faulty sectors, not the filesystem (SMART, badblocks etc, see my post).

            – arrange
            Aug 29 '11 at 16:29














          43












          43








          43







          fsck - check and repair a Linux file system. Invoke it using



          fsck /dev/sda1


          where /dev/sda1 is the drive you want to check. See 'man fsck' for more details.



          There's also 'badblocks' command which checks a device for, you guessed it, bad blocks.



          The drive need to be unmounted when checked, so to check the root partition you need to create a file 'forcefsck' in the root of the partition and reboot. The device will be checked upon the next boot:



          sudo touch /forcefsck
          sudo reboot


          Alternatively, you can boot from a Live CD and run the check from there.






          share|improve this answer













          fsck - check and repair a Linux file system. Invoke it using



          fsck /dev/sda1


          where /dev/sda1 is the drive you want to check. See 'man fsck' for more details.



          There's also 'badblocks' command which checks a device for, you guessed it, bad blocks.



          The drive need to be unmounted when checked, so to check the root partition you need to create a file 'forcefsck' in the root of the partition and reboot. The device will be checked upon the next boot:



          sudo touch /forcefsck
          sudo reboot


          Alternatively, you can boot from a Live CD and run the check from there.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 29 '11 at 2:52









          SergeySergey

          36.6k98799




          36.6k98799













          • Thanks, the machine is running without a monitor, is there a way to access the output of the check after the reboot?

            – Guillaume Coté
            Aug 29 '11 at 3:58













          • I created the file and rebooted, but it was really quick and there is nothing new in the boot.log.

            – Guillaume Coté
            Aug 29 '11 at 4:14











          • fsck just do a very quick check, I tried option -c to check for the bad block.

            – Guillaume Coté
            Aug 29 '11 at 7:00











          • fsck -c just said : /dev/sda9: Updating bad block inode. I have no info on how many bad node and which proportion of the file system they represent.

            – Guillaume Coté
            Aug 29 '11 at 14:09













          • sudo dumpe2fs -b /dev/sda9. But I think it is better if the disk takes care of faulty sectors, not the filesystem (SMART, badblocks etc, see my post).

            – arrange
            Aug 29 '11 at 16:29



















          • Thanks, the machine is running without a monitor, is there a way to access the output of the check after the reboot?

            – Guillaume Coté
            Aug 29 '11 at 3:58













          • I created the file and rebooted, but it was really quick and there is nothing new in the boot.log.

            – Guillaume Coté
            Aug 29 '11 at 4:14











          • fsck just do a very quick check, I tried option -c to check for the bad block.

            – Guillaume Coté
            Aug 29 '11 at 7:00











          • fsck -c just said : /dev/sda9: Updating bad block inode. I have no info on how many bad node and which proportion of the file system they represent.

            – Guillaume Coté
            Aug 29 '11 at 14:09













          • sudo dumpe2fs -b /dev/sda9. But I think it is better if the disk takes care of faulty sectors, not the filesystem (SMART, badblocks etc, see my post).

            – arrange
            Aug 29 '11 at 16:29

















          Thanks, the machine is running without a monitor, is there a way to access the output of the check after the reboot?

          – Guillaume Coté
          Aug 29 '11 at 3:58







          Thanks, the machine is running without a monitor, is there a way to access the output of the check after the reboot?

          – Guillaume Coté
          Aug 29 '11 at 3:58















          I created the file and rebooted, but it was really quick and there is nothing new in the boot.log.

          – Guillaume Coté
          Aug 29 '11 at 4:14





          I created the file and rebooted, but it was really quick and there is nothing new in the boot.log.

          – Guillaume Coté
          Aug 29 '11 at 4:14













          fsck just do a very quick check, I tried option -c to check for the bad block.

          – Guillaume Coté
          Aug 29 '11 at 7:00





          fsck just do a very quick check, I tried option -c to check for the bad block.

          – Guillaume Coté
          Aug 29 '11 at 7:00













          fsck -c just said : /dev/sda9: Updating bad block inode. I have no info on how many bad node and which proportion of the file system they represent.

          – Guillaume Coté
          Aug 29 '11 at 14:09







          fsck -c just said : /dev/sda9: Updating bad block inode. I have no info on how many bad node and which proportion of the file system they represent.

          – Guillaume Coté
          Aug 29 '11 at 14:09















          sudo dumpe2fs -b /dev/sda9. But I think it is better if the disk takes care of faulty sectors, not the filesystem (SMART, badblocks etc, see my post).

          – arrange
          Aug 29 '11 at 16:29





          sudo dumpe2fs -b /dev/sda9. But I think it is better if the disk takes care of faulty sectors, not the filesystem (SMART, badblocks etc, see my post).

          – arrange
          Aug 29 '11 at 16:29











          20














          badblocks



          You can check for badblocks running the command





          1. sudo badblocks -nsv /dev/[device-partition] > bad-blocks-result for a non-destructive read-write test. That will generate a file called bad-blocks-result with the sectors damaged.



            • -n Use non-destructive read-write mode. By default only a non-destructive read-only test is done.




            • -s Show the progress of the scan by writing out rough percentage completion of the current badblocks pass over the disk.




            • -v Verbose mode.





          2. Then, you can run sudo fsck -t ext3 -l bad-blocks-result /dev/[device-partition] to tell the file system where the bad sectors are and move data away from them, if possible.


          You can find more reading about it here.






          share|improve this answer





















          • 1





            To continue with badblocks later or if you forgot to export the bad sector to a text file (like me) this answer will help you: superuser.com/a/693000/218025

            – chelder
            Jan 21 '15 at 18:22











          • can I use badblocks to check my windows partition? Or will it somehow may damage it ?

            – Private
            Jul 29 '16 at 20:14






          • 1





            @Private If you have a new question, please use the "Ask a question" link at the top.

            – John
            May 28 '17 at 3:45











          • The fsck command fails with btrfs file systems.

            – Luís de Sousa
            Feb 28 at 7:40
















          20














          badblocks



          You can check for badblocks running the command





          1. sudo badblocks -nsv /dev/[device-partition] > bad-blocks-result for a non-destructive read-write test. That will generate a file called bad-blocks-result with the sectors damaged.



            • -n Use non-destructive read-write mode. By default only a non-destructive read-only test is done.




            • -s Show the progress of the scan by writing out rough percentage completion of the current badblocks pass over the disk.




            • -v Verbose mode.





          2. Then, you can run sudo fsck -t ext3 -l bad-blocks-result /dev/[device-partition] to tell the file system where the bad sectors are and move data away from them, if possible.


          You can find more reading about it here.






          share|improve this answer





















          • 1





            To continue with badblocks later or if you forgot to export the bad sector to a text file (like me) this answer will help you: superuser.com/a/693000/218025

            – chelder
            Jan 21 '15 at 18:22











          • can I use badblocks to check my windows partition? Or will it somehow may damage it ?

            – Private
            Jul 29 '16 at 20:14






          • 1





            @Private If you have a new question, please use the "Ask a question" link at the top.

            – John
            May 28 '17 at 3:45











          • The fsck command fails with btrfs file systems.

            – Luís de Sousa
            Feb 28 at 7:40














          20












          20








          20







          badblocks



          You can check for badblocks running the command





          1. sudo badblocks -nsv /dev/[device-partition] > bad-blocks-result for a non-destructive read-write test. That will generate a file called bad-blocks-result with the sectors damaged.



            • -n Use non-destructive read-write mode. By default only a non-destructive read-only test is done.




            • -s Show the progress of the scan by writing out rough percentage completion of the current badblocks pass over the disk.




            • -v Verbose mode.





          2. Then, you can run sudo fsck -t ext3 -l bad-blocks-result /dev/[device-partition] to tell the file system where the bad sectors are and move data away from them, if possible.


          You can find more reading about it here.






          share|improve this answer















          badblocks



          You can check for badblocks running the command





          1. sudo badblocks -nsv /dev/[device-partition] > bad-blocks-result for a non-destructive read-write test. That will generate a file called bad-blocks-result with the sectors damaged.



            • -n Use non-destructive read-write mode. By default only a non-destructive read-only test is done.




            • -s Show the progress of the scan by writing out rough percentage completion of the current badblocks pass over the disk.




            • -v Verbose mode.





          2. Then, you can run sudo fsck -t ext3 -l bad-blocks-result /dev/[device-partition] to tell the file system where the bad sectors are and move data away from them, if possible.


          You can find more reading about it here.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 9 '17 at 5:02









          Pablo Bianchi

          2,97021535




          2,97021535










          answered Dec 24 '13 at 19:51









          Dielson SalesDielson Sales

          1,1101815




          1,1101815








          • 1





            To continue with badblocks later or if you forgot to export the bad sector to a text file (like me) this answer will help you: superuser.com/a/693000/218025

            – chelder
            Jan 21 '15 at 18:22











          • can I use badblocks to check my windows partition? Or will it somehow may damage it ?

            – Private
            Jul 29 '16 at 20:14






          • 1





            @Private If you have a new question, please use the "Ask a question" link at the top.

            – John
            May 28 '17 at 3:45











          • The fsck command fails with btrfs file systems.

            – Luís de Sousa
            Feb 28 at 7:40














          • 1





            To continue with badblocks later or if you forgot to export the bad sector to a text file (like me) this answer will help you: superuser.com/a/693000/218025

            – chelder
            Jan 21 '15 at 18:22











          • can I use badblocks to check my windows partition? Or will it somehow may damage it ?

            – Private
            Jul 29 '16 at 20:14






          • 1





            @Private If you have a new question, please use the "Ask a question" link at the top.

            – John
            May 28 '17 at 3:45











          • The fsck command fails with btrfs file systems.

            – Luís de Sousa
            Feb 28 at 7:40








          1




          1





          To continue with badblocks later or if you forgot to export the bad sector to a text file (like me) this answer will help you: superuser.com/a/693000/218025

          – chelder
          Jan 21 '15 at 18:22





          To continue with badblocks later or if you forgot to export the bad sector to a text file (like me) this answer will help you: superuser.com/a/693000/218025

          – chelder
          Jan 21 '15 at 18:22













          can I use badblocks to check my windows partition? Or will it somehow may damage it ?

          – Private
          Jul 29 '16 at 20:14





          can I use badblocks to check my windows partition? Or will it somehow may damage it ?

          – Private
          Jul 29 '16 at 20:14




          1




          1





          @Private If you have a new question, please use the "Ask a question" link at the top.

          – John
          May 28 '17 at 3:45





          @Private If you have a new question, please use the "Ask a question" link at the top.

          – John
          May 28 '17 at 3:45













          The fsck command fails with btrfs file systems.

          – Luís de Sousa
          Feb 28 at 7:40





          The fsck command fails with btrfs file systems.

          – Luís de Sousa
          Feb 28 at 7:40











          1














          If you have a partition that you CAN NOT LOOSE THE DATA follow these steps




          1. Determine which partition you want to check for bad sector using the


          $fdisk -l commnd



          Lets assume that the partition to check is called /dev/sdPTC (partition to check)
          and that you have another partition to store the results mounted on /scan/resultPath/ folder



          2.Then you can run this command



          $sudo badblocks -v /dev/sdPTC > /scan/resultPath/badsectors.txt



          which will determine what are the bad blocks of the given device and store them on a file called badsectors.txt




          1. Now you can use fsck command to tell Ubuntu not to use the bad sectors mentioned in the badsectors.txt file.


          $sudo fsck -l /scan_result/badsectors.txt /dev/sda



          That way life of the hard disk is increased a bit until you get a new one for replacement.





          If you have a complete partition that you want to check for bad physical sectors and you CAN AFFORD LOOSE ALL DATA on that partition or is EMPTY follow these steps




          1. $sudo apt-get install gnome-disk-utility


          2. $sudo gnome-disks


          3. Check and double check that there is no important data on that partition


          4. Using gnome-disks DELETE/REMOVE the partition by hand using the "-" sign


          5. Using gnome-disks CREATE a new partition and select the "slow" option that will check the given space for errors



          enter image description here






          share|improve this answer


























          • Does it matter which Ubuntu version it is? Does bionic beaver handle disk checks differently?

            – Gabriel Fair
            Oct 21 '18 at 19:48











          • I have not tried this process on that version.

            – Mauricio Gracia Gutierrez
            Oct 22 '18 at 15:07
















          1














          If you have a partition that you CAN NOT LOOSE THE DATA follow these steps




          1. Determine which partition you want to check for bad sector using the


          $fdisk -l commnd



          Lets assume that the partition to check is called /dev/sdPTC (partition to check)
          and that you have another partition to store the results mounted on /scan/resultPath/ folder



          2.Then you can run this command



          $sudo badblocks -v /dev/sdPTC > /scan/resultPath/badsectors.txt



          which will determine what are the bad blocks of the given device and store them on a file called badsectors.txt




          1. Now you can use fsck command to tell Ubuntu not to use the bad sectors mentioned in the badsectors.txt file.


          $sudo fsck -l /scan_result/badsectors.txt /dev/sda



          That way life of the hard disk is increased a bit until you get a new one for replacement.





          If you have a complete partition that you want to check for bad physical sectors and you CAN AFFORD LOOSE ALL DATA on that partition or is EMPTY follow these steps




          1. $sudo apt-get install gnome-disk-utility


          2. $sudo gnome-disks


          3. Check and double check that there is no important data on that partition


          4. Using gnome-disks DELETE/REMOVE the partition by hand using the "-" sign


          5. Using gnome-disks CREATE a new partition and select the "slow" option that will check the given space for errors



          enter image description here






          share|improve this answer


























          • Does it matter which Ubuntu version it is? Does bionic beaver handle disk checks differently?

            – Gabriel Fair
            Oct 21 '18 at 19:48











          • I have not tried this process on that version.

            – Mauricio Gracia Gutierrez
            Oct 22 '18 at 15:07














          1












          1








          1







          If you have a partition that you CAN NOT LOOSE THE DATA follow these steps




          1. Determine which partition you want to check for bad sector using the


          $fdisk -l commnd



          Lets assume that the partition to check is called /dev/sdPTC (partition to check)
          and that you have another partition to store the results mounted on /scan/resultPath/ folder



          2.Then you can run this command



          $sudo badblocks -v /dev/sdPTC > /scan/resultPath/badsectors.txt



          which will determine what are the bad blocks of the given device and store them on a file called badsectors.txt




          1. Now you can use fsck command to tell Ubuntu not to use the bad sectors mentioned in the badsectors.txt file.


          $sudo fsck -l /scan_result/badsectors.txt /dev/sda



          That way life of the hard disk is increased a bit until you get a new one for replacement.





          If you have a complete partition that you want to check for bad physical sectors and you CAN AFFORD LOOSE ALL DATA on that partition or is EMPTY follow these steps




          1. $sudo apt-get install gnome-disk-utility


          2. $sudo gnome-disks


          3. Check and double check that there is no important data on that partition


          4. Using gnome-disks DELETE/REMOVE the partition by hand using the "-" sign


          5. Using gnome-disks CREATE a new partition and select the "slow" option that will check the given space for errors



          enter image description here






          share|improve this answer















          If you have a partition that you CAN NOT LOOSE THE DATA follow these steps




          1. Determine which partition you want to check for bad sector using the


          $fdisk -l commnd



          Lets assume that the partition to check is called /dev/sdPTC (partition to check)
          and that you have another partition to store the results mounted on /scan/resultPath/ folder



          2.Then you can run this command



          $sudo badblocks -v /dev/sdPTC > /scan/resultPath/badsectors.txt



          which will determine what are the bad blocks of the given device and store them on a file called badsectors.txt




          1. Now you can use fsck command to tell Ubuntu not to use the bad sectors mentioned in the badsectors.txt file.


          $sudo fsck -l /scan_result/badsectors.txt /dev/sda



          That way life of the hard disk is increased a bit until you get a new one for replacement.





          If you have a complete partition that you want to check for bad physical sectors and you CAN AFFORD LOOSE ALL DATA on that partition or is EMPTY follow these steps




          1. $sudo apt-get install gnome-disk-utility


          2. $sudo gnome-disks


          3. Check and double check that there is no important data on that partition


          4. Using gnome-disks DELETE/REMOVE the partition by hand using the "-" sign


          5. Using gnome-disks CREATE a new partition and select the "slow" option that will check the given space for errors



          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jul 29 '18 at 14:03

























          answered Jul 29 '18 at 13:17









          Mauricio Gracia GutierrezMauricio Gracia Gutierrez

          2382414




          2382414













          • Does it matter which Ubuntu version it is? Does bionic beaver handle disk checks differently?

            – Gabriel Fair
            Oct 21 '18 at 19:48











          • I have not tried this process on that version.

            – Mauricio Gracia Gutierrez
            Oct 22 '18 at 15:07



















          • Does it matter which Ubuntu version it is? Does bionic beaver handle disk checks differently?

            – Gabriel Fair
            Oct 21 '18 at 19:48











          • I have not tried this process on that version.

            – Mauricio Gracia Gutierrez
            Oct 22 '18 at 15:07

















          Does it matter which Ubuntu version it is? Does bionic beaver handle disk checks differently?

          – Gabriel Fair
          Oct 21 '18 at 19:48





          Does it matter which Ubuntu version it is? Does bionic beaver handle disk checks differently?

          – Gabriel Fair
          Oct 21 '18 at 19:48













          I have not tried this process on that version.

          – Mauricio Gracia Gutierrez
          Oct 22 '18 at 15:07





          I have not tried this process on that version.

          – Mauricio Gracia Gutierrez
          Oct 22 '18 at 15:07


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f59064%2fhow-to-run-a-checkdisk%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          GameSpot

          connect to host localhost port 22: Connection refused

          Getting a Wifi WPA2 wifi connection