<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>Autarchy of the Private Cave &#187; NTFS</title> <atom:link href="https://bogdan.org.ua/tags/ntfs/feed" rel="self" type="application/rss+xml" /><link>https://bogdan.org.ua</link> <description>Tiny bits of bioinformatics, [web-]programming etc</description> <lastBuildDate>Wed, 28 Dec 2022 16:09:04 +0000</lastBuildDate> <language>en-US</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>https://wordpress.org/?v=3.8.27</generator> <item><title>ntfstruncate binary for Debian (resetting NTFS bad clusters counter)</title><link>https://bogdan.org.ua/2010/03/01/ntfstruncate-binary-for-debian-resetting-ntfs-bad-clusters-counter.html</link> <comments>https://bogdan.org.ua/2010/03/01/ntfstruncate-binary-for-debian-resetting-ntfs-bad-clusters-counter.html#comments</comments> <pubDate>Mon, 01 Mar 2010 16:55:56 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[bad clusters]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[linux-ntfs]]></category> <category><![CDATA[NTFS]]></category> <category><![CDATA[ntfsprogs]]></category> <category><![CDATA[ntfstruncate]]></category> <category><![CDATA[partition]]></category> <category><![CDATA[pending sectors]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1000</guid> <description><![CDATA[There is an excellent step-by-step instruction on resetting the bad clusters counter of an NTFS partition with linux-ntfs tools. I&#8217;ve checked &#8211; it works as expected: Back up important data from partition just in case Find out size of &#8216;$Bad&#8217; attribute in $Badclus using ntfsinfo -i 8 partition (partition is for example /dev/sda1). It will [&#8230;]]]></description> <content:encoded><![CDATA[<p>There is an <a
href="http://www.linux-ntfs.org/doku.php?id=ntfsclone#reseting_the_bad_sectors_list_after_cloning" class="broken_link" rel="nofollow">excellent step-by-step instruction</a> on resetting the bad clusters counter of an NTFS partition with linux-ntfs tools. I&#8217;ve checked &#8211; it works as expected:</p><blockquote><ol><li>Back up important data from partition just in case</li><li>Find out size of &#8216;$Bad&#8217; attribute in $Badclus using <strong>ntfsinfo -i 8 <em>partition</em></strong> (<em>partition</em> is for example /dev/sda1). It will be the â€œAllocated sizeâ€ value in the â€œDumping attribute $DATA (0<code>x</code>80)â€ (there will be two 0<code>x</code>80 attributes. Only one has an â€œAllocated sizeâ€ line). Let us write down (remember) this size as <em>ntfs_size</em>.</li><li>Use <strong>ntfstruncate <em>partition</em> 8 0<code>x</code>80 &#8216;$Bad&#8217; 0</strong> to set $Bad&#8217;s attribute length to zero.</li><li>Use <strong>ntfstruncate <em>partition</em> 8 0<code>x</code>80 &#8216;$Bad&#8217; <em>ntfs_size</em></strong> to set $Bad&#8217;s attribute length back to proper value <em>ntfs_size</em> which was recorded in step 2.</li><li>Boot into Windows and run <strong>chkdsk -f <em>diskname</em></strong>. It will find errors and should fix them.</li></ol></blockquote><p>However, Debian&#8217;s <strong>ntfsprogs</strong> package does not have the <strong>ntfstruncate</strong> binary.</p><p>Here&#8217;s how you can easily build one yourself (you may need a few extra packages with build tools for that):<br
/> <span
id="more-1000"></span></p><ol><li><strong>apt-get source ntfsprogs</strong></li><li><strong>cd linux-ntfs-2.0.0</strong></li><li><strong>./configure &#038;&#038; make extra</strong></li><li><strong>cd ntfsprogs &#038;&#038; ./ntfstruncate</strong></li></ol><p>You can also install ntfstruncate system-wide, but I have no idea if that will interfere with the already-installed ntfsprogs package, so I just used this binary directly from linux-ntfs-2.0.0/ntfsprogs.</p><p>Bad clusters happen not only when cloning an NTFS partition between 2 physical hard disk drives. Once, after a brief blackout (with a turned on PC, and not on a UPS), the SMART status of my new HDD started showing 1 &#8216;Pending sector&#8217;. Correspondingly, all the SMART tests (performed with a <strong>smartctl</strong> utility) reported read errors. To help my HDD examine and fix the problem itself, I performed a write operation to that single unreadable sector, which restored it (and reset the &#8216;Pending sector&#8217; counter back to zero). It was possible, because not the physical sector itself, but the hidden CRC field had errors after power failure; modern hard drives can detect and fix this kind of errors upon write operations (read operations only mark the sector as &#8216;pending&#8217;, because data read is not consistent with the stored CRC).</p><p>However, NTFS partition still had 4096 bytes in &#8216;bad clusters&#8217;. A little research revealed the presence of internal NTFS bad clusters counter, which can be reset following the procedures above.</p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2010%2F03%2F01%2Fntfstruncate-binary-for-debian-resetting-ntfs-bad-clusters-counter.html&amp;linkname=ntfstruncate%20binary%20for%20Debian%20%28resetting%20NTFS%20bad%20clusters%20counter%29" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2010%2F03%2F01%2Fntfstruncate-binary-for-debian-resetting-ntfs-bad-clusters-counter.html&amp;linkname=ntfstruncate%20binary%20for%20Debian%20%28resetting%20NTFS%20bad%20clusters%20counter%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2010%2F03%2F01%2Fntfstruncate-binary-for-debian-resetting-ntfs-bad-clusters-counter.html&amp;linkname=ntfstruncate%20binary%20for%20Debian%20%28resetting%20NTFS%20bad%20clusters%20counter%29" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2010%2F03%2F01%2Fntfstruncate-binary-for-debian-resetting-ntfs-bad-clusters-counter.html&amp;linkname=ntfstruncate%20binary%20for%20Debian%20%28resetting%20NTFS%20bad%20clusters%20counter%29" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2010%2F03%2F01%2Fntfstruncate-binary-for-debian-resetting-ntfs-bad-clusters-counter.html&amp;linkname=ntfstruncate%20binary%20for%20Debian%20%28resetting%20NTFS%20bad%20clusters%20counter%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2010%2F03%2F01%2Fntfstruncate-binary-for-debian-resetting-ntfs-bad-clusters-counter.html&#038;title=ntfstruncate%20binary%20for%20Debian%20%28resetting%20NTFS%20bad%20clusters%20counter%29" data-a2a-url="https://bogdan.org.ua/2010/03/01/ntfstruncate-binary-for-debian-resetting-ntfs-bad-clusters-counter.html" data-a2a-title="ntfstruncate binary for Debian (resetting NTFS bad clusters counter)"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2010/03/01/ntfstruncate-binary-for-debian-resetting-ntfs-bad-clusters-counter.html/feed</wfw:commentRss> <slash:comments>3</slash:comments> </item> </channel> </rss>