{"id":305,"date":"2005-03-04T13:38:03","date_gmt":"2005-03-04T18:38:03","guid":{"rendered":"http:\/\/linode.siwko.org\/wordpress\/?p=305"},"modified":"2005-03-04T13:38:03","modified_gmt":"2005-03-04T18:38:03","slug":"copying-an-ntfs-disk-over-the-network-using-tomsrtbt","status":"publish","type":"post","link":"https:\/\/www.siwko.org\/wordpress\/?p=305","title":{"rendered":"Copying an NTFS disk over the network using tomsrtbt"},"content":{"rendered":"<p>I&#8217;ve got an old SCSI NTFS disk that I&#8217;ve got to get the information out<br \/>\nof.&nbsp; I had it installed on my linux box where I could mount the<br \/>\ndisk directly, but I pulled it out and closed up the system and forgot<br \/>\nto copy the image over to the big disk there.<\/p>\n<p>I had done this in the past and used the <a href=\"http:\/\/linux-ntfs.sourceforge.net\/rpm\/instructions.html\">linux ntfs driver<\/a><br \/>\nto mount the disk and copy the files.&nbsp; The big disk went bad, I<br \/>\ngot it replaced and forgot to copy the NTFS.&nbsp; Anway, I was looking<br \/>\nfor a way to copy the disk without opening up the Linux box again.<\/p>\n<p>I put the SCSI card and drive into an old P5-100 and booted from a <a href=\"http:\/\/www.toms.net\/rb\/\">tomsrtbt<\/a><br \/>\nfloppy.&nbsp; The SCSI drive and network came up, I added an entry to<br \/>\nthe \/etc\/fstab for an nfs mount and mounted it.&nbsp; So far, so good.<\/p>\n<p>I tried this dd if=\/dev\/sda of=\/public\/old-drive.ntfs and it looked<br \/>\ngood up to 2G when I got &#8220;File Size Exceeded.&#8221;&nbsp; I poked about and<br \/>\nfound dd-lfs (dd for large file systems) which claims to have no 32 bit<br \/>\nfile size limit.&nbsp; It didn&#8217;t work either.&nbsp; There&#8217;s something<br \/>\nin there that doesn&#8217;t like going over 2G.&nbsp; Anyway, I decided to<br \/>\ntry to split the file with dd into chunks.&nbsp; Here&#8217;s the script I<br \/>\nran:<\/p>\n<p><span style=\"font-family: courier;\">for i in 0 1 2 3 4 5 6 7 8 9<\/span><br style=\"font-family: courier;\"><br \/>\n<span style=\"font-family: courier;\">do<\/span><br style=\"font-family: courier;\"><br \/>\n<span style=\"font-family: courier;\">&nbsp; dd-lfs if=\/dev\/sda of=\/public\/old-drive.ntfs.$i bs=1000 count=1000000 skip=${i}000000<\/span><br style=\"font-family: courier;\"><br \/>\n<span style=\"font-family: courier;\">done<\/span><\/p>\n<p>It worked, I got this:<\/p>\n<p><span style=\"font-family: courier;\">-rw-r&#8211;r&#8211;&nbsp; 1 root root 1000000000 Mar&nbsp; 3 23:54 old-drive.ntfs.0<\/span><br style=\"font-family: courier;\"><br \/>\n<span style=\"font-family: courier;\">-rw-r&#8211;r&#8211;&nbsp; 1 root root 1000000000 Mar&nbsp; 4 00:04 old-drive.ntfs.1<\/span><br style=\"font-family: courier;\"><br \/>\n<span style=\"font-family: courier;\">-rw-r&#8211;r&#8211;&nbsp; 1 root root 1000000000 Mar&nbsp; 4 00:14 old-drive.ntfs.2<\/span><br style=\"font-family: courier;\"><br \/>\n<span style=\"font-family: courier;\">-rw-r&#8211;r&#8211;&nbsp; 1 root root 1000000000 Mar&nbsp; 4 00:25 old-drive.ntfs.3<\/span><br style=\"font-family: courier;\"><br \/>\n<span style=\"font-family: courier;\">-rw-r&#8211;r&#8211;&nbsp; 1 root root 1000000000 Mar&nbsp; 4 00:34 old-drive.ntfs.4<\/span><br style=\"font-family: courier;\"><br \/>\n<span style=\"font-family: courier;\">-rw-r&#8211;r&#8211;&nbsp; 1 root root 1000000000 Mar&nbsp; 4 00:45 old-drive.ntfs.5<\/span><br style=\"font-family: courier;\"><br \/>\n<span style=\"font-family: courier;\">-rw-r&#8211;r&#8211;&nbsp; 1 root root 1000000000 Mar&nbsp; 4 00:55 old-drive.ntfs.6<\/span><br style=\"font-family: courier;\"><br \/>\n<span style=\"font-family: courier;\">-rw-r&#8211;r&#8211;&nbsp; 1 root root 1000000000 Mar&nbsp; 4 01:05 old-drive.ntfs.7<\/span><br style=\"font-family: courier;\"><br \/>\n<span style=\"font-family: courier;\">-rw-r&#8211;r&#8211;&nbsp; 1 root root 1000000000 Mar&nbsp; 4 01:16 old-drive.ntfs.8<\/span><br style=\"font-family: courier;\"><br \/>\n<span style=\"font-family: courier;\">-rw-r&#8211;r&#8211;&nbsp; 1 root root&nbsp; 100032000 Mar&nbsp; 4 01:17 old-drive.ntfs.9<\/span><\/p>\n<p>\nHere&#8217;s the script to put it back together:<\/p>\n<p><span style=\"font-family: courier;\">for i in 0 1 2 3 4 5 6 7 8 9<\/span><br style=\"font-family: courier;\"><br \/>\n<span style=\"font-family: courier;\">do<\/span><br style=\"font-family: courier;\"><br \/>\n<span style=\"font-family: courier;\">&nbsp; dd if=\/public\/old-drive.ntfs.$i of=\/public\/old-drive.ntfs bs=1000 count=1000000 seek=${i}000000<\/span><br style=\"font-family: courier;\"><br \/>\n<span style=\"font-family: courier;\">done<\/span><\/p>\n<p>\nThre result:<\/p>\n<p><span style=\"font-family: courier;\">-rw-r&#8211;r&#8211;&nbsp; 1 root root 9100032000 Mar&nbsp; 4 10:32 old-drive.ntfs<\/span><\/p>\n<p>Which looked good to me.&nbsp; Now just mount it and we&#8217;re good to go.<\/p>\n<p>WRONG!<\/p>\n<p><span style=\"font-family: courier;\"><br \/>\nmount old-drive.ntfs \/public\/old-drive -t ntfs -r -o umask=0222<\/span><br style=\"font-family: courier;\"><span style=\"font-family: courier;\"><br \/>\nmount: old-drive.ntfs is not a block device (maybe try `-o loop&#8217;?)<\/span><br style=\"font-family: courier;\"><br \/>\n<br \/>\nok, it&#8217;s not a block device so we&#8217;ll loop the file:<\/p>\n<p><span style=\"font-family: courier;\"><br \/>\nmount old-drive.ntfs \/public\/old-drive -t ntfs -r -o umask=0222 -o loop<\/span><br style=\"font-family: courier;\"><span style=\"font-family: courier;\"><br \/>\nmount: wrong fs type, bad option, bad superblock on \/dev\/loop0,<\/span><br style=\"font-family: courier;\"><span style=\"font-family: courier;\"><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; or too many mounted file systems<\/span><br style=\"font-family: courier;\"><span style=\"font-family: courier;\"><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (could this be the IDE device where you in fact use<\/span><br style=\"font-family: courier;\"><span style=\"font-family: courier;\"><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ide-scsi so that sr0 or sda or so is needed?)<\/span><br style=\"font-family: courier;\"><br \/>\n<br style=\"font-family: courier;\"><br \/>\nand this shows up in the \/var\/log\/messages<\/p>\n<p><span style=\"font-family: courier;\"><br \/>\nNTFS-fs error (device loop0): ntfs_fill_super(): Not an NTFS volume.<\/span><br style=\"font-family: courier;\"><span style=\"font-family: courier;\"><\/p>\n<p>NTFS-fs error (device loop0): read_ntfs_boot_sector(): Primary boot sector is invalid.<\/span><br style=\"font-family: courier;\"><span style=\"font-family: courier;\"><\/p>\n<p>NTFS-fs error (device loop0): read_ntfs_boot_sector(): Mount option errors=recover not used. Aborting without trying to recover.<\/span><br style=\"font-family: courier;\"><br \/>\n<br \/>\nOK, let&#8217;s do the loop separately and check it out:<\/p>\n<p><span style=\"font-family: courier;\"><br \/>\nlosetup \/dev\/loop0 \/public\/old-drive.ntfs<\/span><br style=\"font-family: courier;\"><span style=\"font-family: courier;\"><br \/>\nlet&#8217;s look at the loop content<\/span><br style=\"font-family: courier;\"><span style=\"font-family: courier;\"><br \/>\nhead \/dev\/loop0&nbsp; | od -c<\/span><br style=\"font-family: courier;\"><br \/>\n<br \/>\nlooks good I see NTFS stuff and PARTITION INFORMATION!!!!<\/p>\n<p>let&#8217;s try this: <br \/><span style=\"font-family: courier;\">&nbsp;fdisk -l \/dev\/loop0<\/span><br style=\"font-family: courier;\"><span style=\"font-family: courier;\"><br \/>\n&nbsp;<\/span><br style=\"font-family: courier;\"><span style=\"font-family: courier;\"><br \/>\nDisk \/dev\/loop0: 9100 MB, 9100032000 bytes<\/span><br style=\"font-family: courier;\"><span style=\"font-family: courier;\"><br \/>\n255 heads, 63 sectors\/track, 1106 cylinders<\/span><br style=\"font-family: courier;\"><span style=\"font-family: courier;\"><br \/>\nUnits = cylinders of 16065 * 512 = 8225280 bytes<\/span><br style=\"font-family: courier;\"><span style=\"font-family: courier;\"><br \/>\n&nbsp;<\/span><br style=\"font-family: courier;\"><span style=\"font-family: courier;\"><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Device<br \/>\nBoot&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>\nStart&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>\nEnd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Blocks&nbsp;&nbsp; Id&nbsp; System<\/span><br style=\"font-family: courier;\"><span style=\"font-family: courier;\"><span style=\"background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);\"><br \/>\n\/dev\/loop0p1<\/span>&nbsp;&nbsp;<br \/>\n*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>\n1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>\n1106&nbsp;&nbsp;&nbsp;&nbsp; 8883913+&nbsp;&nbsp; 7&nbsp; HPFS\/NTFS<\/span><br style=\"font-family: courier;\"><br \/>\n<br style=\"font-family: courier;\"><br \/>\n<br \/>\nvery interesting, we&#8217;ve got the whole drive image including the<br \/>\npartition table.&nbsp; More interesting is the \/dev\/loop0p1 device!<\/p>\n<p><span style=\"font-family: courier;\"><br \/>\nmount \/dev\/loop0p1 \/public\/old-drive -t ntfs -r<\/span><br style=\"font-family: courier;\"><span style=\"font-family: courier;\"><br \/>\nmount: special device \/dev\/loop0p1 does not exist<\/span><br style=\"font-family: courier;\"><br \/>\nThis post (<a href=\"http:\/\/lists.samba.org\/archive\/linux\/2004-December\/012635.html\">http:\/\/lists.samba.org\/archive\/linux\/2004-December\/012635.html<\/a>) gives some insight.&nbsp; It&#8217;s just printed out as a convenince, there&#8217;s&nbsp; no such device (except at NASA apparently).<\/p>\n<p>The post goes on to say that I can use the offset parameter to go farther into the loop file for the beginning of the device.<\/p>\n<p><span style=\"font-family: courier;\">losetup <span style=\"color: rgb(255, 0, 0);\">-o 32256<\/span> \/dev\/loop0 \/public\/old-drive.ntfs<\/span><br style=\"font-family: courier;\"><br \/>\n<span style=\"font-family: courier;\">mount \/dev\/loop0 \/public\/old-drive -t ntfs -r<\/span><\/p>\n<p>Apparently I could have done this in one command:<\/p>\n<p><span style=\"font-family: courier;\">mount \/public\/old-drive.ntfs \/public\/old-drive -t ntfs -r -o loop,offset=32256<\/span><br style=\"font-family: courier;\"><br \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve got an old SCSI NTFS disk that I&#8217;ve got to get the information out of.&nbsp; I had it installed on my linux box where I could mount the disk directly, but I pulled it out and closed up the system and forgot to copy the image over to the big disk there. I had [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-305","post","type-post","status-publish","format-standard","hentry","category-roller"],"_links":{"self":[{"href":"https:\/\/www.siwko.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/305"}],"collection":[{"href":"https:\/\/www.siwko.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.siwko.org\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.siwko.org\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.siwko.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=305"}],"version-history":[{"count":0,"href":"https:\/\/www.siwko.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/305\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.siwko.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.siwko.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.siwko.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}