{"id":1,"date":"2013-04-25T06:35:42","date_gmt":"2013-04-25T06:35:42","guid":{"rendered":"https:\/\/rebrik.info\/blog\/?p=1"},"modified":"2013-04-26T20:23:14","modified_gmt":"2013-04-26T20:23:14","slug":"hello-world","status":"publish","type":"post","link":"https:\/\/rebrik.info\/blog\/?p=1","title":{"rendered":"Moving bootable NTFS partition to a new drive"},"content":{"rendered":"<p>My old video PC started acting up &#8211; it was losing BIOS settings randomly. So I&#8217;ve replaced the motherboard, installed Windows XP, software, &#8230; Everything worked fine but the ancient IDE disk from Maxtor turned out to be very noisy. So I&#8217;ve ordered an SSD &#8211; the cheapest and hence the smallest I could get. Just enough to install the OS: all videos and music are located on a Samba server. When the new disk arrived, I decided to copy Windows XP partition to the new disk &#8211; installing XP again is no fun.<\/p>\n<p><strong>Starting state and notation:<\/strong><\/p>\n<ul>\n<li>Maxtor 160GB disk with 80GB NTFS boot partition &#8211; I&#8217;ll call it <strong>HD<\/strong><\/li>\n<li>OSZ 32GB disk &#8211; I&#8217;ll call it <strong>SSD<\/strong><\/li>\n<li>Windows XP PC &#8211; I&#8217;ll call it <strong>XP<\/strong><\/li>\n<li>Ubuntu PC &#8211; I&#8217;ll call it <strong>Ubuntu<\/strong><\/li>\n<\/ul>\n<p>Here is what I did. It is not a step-by-step instruction, just a description of what actually worked (I tried other options). Use at your own risk.<\/p>\n<p>Connected SSD and HD to my Ubuntu, the disks were labeled as:<br \/>\nsdg &#8211; SSD (destination)<br \/>\nsdf &#8211; HD (source)<br \/>\nCheck these labels every time you connect a disk to Ubuntu.<\/p>\n<p>Since I already &#8220;played&#8221; with the SSD, I needed to clean-up the config area. The command below will delete all partitions, MBR,\u00a0 EVERYTHING. Be very careful not to use it on a wrong drive:<\/p>\n<pre class=\"brush: bash; gutter: false\">sudo dd if=\/dev\/zero of=\/dev\/sdg count=1024<\/pre>\n<p>Plug SSD into XP. Go to the Disk Manager, initialize the disk, create full-disk NTFS partition (32GB), mark this partition as active. Try to boot XP from this disk &#8211; it should produce an error &#8220;NTLDR not found&#8221; It means that MBR is OK and the partition is bootable.<\/p>\n<p>We need to shrink 80GB partition on HD &#8211;\u00a0 SSD is only 32GB. New size will be 24GB:<\/p>\n<pre class=\"brush: bash; gutter: false\">sudo ntfsresize -s 24G\u00a0 \/dev\/sdf1<\/pre>\n<p>At this point we have a 24GB NTFS volume on a 80GB partition. Yes, NTFS volumes can be smaller than the partition they are in.<\/p>\n<p>Plug HD into XP and boot from it. The system will check the disk before booting.<\/p>\n<p>Plug SSD and HD into Ubuntu. Clone the 24GB NTFS volume from HD to the 32GB partition on SSD. Flag -O means overwrite existing file (disk partition in our case):<\/p>\n<pre class=\"brush: bash; gutter: false\">sudo ntfsclone -O \/dev\/sdg1 \/dev\/sdf1<\/pre>\n<p>Run this command to find the exact size of the partition on SSD:<\/p>\n<pre class=\"brush: bash; gutter: false\">sudo ntfsresize -i \/dev\/sdg1<\/pre>\n<p>The output should look like this:<\/p>\n<pre class=\"brush: text; gutter: false\">ntfsresize v2012.1.15AR.1 (libntfs-3g)\r\nDevice name        : \/dev\/sdg1\r\nNTFS volume version: 3.1\r\nCluster size       : 4096 bytes\r\nCurrent volume size: 23999996416 bytes (24000 MB)\r\nCurrent device size: 32012757504 bytes (32013 MB)\r\nChecking filesystem consistency ...\r\n100.00 percent completed\r\nAccounting clusters ...\r\nSpace in use       : 12343 MB (51.4%)\r\nCollecting resizing constraints ...\r\nYou might resize at 12342161408 bytes or 12343 MB (freeing 11657 MB).\r\nPlease make a test run using both the -n and -s options before real resizing!<\/pre>\n<p>We need to resize NTFS volume to fill the partition. In the info above we see that the device size is 32012757504 bytes, so we set new volume size to 32012757 kilobytes:<\/p>\n<pre class=\"brush: bash; gutter: false\">sudo ntfsresize --size 32012757k  \/dev\/sdg1<\/pre>\n<p>This is it. Plug SSD into XP. The system will check the disk on first boot.<\/p>\n<p>If new partition is bigger than the old one there is no need to shrink the old NTFS volume. Just clone and resize.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My old video PC started acting up &#8211; it was losing BIOS settings randomly. So I&#8217;ve replaced the motherboard, installed Windows XP, software, &#8230; Everything worked fine but the ancient IDE disk from Maxtor turned out to be very noisy. So I&#8217;ve ordered an SSD &#8211; the cheapest and hence the smallest I could get. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/rebrik.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1"}],"collection":[{"href":"https:\/\/rebrik.info\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rebrik.info\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rebrik.info\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rebrik.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1"}],"version-history":[{"count":10,"href":"https:\/\/rebrik.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1\/revisions"}],"predecessor-version":[{"id":6,"href":"https:\/\/rebrik.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1\/revisions\/6"}],"wp:attachment":[{"href":"https:\/\/rebrik.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rebrik.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rebrik.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}