IDE to SATA with no Windows or Linux Reinstall

<meta content="OpenOffice.org 2.0 (Linux)" name="GENERATOR" /><meta content="20060125;9000500" name="CREATED" /><meta content="20060125;10520600" name="CHANGED" /></p> <style> <!-- @page { size: 8.5in 11in; margin: 0.79in } P { margin-bottom: 0.08in } --></style> <p>I recently had the pleasure of finally upgrading my Hard Disks from IDE to SATA. </p> <p style="margin-bottom: 0in">For those who don’t know what SATA is or why I would want to upgrade to it go <a target="_blank" href="http://pcburn.com/article-Linux_SATA_vs_IDE_Performance-pg1.php">HERE</a> before continuing.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Well on my system I have Fedora Core 4 and Windows XP setup in a dual boot configuration where Fedora Core 4 is on the Primary “master” 150 GB IDE drive and Windows XP is on the Primary “slave” 40 GB IDE drive. Now my problem was I didn’t feel like reinstalling both operating systems and all my applications all over again so what I decided to do was to try and clone my drives exactly as the were onto the 2 new SATA drives (300 GB and 250 GB respectively). And here’s what I did.</p> <p style="margin-bottom: 0in"><span id="more-98"></span></p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">The first thing was to make sure SATA drivers were installed on both operating systems. So I booted into both and sure enough both had SATA drivers already installed.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">From there I powered down my PC and plugged in both SATA drives ( in addition to the IDE drives)</p> <p style="margin-bottom: 0in">and Inserted my hand Knoppix DVD (you can get Knoppix <a target="_blank" href="http://www.knoppix.org/">HERE</a> )</p> <p style="margin-bottom: 0in">and booted the computer.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Once it was booted I opened a terminal window. Now what we’re going to do here is mimic the partitions of the old IDE drives on the new larger SATA drives. Now the IDE drives will usually be labeled as follows.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">IDE1 (primary master) /dev/hda</p> <p style="margin-bottom: 0in">IDE2 (primary slave) /dev/hdb</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">So to get the current partitions info what we want to type is</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"># sudo fdisk -l /dev/hda</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">the output will look similar to the following</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Disk /dev/hda: 81.9 GB, 81964302336 bytes</p> <p style="margin-bottom: 0in">255 heads, 63 sectors/track, 9964 cylinders</p> <p style="margin-bottom: 0in">Units = cylinders of 16065 * 512 = 8225280 bytes</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Device Boot Start End Blocks Id System</p> <p style="margin-bottom: 0in">/dev/hda1 * 1 5 40131 83 Linux</p> <p style="margin-bottom: 0in">/dev/hda2 6 68 506047+ 82 Linux swap / Solaris</p> <p style="margin-bottom: 0in">/dev/hda3 69 9964 79489620 83 Linux</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">so what we want to do is mimic this on the new drives to do this we type</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"># sudo fdisk /dev/sda</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">then press “n” to create a new partitions</p> <p style="margin-bottom: 0in">you will then be prompted to choose a primary or extended partition. we want primary so press “p”</p> <p style="margin-bottom: 0in">then you’ll be prompted for the partition number so hit “1”</p> <p style="margin-bottom: 0in">You are now prompted for the starting block. So using our example this would be 1</p> <p style="margin-bottom: 0in">then you’re prompted for the last or end block. So again referring to our example above we would use 5</p> <p style="margin-bottom: 0in">next you want to make sure the partition type matches so press “t” then type in the number in the “Id” column in our example this would be 83.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">***WARNING****</p> <p style="margin-bottom: 0in">Please note that if this is a Linux drive you may have to switch some partitions around if your swap partition is last. You want your data (or root partitions to be last). It’s fine to move the swap and data partitions around as long as their size stays consistent.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">After you’ve finished setting your partitions you have to set one as active (or bootable) to do this press “a” then the partition you want to make bootable. (usually 1)</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Now you want to write your changes so press “p” to review them then if they are correct press ”w”</p> <p style="margin-bottom: 0in">Cheers you now have a shiny new drive ready to receive your data.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Now this is the most time consuming part.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">We are going to use dd to copy the data from the old partitions to the new partitions.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">First my windows drive.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">We have /dev/hdb1 as the donor drive and /dev/sdb1 as the recipient so we use the following.</p> <p style="margin-bottom: 0in"># dd if=/dev/hdb1 of=/dev/sdb1</p> <p style="margin-bottom: 0in">Note this will take a LONG time (I left it overnight)</p> <p style="margin-bottom: 0in">After this is done you have to copy over the MBR as follows</p> <p style="margin-bottom: 0in"># dd if=/dev/hdb of=/dev/sdb bs=512 count=1</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Your windows drive is now bootable.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Now we’re going to do the same thing for the Linux drive (minus the MBR stuff)</p> <p style="margin-bottom: 0in">so do the following dd commands in order (this puts the longest one last)</p> <p style="margin-bottom: 0in"># dd if=/dev/hda1 of=/dev/sda1</p> <p style="margin-bottom: 0in"># dd if=/dev/hda2 of=/dev/sda2</p> <p style="margin-bottom: 0in"># dd if=/dev/hda3 of=/dev/sda3</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Once all the copying is done we need to make Linux bootable.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">So assuming we are now booted in to knoppix you can do this with the following instructions</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">at a terminal type</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"># su</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"># fdisk -l</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"># mkdir /mnt/clone</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"># mount -o rw /dev/sda3 /mnt/clone</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"># chroot /mnt/clone</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">You are now in your Linux environment</p> <p style="margin-bottom: 0in">make sure to mount your boot partition if you have one</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"># mount /dev/sda1 /boot</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">//For GRUB</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"># mv /boot/grub/stage1 /boot/grub/stage1.old</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"># mv /boot/grub/stage2 /boot/grub/stage2.old</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"># mv /boot/grub/device.map /boot/grub/device.map.old</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"># grub-install /dev/sda</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">END GRUB //</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">For LILO</p> <p style="margin-bottom: 0in"># /sbin/lilo</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">That’s it now you can shutdown remove the IDE drives and try and boot of the SATA drives.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">At this point you should get your GRUB or LiLo screen and be able to boot into your respective OS</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">But we still have one problem the partitions are still the same size as before so we see no benefit from the larger drives.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Well time to boot back up with Knoppix.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">***** Warning*****</p> <p style="margin-bottom: 0in">Altering partitions and filesystems can cause data loss do this at your own risk</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">One booted up open QtParted</p> <p style="margin-bottom: 0in">We can use this to resize the Windows NTFS partition</p> <p style="margin-bottom: 0in">Once you’ve done that commit the changes and we should be good.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">For the Linux partition you need to resize the partition and then resize the filesystem</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">To resize the partition you do the following</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Open a terminal</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"># su</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"># fdisk /dev/sda</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">type “p” to print the current partitions</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">type “d” to delete a partition (In my case partition 3)</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">now type “n” to create a new partition. (Note that the partition must start in the same place as the old one or you will corrupt and lose data)</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Usually if you accept all the defaults it will create a partition to fill the rest of the drive.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Type “p” again to confirm the changes are correct then type “w” to write them and “q” to quit fdisk.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Now we need to resize the filesystem</p> <p style="margin-bottom: 0in">to do this we use resize2fs with the following syntax</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"># resize2fs /dev/sda3</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">This resizes the sda3 partitions filesystem to fill the partition.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Now you’re done!</p> <p style="margin-bottom: 0in">Hopefully this has been useful to some of you. If you’re lazy like me and don’t want to go through the pain in the ass of reinstalling 2 Operating Systems just to upgrade your drives this is nothing short of a necessity.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Cheers and Good Luck</p> <p><!--more--></p> <div><em>If you enjoyed this post, make sure you <a href="https://liamm.com/feed">subscribe to my RSS feed</a>! </em></div> <div id='jp-relatedposts' class='jp-relatedposts' > <h3 class="jp-relatedposts-headline"><em>Related</em></h3> </div> </div><!-- .entry-content --> <div class="author-info"> <h2 class="author-heading">Published by</h2> <div class="author-avatar"> <img alt='' src='http://0.gravatar.com/avatar/9492de0c0d4546edf813a7fd8aa6569b?s=56&d=retro&r=pg' srcset='http://0.gravatar.com/avatar/9492de0c0d4546edf813a7fd8aa6569b?s=112&d=retro&r=pg 2x' class='avatar avatar-56 photo' height='56' width='56' /> </div><!-- .author-avatar --> <div class="author-description"> <h3 class="author-title">LiamM</h3> <p class="author-bio"> I'm a self labeled Nerd who enjoys Playing Video Games, restoring classic muscle cars (i have a 65' Mustang in the works) , Running Big Data Clusters, Tattoos, Working on System Automation, Riding and customizing Motorcycles, and writing python Code. I'm an SRE with DemonWare/Activision Specializing in Big Data/Hadoop operations but all opinions and views expressed on this site are solely my own. <a class="author-link" href="https://liamm.com/author/liamm" rel="author"> View all posts by LiamM </a> </p><!-- .author-bio --> </div><!-- .author-description --> </div><!-- .author-info --> <footer class="entry-footer"> <span class="posted-on"><span class="screen-reader-text">Posted on </span><a href="https://liamm.com/tech/ide-to-sata-with-no-windows-or-linux-reinstall" rel="bookmark"><time class="entry-date published" datetime="2006-01-25T11:54:13+00:00">January 25, 2006</time><time class="updated" datetime="2006-01-25T12:09:14+00:00">January 25, 2006</time></a></span><span class="byline"><span class="author vcard"><span class="screen-reader-text">Author </span><a class="url fn n" href="https://liamm.com/author/liamm">LiamM</a></span></span><span class="cat-links"><span class="screen-reader-text">Categories </span><a href="https://liamm.com/category/diy" rel="category tag">DIY</a>, <a href="https://liamm.com/category/linux" rel="category tag">Linux</a>, <a href="https://liamm.com/category/tech" rel="category tag">Tech</a></span> </footer><!-- .entry-footer --> </article><!-- #post-## --> <div id="social"> <div class="social-post"> <div id="loading" style="display:none"> <input type="hidden" id="reload_url" value="https://liamm.com/index.php?social_controller=auth&social_action=reload_form&redirect_to=https://liamm.com/tech/ide-to-sata-with-no-windows-or-linux-reinstall&post_id=98" /> Logging In... </div> <div id="respond" class="comment-respond"> <h3 id="reply-title" class="comment-reply-title">Profile <small><a rel="nofollow" id="cancel-comment-reply-link" href="/tech/ide-to-sata-with-no-windows-or-linux-reinstall#respond" style="display:none;">cancel</a></small></h3> <form action="http://liamm.com/wp-comments-post.php" method="post" id="commentform" class="comment-form" novalidate> <div class="social-sign-in-links social-clearfix"> <a class="social-twitter social-imr social-login comments" href="https://liamm.com/index.php?social_controller=auth&social_action=authorize&key=twitter&post_id=98" id="twitter_signin" target="_blank">Sign in with Twitter</a> <a class="social-facebook social-imr social-login comments" href="https://liamm.com/index.php?social_controller=auth&social_action=authorize&key=facebook&post_id=98" id="facebook_signin" target="_blank">Sign in with Facebook</a> </div> <div class="social-divider"> <span>or</span> </div> <p class="social-input-row social-input-row-comment"><label for="comment" class="social-label">Comment</label><textarea id="comment" name="comment" class="social-input" required="required"></textarea></p><p class="social-input-row social-input-row-author"><label for="author" class="social-label">Name</label><input id="author" name="author" class="social-input" required="required" type="text" value="" /></p> <p class="social-input-row social-input-row-email"><label for="email" class="social-label">Email</label><input id="email" name="email" class="social-input" required="required" type="text" value="" /><small class="social-help">Not published</small></p> <p class="social-input-row social-input-row-url"><label for="url" class="social-label">Website</label><input id="url" name="url" class="social-input" type="text" value="" /></p> <p class="form-submit"><input name="submit" type="submit" id="submit" class="submit" value="Post It" /> <input type='hidden' name='comment_post_ID' value='98' id='comment_post_ID' /> <input type='hidden' name='comment_parent' id='comment_parent' value='0' /> <input type="hidden" id="use_twitter_reply" name="use_twitter_reply" value="0" /><input type="hidden" id="in_reply_to_status_id" name="in_reply_to_status_id" value="" /></p><div id="commentform-extras"><p style="display: none;"><input type="hidden" id="akismet_comment_nonce" name="akismet_comment_nonce" value="e4235f8b19" /></p><p class="comment-subscription-form"><input type="checkbox" name="subscribe_comments" id="subscribe_comments" value="subscribe" style="width: auto; -moz-appearance: checkbox; -webkit-appearance: checkbox;" /> <label class="subscribe-label" id="subscribe-label" for="subscribe_comments">Notify me of follow-up comments by email.</label></p><p class="comment-subscription-form"><input type="checkbox" name="subscribe_blog" id="subscribe_blog" value="subscribe" style="width: auto; -moz-appearance: checkbox; -webkit-appearance: checkbox;" /> <label class="subscribe-label" id="subscribe-blog-label" for="subscribe_blog">Notify me of new posts by email.</label></p><p style="display: none;"><input type="hidden" id="ak_js" name="ak_js" value="34"/></p></div> </form> </div><!-- #respond --> </div> <div id="social-tabs-comments"> </div> <!-- #Comments Tabs --> </div> <nav class="navigation post-navigation" role="navigation"> <h2 class="screen-reader-text">Post navigation</h2> <div class="nav-links"><div class="nav-previous"><a href="https://liamm.com/tech/forensic-thwarting-tools" rel="prev"><span class="meta-nav" aria-hidden="true">Previous</span> <span class="screen-reader-text">Previous post:</span> <span class="post-title">Forensic Thwarting Tools</span></a></div><div class="nav-next"><a href="https://liamm.com/tech/custom-linux-install-isos-from-instalinux-built-on-linuxcoe" rel="next"><span class="meta-nav" aria-hidden="true">Next</span> <span class="screen-reader-text">Next post:</span> <span class="post-title">Custom Linux install ISOs from Instalinux (built on LinuxCOE)</span></a></div></div> </nav> </main><!-- .site-main --> </div><!-- .content-area --> <script type="text/javascript"> /* <![CDATA[ */ (function() { var s = document.createElement("script"); s.type = "text/javascript"; s.src = "https://intensedebate.com/js/wordpressTemplateLinkWrapper2.php?acct=a35dc6a889c239a94d5be01fb88e7d7d"; document.getElementsByTagName("head")[0].appendChild(s); }()); /* ]]> */ </script> </div><!-- .site-content --> <footer id="colophon" class="site-footer" role="contentinfo"> <div class="site-info"> <a href="https://wordpress.org/">Proudly powered by WordPress</a> </div><!-- .site-info --> </footer><!-- .site-footer --> </div><!-- .site --> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-384650-2"); pageTracker._initData(); pageTracker._trackPageview(); </script> <script type="text/javascript"> //<![CDATA[ if (document.getElementsByTagName) { var ahrefs = document.getElementsByTagName('a'); for (var i=0; i<ahrefs.length;i++) { if (ahrefs[i].href.indexOf('https://liamm.com') == -1 && !ahrefs[i].onclick) { ahrefs[i].onclick = function () { var track = this.href + ''; urchinTracker ('/outgoing/'+track.substring(7)); } } } } //]]> </script> <div style="display:none"> <div class="grofile-hash-map-9492de0c0d4546edf813a7fd8aa6569b"> </div> </div> <script type='text/javascript' src='http://liamm.com/wp-content/plugins/akismet/_inc/form.js?ver=3.3'></script> <script type='text/javascript' src='http://liamm.com/wp-content/plugins/jetpack/modules/photon/photon.js?ver=20130122'></script> <script type='text/javascript' src='https://s0.wp.com/wp-content/js/devicepx-jetpack.js?ver=201717'></script> <script type='text/javascript'> /* <![CDATA[ */ var Sociali18n = {"commentReplyTitle":"Post a Reply"}; /* ]]> */ </script> <script type='text/javascript' src='http://liamm.com/wp-content/plugins/social/assets/social.js?ver=3.1.1'></script> <script type='text/javascript' src='http://s.gravatar.com/js/gprofiles.js?ver=2017Apraa'></script> <script type='text/javascript'> /* <![CDATA[ */ var WPGroHo = {"my_hash":""}; /* ]]> */ </script> <script type='text/javascript' src='http://liamm.com/wp-content/plugins/jetpack/modules/wpgroho.js?ver=4.7.4'></script> <script type='text/javascript' src='http://liamm.com/wp-content/themes/twentyfifteen/js/skip-link-focus-fix.js?ver=20141010'></script> <script type='text/javascript' src='http://liamm.com/wp-includes/js/comment-reply.min.js?ver=4.7.4'></script> <script type='text/javascript'> /* <![CDATA[ */ var screenReaderText = {"expand":"<span class=\"screen-reader-text\">expand child menu<\/span>","collapse":"<span class=\"screen-reader-text\">collapse child menu<\/span>"}; /* ]]> */ </script> <script type='text/javascript' src='http://liamm.com/wp-content/themes/twentyfifteen/js/functions.js?ver=20150330'></script> <script type='text/javascript' src='http://liamm.com/wp-includes/js/wp-embed.min.js?ver=4.7.4'></script> <script type='text/javascript' src='https://stats.wp.com/e-201717.js' async defer></script> <script type='text/javascript'> _stq = window._stq || []; _stq.push([ 'view', {v:'ext',j:'1:4.6',blog:'108384219',post:'98',tz:'-7',srv:'liamm.com'} ]); _stq.push([ 'clickTrackerInit', '108384219', '98' ]); </script> </body> </html>