{"id":598,"date":"2016-04-06T13:40:32","date_gmt":"2016-04-06T10:40:32","guid":{"rendered":"http:\/\/www.bashpi.org\/?page_id=598"},"modified":"2020-12-31T18:41:50","modified_gmt":"2020-12-31T16:41:50","slug":"ext-filesystem-check-management","status":"publish","type":"page","link":"https:\/\/www.bashpi.org\/?page_id=598","title":{"rendered":"How to check and manipulate Ext file-systems"},"content":{"rendered":"<p>Checking is easy, just run fsck against unmounted file-system.<\/p>\n<pre><code class=\"language-bash\"># fsck -y \/dev\/sda1\n<\/code><\/pre>\n<p>Now if you want to display some information about the file-system use dumpe2fs commandline tool provided by e2fsprogs package on debian.<\/p>\n<pre><code class=\"language-bash\"># dumpe2fs -h \/dev\/sda1<\/code><\/pre>\n<p>Note these lines in the output which mention mount count and check?<\/p>\n<pre><code>Mount count:         43\nMaximum mount count: 50\nLast checked:        Fri Mar 25 20:58:32 2016\nCheck interval:      15552000 (6 months)\nNext check after:    Wed Sep 21 21:58:32 2016\n<\/code><code class=\"language-bash\"><\/code><\/pre>\n<p>You can tune those values with tool like tune2fs. Why? For example to trigger file-system check before next mounting or vice versa, to postpone checking. Tune2fs tool is also provided by e2fsprogs package on debian.<\/p>\n<p>Adjusting maximum mount count before checking to 50 is below. To disable check triggering according to mount count, use &#8220;-1&#8221; as count.<\/p>\n<pre><code class=\"language-bash\"># tune2fs -c 50 \/dev\/sda1<\/code><\/pre>\n<p>Adjust maximum check interval to 3 months is below. Use d\/m\/w to set days,months or weeks. To disable check triggering according to interval from last check, use &#8220;0&#8221; as interval.<\/p>\n<pre><code class=\"language-bash\"># tune2fs -i 3m \/dev\/sda1<\/code><\/pre>\n<p>To trigger check on all ext2\/34 file-systems during next reboot use following piece of code. It sets mount count to 9999 on all mounted ext file-systems so it will have to trigger the check unless you have disabled it by setting maximum mount count to 0 or -1.<\/p>\n<pre><code class=\"language-bash\">for m in ext2 ext3 ext4; do\n    for f in `mount -t ${m} |awk '{print $1}'`; do\n      tune2fs -C 9999 ${f}\n    done\ndone\n<\/code><\/pre>\n<p>If you found this useful, say thanks, click on some banners or <a href=\"http:\/\/www.bashpi.org\/?page_id=105\">donate<\/a>, I can always use some beer money.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Checking is easy, just run fsck against unmounted file-system. # fsck -y \/dev\/sda1 Now if you want to display some information about the file-system use dumpe2fs commandline tool provided by e2fsprogs package on debian. # dumpe2fs -h \/dev\/sda1 Note these lines in the output which mention mount count and check? Mount count: 43 Maximum mount [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":397,"menu_order":0,"comment_status":"closed","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-598","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.bashpi.org\/index.php?rest_route=\/wp\/v2\/pages\/598","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bashpi.org\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.bashpi.org\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.bashpi.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bashpi.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=598"}],"version-history":[{"count":7,"href":"https:\/\/www.bashpi.org\/index.php?rest_route=\/wp\/v2\/pages\/598\/revisions"}],"predecessor-version":[{"id":1100,"href":"https:\/\/www.bashpi.org\/index.php?rest_route=\/wp\/v2\/pages\/598\/revisions\/1100"}],"up":[{"embeddable":true,"href":"https:\/\/www.bashpi.org\/index.php?rest_route=\/wp\/v2\/pages\/397"}],"wp:attachment":[{"href":"https:\/\/www.bashpi.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=598"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}