{"id":1629,"date":"2009-01-09T22:07:24","date_gmt":"2009-01-10T03:07:24","guid":{"rendered":"http:\/\/www.starkeith.net\/coredump\/?p=1629"},"modified":"2012-03-16T17:42:32","modified_gmt":"2012-03-16T21:42:32","slug":"gparted-why-hast-thou-forsaken-me","status":"publish","type":"post","link":"https:\/\/www.starkeith.net\/coredump\/2009\/01\/09\/gparted-why-hast-thou-forsaken-me\/","title":{"rendered":"GParted, Why Hast Thou Forsaken Me?"},"content":{"rendered":"<p><strong>UPDATE March 16 2012<\/strong> &#8211; there is <em>finally<\/em> a solution to this problem &#8211; read the updates at the end of this article for details.<\/p>\n<hr \/>\n<p>Longtime readers will remember the <a href=\"http:\/\/www.starkeith.net\/coredump\/2008\/05\/12\/computer-drama\/\">computer drama<\/a> that unfolded back in May of 2008 when I bought my new 500 GB hard drive. Basically, when I tried to resize my NTFS partitions, <a href=\"http:\/\/gparted.sourceforge.net\/\">GParted<\/a> (or, more specifically, the tool <a href=\"http:\/\/www.linux-ntfs.org\/\">ntfsresize<\/a>) said &#8220;<em>you&#8217;ve got bad sectors on your disk, I&#8217;m not touching anything<\/em>&#8221; and refused to run. I eventually lost the battle and settled for a (less than ideal) configuration for my new disk.<\/p>\n<p>Fast-forward to today &#8211; the <a href=\"http:\/\/www.microsoft.com\/windows\/windows-7\/\">public beta of Windows 7<\/a> is meant to come out today, and although there&#8217;s always the virtual machine route, for something like this I thought it might be worthwhile to dual-boot so it could have the full power of my machine (Vista under Virtual PC is OK, but <em>sloooooow<\/em> &#8211; imagine what a <em>beta <\/em>version of an even <em>newer <\/em>OS would be like?).<\/p>\n<p>Since Microsoft&#8217;s web servers seem to be totally overwhelmed with the demand for Windows 7, they&#8217;ve taken the download off-line for the time being. So, given that it seems like I might have to wait a bit, I figured I might as well download the latest <a href=\"http:\/\/gparted.sourceforge.net\/livecd.php\">GParted LiveCD<\/a> (version 0.4.1-2 in case you&#8217;re curious) and make a little partition space available.<\/p>\n<p>As you might imagine from the title of this post, I wasn&#8217;t able to do it. It was the same problem as before &#8211; there were &#8220;bad&#8221; sectors on the disk, so ntfsresize refused to do anything. Oh, sure, I <em>could <\/em>have tried to do it from the command line and used the <code>--bad-sectors<\/code> option of ntfsresize, but I&#8217;m not one for specifying disk sizes based on cluster locations, which is how you&#8217;d have to do it. And I couldn&#8217;t even get the parameters that the GUI interface would have used when resizing, because it wouldn&#8217;t even let me <em>try<\/em> to resize under the GUI to get the parameters!<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/www.starkeith.net\/coredump\/wp-content\/uploads\/\/2009\/01\/gparted2.jpeg\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1631\" data-permalink=\"https:\/\/www.starkeith.net\/coredump\/2009\/01\/09\/gparted-why-hast-thou-forsaken-me\/gparted2\/\" data-orig-file=\"https:\/\/www.starkeith.net\/coredump\/wp-content\/uploads\/\/2009\/01\/gparted2.jpeg\" data-orig-size=\"775,500\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"gparted2\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.starkeith.net\/coredump\/wp-content\/uploads\/\/2009\/01\/gparted2.jpeg\" class=\"aligncenter size-medium wp-image-1631\" title=\"gparted2\" src=\"http:\/\/www.starkeith.net\/coredump\/wp-content\/uploads\/\/2009\/01\/gparted2-300x193.jpg\" alt=\"\" width=\"300\" height=\"193\" srcset=\"https:\/\/www.starkeith.net\/coredump\/wp-content\/uploads\/2009\/01\/gparted2-300x193.jpg 300w, https:\/\/www.starkeith.net\/coredump\/wp-content\/uploads\/2009\/01\/gparted2.jpeg 775w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>After all, what&#8217;s the point of a GUI LiveCD if you can&#8217;t use the GUI!<\/p>\n<p>What&#8217;s even more confusing\/infuriating is that every forum post or help document I could find on this subject seems to go like this:<\/p>\n<blockquote><p><strong>Novice User: <\/strong>I&#8217;m getting this &#8220;bad sector&#8221; warning &#8211; but I ran CHKDSK two times like it said, it found no bad sectors (or it found one and repaired it), but I still can&#8217;t run ntfsresize!<\/p>\n<p><strong>Linux Guru: <\/strong>Your disk is failing, get a new one.<\/p>\n<p><strong>Novice User:<\/strong> But&#8230;<\/p>\n<p><strong>Linux Guru:<\/strong> YOUR DISK IS FAILING AND WILL DIE SOON GET A NEW ONE IT&#8217;S NOT A PROBLEM WITH NTFSRESIZE YOU JUST NEED A NEW HARD DRIVE DON&#8217;T QUESTION ME.<\/p><\/blockquote>\n<p>I have, of course, embellished this somewhat for dramatic effect, but you get the idea. The assumption is always that the problem is with the hardware. (Even the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Ntfsresize\">Wikipedia article on ntfsresize<\/a> seems to support this point of view, although in fairness it <em>is<\/em> marked as [citation needed]!) I can understand a certain amount of healthy skepticism (in many cases bad sectors are a legitimate sign of a dying hard drive), but there seems to be a certain amount of&#8230; I don&#8217;t know, <em>denial<\/em> &#8211; for lack of a better word &#8211; going on with respect to bad sectors that aren&#8217;t actually all that &#8220;bad.&#8221;<\/p>\n<p>If your hard drive develops a bad sector (as a result of a sudden power loss situation, for example &#8211; which is what caused my bad sectors), CHKDSK for Windows will find the problem, recover what data it can, and mark the sector as &#8220;bad&#8221; so it doesn&#8217;t get used again. Barring another power loss situation (fixed for me since I now have a UPS for my computer), the drive should be just fine for the rest of its natural life.<\/p>\n<p>Likewise with defects that were detected by the manufacturer (but not bad enough to reject the disk over) and marked as &#8220;bad&#8221; before they left the factory. I <em>know<\/em> they used to do this with disks &#8211; I assume they still do.<\/p>\n<p>So, it certainly seems like there are situations (possibly quite common) where a drive will have &#8220;bad&#8221; sectors, but should still be safe to use and operate on. After all, the fact that they were marked &#8220;bad&#8221; means that they were detected and won&#8217;t be used again.<\/p>\n<p>Of course, I <em>do<\/em> have to mention again that ntfsresize has a <code>--bad-sectors<\/code> option which will ignore bad sectors&#8230; but there&#8217;s no way to access this option from the GParted GUI. You HAVE to do it from the command line &#8211; which kind of defeats the point. The whole wonderful thing about GParted in the first place is that it&#8217;s a <em>graphical<\/em> way to resize your disk partitions. I&#8217;m a geek, but even I don&#8217;t like to have to specify partition sizes by sector\/cylinder offsets.<\/p>\n<p>So, if you were to ask me, I&#8217;d say that either:<\/p>\n<ul>\n<li>ntfsresize should be a little more forgiving regarding bad sectors; or<\/li>\n<li>The GParted UI should detect the ntfsresize error and allow the user to proceed with the <code>--bad-sectors<\/code> option, obviously with a stern warning about making sure you&#8217;ve checked the disk thoughougly with CHKDSK or some other tool to make sure there are no further problems and the drive isn&#8217;t failing even more.<\/li>\n<\/ul>\n<p>I know this post ended up being sort of just me whining &#8211; but I do wish that I could resize my disks with GParted. I <em>like<\/em> GParted &#8211; I think it&#8217;s a great tool &#8211; but, unfortunately, it&#8217;s just not a tool I can use anymore.<\/p>\n<p>If anyone has any tips or ideas on how I might be able to work around this limitation &#8211; or of perhaps another partition-resizing tool (free and\/or open source preferred, of course!), I&#8217;d love to hear from you &#8211; feel free to speak up in the comments!<\/p>\n<p><strong>UPDATE:<\/strong> I&#8217;ve found a program called <a href=\"http:\/\/www.partition-tool.com\/personal.htm\">EASEUS Partition Manager<\/a> &#8211; it&#8217;s free for the &#8220;home&#8221; edition. (But not open-source, unfortunately.) I&#8217;ll update with a new post if I&#8217;m able to resize my partition, but first I need to do a full backup, just in case!<\/p>\n<p><strong>UPDATE 2:<\/strong> <a href=\"http:\/\/www.starkeith.net\/coredump\/2009\/01\/11\/bad-sectors-low-level-format\/\">Follow up article here<\/a> &#8211; the news isn&#8217;t good, I&#8217;m afraid.<\/p>\n<p><strong>UPDATE 3:<\/strong> A very nice reader emailed me to point me to this solution from <a title=\"Unfinished Teleporter\" href=\"http:\/\/www.unfinishedteleporter.com\/\" target=\"_blank\">Unfinished Teleporter<\/a>: <a title=\"Gparted won't shrink an NTFS partition with a bad sector\" href=\"http:\/\/www.unfinishedteleporter.com\/?p=3238\" target=\"_blank\">Gparted won&#8217;t shrink an NTFS partition with a bad sector<\/a>.<\/p>\n<p>Basically, you create an executable bash script which adds the <code>--bad-sectors<\/code> option to the original ntfsresize program. You can see the steps in the article I linked above, or follow these general steps:<\/p>\n<ol>\n<li>Locate the <strong>ntfsresize<\/strong> executable (for the GParted live CD it will be in <strong>\/usr\/bin<\/strong>, for Parted Magic it is in <strong>\/usr\/sbin<\/strong>).<\/li>\n<li>Rename it to <strong>ntfsresize.orig<\/strong>.<\/li>\n<li>Create a new bash script at the same location named <strong>ntfsresize<\/strong>. (See below for what you should put in this script.)<\/li>\n<li>Use chmod to ensure the new script is executable (<strong>chmod 755<\/strong> will do the trick).<\/li>\n<li>Run GParted as normal.\u00a0 It will ignore the bad sector(s).<\/li>\n<\/ol>\n<p>In the bash script itself, you&#8217;ll want to add these two lines:<\/p>\n<p><code>#!\/bin\/bash<br \/>\nexec ntfsresize.orig --bad-sectors \"$@\"<\/code><\/p>\n<p>This will call the original ntfsresize that you renamed, tack on the <code>--bad-sectors<\/code> option, and then pass whatever other options GParted (or whatever you are using) called it with originally.<\/p>\n<p>I haven&#8217;t been able to try this myself (I&#8217;ve long since upgraded to another, newer computer), but I&#8217;ve been told this works like a charm. So if you are having this same sort of problem, give this a try!<\/p>\n<p>Of course, before doing this you should be sure you&#8217;ve <em><strong>backed up all your data<\/strong><\/em>, since this is technically overriding a fail-safe feature of ntfsresize.<\/p>\n<p>Anyway, I hope someone finds this useful &#8211; and thanks again to that very nice reader who pointed out this solution to me!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The trouble with using GParted to resize an NTFS partition that has supposedly &#8220;bad&#8221; sectors (and, finally, a solution!).<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"webmentions_disabled_pings":false,"webmentions_disabled":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":"","jetpack_post_was_ever_published":false},"categories":[5],"tags":[23,198,97],"class_list":["post-1629","post","type-post","status-publish","format-standard","hentry","category-technology","tag-computers","tag-hardware","tag-software","entry"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pimUj-qh","jetpack-related-posts":[{"id":1644,"url":"https:\/\/www.starkeith.net\/coredump\/2009\/01\/11\/bad-sectors-low-level-format\/","url_meta":{"origin":1629,"position":0},"title":"Bad Sectors? Low-Level Format","author":"Keith Survell","date":"January 11, 2009","format":false,"excerpt":"It seems like there IS a way to \"clear\" bad sectors from your hard drive so you can use tools like GParted and the like - but I use \"clear\" in a very loose sense here! First off, I MUST point out that I'm talking about file-system bad sectors. I'm\u2026","rel":"","context":"In &quot;My Life&quot;","block_context":{"text":"My Life","link":"https:\/\/www.starkeith.net\/coredump\/category\/personal\/my-life\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1108,"url":"https:\/\/www.starkeith.net\/coredump\/2008\/05\/12\/computer-drama\/","url_meta":{"origin":1629,"position":1},"title":"Computer Drama","author":"Keith Survell","date":"May 12, 2008","format":false,"excerpt":"So, my new 500 GB hard drive arrived the other day. Thus began the 3-part geek tragedy that accompanies any computer upgrade. First off, let me say that it's been a while since I've done this. The last time I installed a new hard drive in my computer, Ultra DMA\u2026","rel":"","context":"In &quot;personal&quot;","block_context":{"text":"personal","link":"https:\/\/www.starkeith.net\/coredump\/category\/personal\/"},"img":{"alt_text":"Hard Drive","src":"https:\/\/i0.wp.com\/www.starkeith.net\/coredump\/wp-content\/uploads\/\/2008\/05\/2282011834_86ab2eaa11_m.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1094,"url":"https:\/\/www.starkeith.net\/coredump\/2008\/05\/01\/a-computer-conundrum\/","url_meta":{"origin":1629,"position":2},"title":"A Computer Conundrum","author":"Keith Survell","date":"May 1, 2008","format":false,"excerpt":"Once again, I've filled up my hard drive. It's inevitable, really - I tend to keep everything, and my music, picture, and video collections are quite... extensive. What's sad is that I bought my computer a little over a year ago, and I distinctly remember remaking that its 160 GB\u2026","rel":"","context":"In &quot;personal&quot;","block_context":{"text":"personal","link":"https:\/\/www.starkeith.net\/coredump\/category\/personal\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4922,"url":"https:\/\/www.starkeith.net\/coredump\/2017\/01\/19\/new-year-another-new-computer\/","url_meta":{"origin":1629,"position":3},"title":"New Year, Another New Computer","author":"Keith Survell","date":"January 19, 2017","format":false,"excerpt":"It's been 7 years since my last new computer, and so I decided it was time to finally bite the bullet and not only upgrade, but build a new computer myself. The last two of my computers were pre-built PCs, bought mainly because in both cases I didn't have the\u2026","rel":"","context":"In &quot;My Life&quot;","block_context":{"text":"My Life","link":"https:\/\/www.starkeith.net\/coredump\/category\/personal\/my-life\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1832,"url":"https:\/\/www.starkeith.net\/coredump\/2009\/02\/18\/to-delete-or-not-to-delete\/","url_meta":{"origin":1629,"position":4},"title":"To Delete, or Not to Delete","author":"Keith Survell","date":"February 18, 2009","format":false,"excerpt":"To delete or not to delete? That is the (programming) question I'm trying to answer.","rel":"","context":"In &quot;My Opinion&quot;","block_context":{"text":"My Opinion","link":"https:\/\/www.starkeith.net\/coredump\/category\/personal\/my-opinion\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":846,"url":"https:\/\/www.starkeith.net\/coredump\/2007\/02\/13\/truecrypt\/","url_meta":{"origin":1629,"position":5},"title":"TrueCrypt","author":"Keith Survell","date":"February 13, 2007","format":false,"excerpt":"I think this is GREAT software. The ability to make encrypted disks anywhere on your computer (or USB memory device) is a boon to security nuts like me. And the encryption that's available from this software is very, very good. (As an added bonus, it's open source - so you\u2026","rel":"","context":"In &quot;tech&quot;","block_context":{"text":"tech","link":"https:\/\/www.starkeith.net\/coredump\/category\/technology\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.starkeith.net\/coredump\/wp-json\/wp\/v2\/posts\/1629","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.starkeith.net\/coredump\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.starkeith.net\/coredump\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.starkeith.net\/coredump\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.starkeith.net\/coredump\/wp-json\/wp\/v2\/comments?post=1629"}],"version-history":[{"count":0,"href":"https:\/\/www.starkeith.net\/coredump\/wp-json\/wp\/v2\/posts\/1629\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.starkeith.net\/coredump\/wp-json\/wp\/v2\/media?parent=1629"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.starkeith.net\/coredump\/wp-json\/wp\/v2\/categories?post=1629"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.starkeith.net\/coredump\/wp-json\/wp\/v2\/tags?post=1629"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}