{"id":4286,"date":"2023-07-25T09:55:43","date_gmt":"2023-07-25T09:55:43","guid":{"rendered":"https:\/\/arzhost.com\/blogs\/?p=4286"},"modified":"2023-10-12T19:09:29","modified_gmt":"2023-10-12T19:09:29","slug":"what-must-you-do-to-successfully-run-the-fsck-command-on-a-file-system","status":"publish","type":"post","link":"https:\/\/arzhost.com\/blogs\/what-must-you-do-to-successfully-run-the-fsck-command-on-a-file-system\/","title":{"rendered":"How to Run the fsck Command on a File System"},"content":{"rendered":"<p>The Linux software fsck (File System Consistency Check) checks file systems for mistakes or unresolved problems. The program is used to provide reports and correct potential problems. Let\u2019s see the solution to this question <span style=\"color: #000000;\"><strong>What Must You do to Successfully Run the fsck Command on a File System?<\/strong><\/span><\/p>\n<p>Linux distributions by default include this tool. There are no set procedures or installation requirements to utilize fsck. Once the terminal has loaded, you are prepared to use the tool&#8217;s features.<\/p>\n<p>To inspect and repair the file system on a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Linux\" target=\"_blank\" rel=\"noopener\">Linux<\/a> machine, refer to this instruction. Examples of how to use the tool and for what use cases are provided in the tutorial.<\/p>\n<ul>\n<li>UNIX-like or Linux-based system<\/li>\n<li>Access to a command line or terminal<\/li>\n<li>A root-permissions user who can use the tool<\/li>\n<\/ul>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_74 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/arzhost.com\/blogs\/what-must-you-do-to-successfully-run-the-fsck-command-on-a-file-system\/#When_to_Use_Linuxs_Fsck\" >When to Use Linux&#8217;s Fsck?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/arzhost.com\/blogs\/what-must-you-do-to-successfully-run-the-fsck-command-on-a-file-system\/#Primary_Fsck_Syntax\" >Primary Fsck Syntax<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/arzhost.com\/blogs\/what-must-you-do-to-successfully-run-the-fsck-command-on-a-file-system\/#How_to_Examine_and_Fix_the_Filesystem\" >How to Examine and Fix the Filesystem?<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/arzhost.com\/blogs\/what-must-you-do-to-successfully-run-the-fsck-command-on-a-file-system\/#1_View_Mounted_Partitions_and_Disks\" >1: View Mounted Partitions and Disks<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/arzhost.com\/blogs\/what-must-you-do-to-successfully-run-the-fsck-command-on-a-file-system\/#2_Drop_the_Disk\" >2: Drop the Disk<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/arzhost.com\/blogs\/what-must-you-do-to-successfully-run-the-fsck-command-on-a-file-system\/#3_To_check_for_errors_run_fsck\" >3: To check for errors, run fsck.<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/arzhost.com\/blogs\/what-must-you-do-to-successfully-run-the-fsck-command-on-a-file-system\/#4_Install_the_Disc\" >4: Install the Disc<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/arzhost.com\/blogs\/what-must-you-do-to-successfully-run-the-fsck-command-on-a-file-system\/#5_Run_fsck_in_a_dry_run\" >5: Run fsck in a dry run.<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/arzhost.com\/blogs\/what-must-you-do-to-successfully-run-the-fsck-command-on-a-file-system\/#6_Automatically_Correct_Detected_Errors_with_fsck\" >6: Automatically Correct Detected Errors with fsck<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/arzhost.com\/blogs\/what-must-you-do-to-successfully-run-the-fsck-command-on-a-file-system\/#7_Skip_Repair_and_Output_fsck_Errors_Instead\" >7: Skip Repair and Output fsck Errors Instead<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/arzhost.com\/blogs\/what-must-you-do-to-successfully-run-the-fsck-command-on-a-file-system\/#8_Force_a_filesystem_check_with_fsck\" >8: Force a filesystem check with fsck<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/arzhost.com\/blogs\/what-must-you-do-to-successfully-run-the-fsck-command-on-a-file-system\/#9_Run_fsck_once_on_all_filesystems\" >9: Run fsck once on all filesystems<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/arzhost.com\/blogs\/what-must-you-do-to-successfully-run-the-fsck-command-on-a-file-system\/#10_On_a_Specific_Filesystem_skip_fsck\" >10: On a Specific Filesystem, skip fsck<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/arzhost.com\/blogs\/what-must-you-do-to-successfully-run-the-fsck-command-on-a-file-system\/#11_On_mounted_filesystems_omit_Fsck\" >11: On mounted filesystems, omit Fsck<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/arzhost.com\/blogs\/what-must-you-do-to-successfully-run-the-fsck-command-on-a-file-system\/#On_the_Linux_Root_Partition_Run_Fsck\" >On the Linux Root Partition, Run Fsck<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/arzhost.com\/blogs\/what-must-you-do-to-successfully-run-the-fsck-command-on-a-file-system\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"When_to_Use_Linuxs_Fsck\"><\/span><strong>When to Use Linux&#8217;s Fsck?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><u>The fsck utility can be applied in a variety of circumstances:<\/u><\/p>\n<ol>\n<li>Run a file system check using fsck to maintain your system&#8217;s integrity or when a problem arises.<\/li>\n<li>When the machine cannot boot, fsck can diagnose this as a common issue.<\/li>\n<li>Another is when your system&#8217;s files become corrupt and you have an input\/output problem.<\/li>\n<li>The fsck software can also be used to examine the condition of external media, including USB flash drives and SD cards.<\/li>\n<\/ol>\n<p><iframe title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/nIRSAlEoP1c\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Primary_Fsck_Syntax\"><\/span><strong>Primary Fsck Syntax<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><u>\u201cWhat Must You do to Successfully Run the fsck Command on a File System?\u201d The fsck utility&#8217;s fundamental syntax follows this structure:<\/u><\/p>\n<ul>\n<li><code>filesystem options fsck<\/code><\/li>\n<\/ul>\n<p>In the above-mentioned illustration, a filesystem could be a mount point, a partition, a device, etc. At the end of the command, you can also use filesystem-specific parameters.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"How_to_Examine_and_Fix_the_Filesystem\"><\/span><strong>How to Examine and Fix the Filesystem?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Before you inspect and fix your file system, there are a few things you need to do. Find the device, then unmount it.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"1_View_Mounted_Partitions_and_Disks\"><\/span><strong><u>1: View Mounted Partitions and Disks<\/u><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Use one of the available tools in Linux to inspect all mounted devices on your system and find the location of the disc.<\/p>\n<p><u>Listing the filesystem discs with the df command is one way to find the disc you wish to scan:<\/u><\/p>\n<ul>\n<li><code>df -h<\/code><\/li>\n<\/ul>\n<p><a href=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/View-Mounted-Partitions-and-Disks.png\"><img fetchpriority=\"high\" decoding=\"async\" title=\"View Mounted Partitions and Disks\" class=\"wp-image-4294 aligncenter\" src=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/View-Mounted-Partitions-and-Disks.png\" alt=\"View Mounted Partitions and Disks\" width=\"756\" height=\"328\" srcset=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/View-Mounted-Partitions-and-Disks.png 800w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/View-Mounted-Partitions-and-Disks-300x130.png 300w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/View-Mounted-Partitions-and-Disks-768x333.png 768w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/View-Mounted-Partitions-and-Disks-640x278.png 640w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/View-Mounted-Partitions-and-Disks-400x174.png 400w\" sizes=\"(max-width: 756px) 100vw, 756px\" \/><\/a><\/p>\n<p>The utility outputs your system&#8217;s and filesystem&#8217;s data use. Make a note of the disc that you want to use the fsck command to verify.<\/p>\n<p><u>Use the following command, for instance, to inspect partitions on your first disc:<\/u><\/p>\n<ul>\n<li><code>'print' with sudo parted \/dev\/sda<\/code><\/li>\n<\/ul>\n<p><a href=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Mounted-Partitions-and-Disks.png\"><img decoding=\"async\" title=\"Mounted Partitions and Disks\" class=\"wp-image-4295 size-full aligncenter\" src=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Mounted-Partitions-and-Disks.png\" alt=\"Mounted Partitions and Disks\" width=\"800\" height=\"221\" srcset=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Mounted-Partitions-and-Disks.png 800w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Mounted-Partitions-and-Disks-300x83.png 300w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Mounted-Partitions-and-Disks-768x212.png 768w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Mounted-Partitions-and-Disks-640x177.png 640w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Mounted-Partitions-and-Disks-400x111.png 400w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/a><\/p>\n<p>Your first SCSI disc is referred to in Linux as sda. The second would be sdb if you had two, and so on.<\/p>\n<p>Since there was only one partition on this virtual system, we only obtained one result in our experiment. If you have more partitions, you will obtain more results.<\/p>\n<p>Here, the disk&#8217;s name is \/dev\/sda, and the Number column displays the number of partitions. It is one in our case: sda1.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"2_Drop_the_Disk\"><\/span><strong><u>2: Drop the Disk<\/u><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>You must unmount a disc or partition before using fsck to perform a disc check. A warning may appear if you attempt to perform fsck on a mounted disc or partition:<\/p>\n<p><u>Run the unmount command, and then:<\/u><\/p>\n<ul>\n<li><code>Umount \/dev\/sdb with sudo.<\/code><\/li>\n<\/ul>\n<p><a href=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Drop-the-Disk.png\"><img decoding=\"async\" title=\"Drop the Disk\" class=\"wp-image-4293 aligncenter\" src=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Drop-the-Disk.png\" alt=\"Drop the Disk\" width=\"759\" height=\"161\" srcset=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Drop-the-Disk.png 509w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Drop-the-Disk-300x64.png 300w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Drop-the-Disk-400x85.png 400w\" sizes=\"(max-width: 759px) 100vw, 759px\" \/><\/a><\/p>\n<p>Put the device you want to unmount in lieu of \/dev\/sdb.<\/p>\n<p>Root filesystems cannot be unmounted, it should be noted. Thus, fsck can no longer be used on a machine that is running. More about that is discussed at the end of the manual.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"3_To_check_for_errors_run_fsck\"><\/span><strong><u>3: To check for errors, run fsck.<\/u><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><u>You can now execute fsck after unmounting the disc. Enter this to examine the second disc:<\/u><\/p>\n<ul>\n<li>fsck \/dev\/sdb with sudo<\/li>\n<\/ul>\n<p><a href=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/check-for-errors.png\"><img loading=\"lazy\" decoding=\"async\" title=\"check for errors\" class=\"wp-image-4292 aligncenter\" src=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/check-for-errors.png\" alt=\"check for errors\" width=\"742\" height=\"125\" srcset=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/check-for-errors.png 619w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/check-for-errors-300x50.png 300w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/check-for-errors-400x67.png 400w\" sizes=\"(max-width: 742px) 100vw, 742px\" \/><\/a><\/p>\n<p>The output for a clean disc is shown in the example above. If your disc has several problems, a prompt asking for your confirmation will show for each one.<\/p>\n<p><u>The total of these states is the exit code that the fsck utility returns:<\/u><\/p>\n<p><a href=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/To-check-for-errors.png\"><img loading=\"lazy\" decoding=\"async\" title=\"To check for errors\" class=\"wp-image-4291 aligncenter\" src=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/To-check-for-errors.png\" alt=\"To check for errors\" width=\"757\" height=\"238\" srcset=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/To-check-for-errors.png 515w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/To-check-for-errors-300x94.png 300w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/To-check-for-errors-400x126.png 400w\" sizes=\"(max-width: 757px) 100vw, 757px\" \/><\/a><\/p>\n<h3><span class=\"ez-toc-section\" id=\"4_Install_the_Disc\"><\/span><strong><u>4: Install the Disc<\/u><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Mount the disc so you can use it again when you&#8217;ve finished inspecting and fixing a device.<\/p>\n<p><u>In this instance, the sdb disc will be remounted:<\/u><\/p>\n<ul>\n<li><code>install \/dev\/sdb<\/code><\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"5_Run_fsck_in_a_dry_run\"><\/span><strong><u>5: Run fsck in a dry run.<\/u><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><u>You can do a test check using fsck before performing a live check. To run a test, provide the fsck command the -N option:<\/u><\/p>\n<ul>\n<li><code>fsck -N \/dev\/sdb with sudo<\/code><\/li>\n<\/ul>\n<p>The output does not take any actions; instead, it prints what might occur.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"6_Automatically_Correct_Detected_Errors_with_fsck\"><\/span><strong><u>6: Automatically Correct Detected Errors with fsck<\/u><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><u>Pass the -y option to fsck to run potential fixes without receiving any prompts:<\/u><\/p>\n<ul>\n<li><code>fsck -y \/dev\/sdb with sudo<\/code><\/li>\n<\/ul>\n<p>In this manner, you can respond &#8220;yes, try to remedy all discovered faults&#8221; without always being reminded.<\/p>\n<p>The output seems the same as it would without the -y option if there are no errors.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"7_Skip_Repair_and_Output_fsck_Errors_Instead\"><\/span><strong><u>7: Skip Repair and Output fsck Errors Instead<\/u><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>If you wish to examine potential file system errors without fixing them, use the -n option.<\/p>\n<p><u>We have some journaling issues on the second drive, sdb. The -n flag displays the problem but does not correct it:<\/u><\/p>\n<ul>\n<li><code>fsck -n \/dev\/sdb with sudo<\/code><\/li>\n<\/ul>\n<p><a href=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Skip-Repair-and-Output-fsck-Errors-Instead.png\"><img loading=\"lazy\" decoding=\"async\" title=\"Skip Repair and Output fsck Errors Instead\" class=\"wp-image-4290 size-full aligncenter\" src=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Skip-Repair-and-Output-fsck-Errors-Instead.png\" alt=\"Skip Repair and Output fsck Errors Instead\" width=\"800\" height=\"189\" srcset=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Skip-Repair-and-Output-fsck-Errors-Instead.png 800w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Skip-Repair-and-Output-fsck-Errors-Instead-300x71.png 300w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Skip-Repair-and-Output-fsck-Errors-Instead-768x181.png 768w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Skip-Repair-and-Output-fsck-Errors-Instead-640x151.png 640w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Skip-Repair-and-Output-fsck-Errors-Instead-400x95.png 400w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/a><\/p>\n<h3><span class=\"ez-toc-section\" id=\"8_Force_a_filesystem_check_with_fsck\"><\/span><strong><u>8: Force a filesystem check with fsck<\/u><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>The program bypasses the filesystem check when you run fsck on a clean device. Use the -f option if you wish to force the filesystem check.<\/p>\n<p><a href=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Force-a-filesystem-check-with-fsck.png\"><img loading=\"lazy\" decoding=\"async\" title=\"Force a filesystem check with fsck\" class=\"wp-image-4289 aligncenter\" src=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Force-a-filesystem-check-with-fsck.png\" alt=\"Force a filesystem check with fsck\" width=\"783\" height=\"159\" srcset=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Force-a-filesystem-check-with-fsck.png 803w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Force-a-filesystem-check-with-fsck-300x61.png 300w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Force-a-filesystem-check-with-fsck-768x156.png 768w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Force-a-filesystem-check-with-fsck-640x130.png 640w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/Force-a-filesystem-check-with-fsck-400x81.png 400w\" sizes=\"(max-width: 783px) 100vw, 783px\" \/><\/a><\/p>\n<p><u>For instance:<\/u><\/p>\n<ul>\n<li><code>fsck -f \/dev\/sdb with sudo<\/code><\/li>\n<\/ul>\n<p><em>What Must You do to Successfully Run the fsck Command on a File System?<\/em> Even if the scan concludes that there are no problems, it will still run all five checks to look for corruption.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"9_Run_fsck_once_on_all_filesystems\"><\/span><strong><u>9: Run fsck once on all filesystems<\/u><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Pass the -A parameter to fsck if you wish to do a check on all filesystems at once. With this selection, the, etc\/fstab file will be read through once.<\/p>\n<p><u>Add the -R option to skip root filesystems since they can&#8217;t be unmounted on a running machine:<\/u><\/p>\n<ul>\n<li><code>-AR fsck<\/code><\/li>\n<\/ul>\n<p>Add the -y option we discussed to get rid of the prompts.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"10_On_a_Specific_Filesystem_skip_fsck\"><\/span><strong><u>10: On a Specific Filesystem, skip fsck<\/u><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>You must put -t and &#8220;no&#8221; before a filesystem if you want fsck to omit to check it.<\/p>\n<p><u>Run this command, for example, to skip the ext3 filesystem:<\/u><\/p>\n<ul>\n<li><code>Doing \"sudo fsck -AR -t noext3 -y\"<\/code><\/li>\n<\/ul>\n<p>To avoid the prompts, we added -y.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"11_On_mounted_filesystems_omit_Fsck\"><\/span><strong><u>11: On mounted filesystems, omit Fsck<\/u><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Add the -M option to prevent attempting to run fsck on a mounted filesystem. The fsck utility will skip any mounted filesystems if it receives this flag.<\/p>\n<p><u>We will run fsck on sdb both when it is mounted and when it is unmounted to demonstrate the differences:<\/u><\/p>\n<ul>\n<li><code>fsck -M \/dev\/sdb with sudo<\/code><\/li>\n<\/ul>\n<p><a href=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/On-mounted-filesystems.png\"><img loading=\"lazy\" decoding=\"async\" title=\"On mounted filesystems\" class=\"wp-image-4288 size-full aligncenter\" src=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/On-mounted-filesystems.png\" alt=\"On mounted filesystems\" width=\"805\" height=\"181\" srcset=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/On-mounted-filesystems.png 805w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/On-mounted-filesystems-300x67.png 300w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/On-mounted-filesystems-768x173.png 768w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/On-mounted-filesystems-640x144.png 640w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2022\/11\/On-mounted-filesystems-400x90.png 400w\" sizes=\"(max-width: 805px) 100vw, 805px\" \/><\/a><\/p>\n<p>The tool terminates when sdb is mounted without performing a check. We then unmount sdb and issue the same command once more. This time, fsck examines the disc and determines if it is clean or has errors.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"On_the_Linux_Root_Partition_Run_Fsck\"><\/span><strong>On the Linux Root Partition, Run Fsck<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>As we already mentioned, because they are mounted and being used, root partitions on a running machine cannot be checked by fsck. However, if you boot into recovery mode and do the fsck check, even the Linux root partitions can be examined:<\/p>\n<p><u>1: To achieve this, start or restart your computer using the GUI or the terminal:<\/u><\/p>\n<ul>\n<li><code>sudo restart<\/code><\/li>\n<\/ul>\n<p><u>2: During boot-up, hold down the shift key. The menu for GNU GRUB appears.<\/u><\/p>\n<p><u>3: For Ubuntu, choose Advanced options.<\/u><\/p>\n<p><u>4: After that, choose the option marked (recovery mode) at the conclusion. Let the Recovery Menu load on the computer.<\/u><\/p>\n<p><u>5: From the menu, choose fsck.<\/u><\/p>\n<p><u>6: Select the option when prompted.<\/u><\/p>\n<p><u>7: To restart the computer after finishing, choose resume from the recovery menu.<\/u><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span><strong>Conclusion<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>What Must You do to Successfully Run the fsck Command on a File System? You now understand how to inspect and repair filesystems using the Linux command fsck. Examples of the tool&#8217;s capabilities and features were presented in the handbook.<\/p>\n<p>Before executing the instructions listed, make sure you have root permissions. Visit the fsck Linux man page or the tool&#8217;s man file for a thorough explanation of all the options.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Linux software fsck (File System Consistency Check) checks file systems for mistakes or unresolved problems. The program is used to provide reports and correct potential problems. Let\u2019s see the solution to this question What Must You do to Successfully Run the fsck Command on a File System? Linux distributions by default include this tool. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":6283,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[],"table_tags":[],"class_list":["post-4286","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts\/4286","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/comments?post=4286"}],"version-history":[{"count":4,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts\/4286\/revisions"}],"predecessor-version":[{"id":8492,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts\/4286\/revisions\/8492"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/media\/6283"}],"wp:attachment":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/media?parent=4286"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/categories?post=4286"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/tags?post=4286"},{"taxonomy":"table_tags","embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/table_tags?post=4286"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}