Page 1 of 6 123 ... LastLast
Results 1 to 10 of 51

Thread: Using dd to clone Windows

  1. #1

    Default Using dd to clone Windows

    I'm trying to use dd to clone my Windows partitions from linux. I want to get rid of Windows and put it on another harddrive. Do not want to delete Windows since it is a OEM version.

    Anyway the two first partitions on my harddrive belongs to Windows. I have connected a secondary harddrive to linux and executed dd.

    username@localhost:~> sudo dd if=/dev/sda1 of=/dev/sdb1 bs=4096 conv=notrunc,noerror
    106422+1 records in
    106422+1 records out
    435907584 bytes (436 MB) copied, 0,958252 s, 455 MB/s

    username@localhost:~> sudo dd if=/dev/sda2 of=/dev/sdb2 bs=4096 conv=notrunc,noerror
    dd: writing «/dev/sdb2»: No space left on device
    894515+0 records in
    894514+0 records out
    3663929344 bytes (3,7 GB) copied, 8,3846 s, 437 MB/s


    The first partition seems to go OK, but for the second it doesn't. Drive sdb is twice the size of sba1+sda2.
    I have even tried to create two partition sdb1 and sdb2 before running dd, but with same result.

    So any suggestions?

  2. #2

    Default Re: Using dd to clone Windows

    Some additional information. As you can see the drive sda has my linux partition along with the Windows partition.
    I have created /dev/sdb1 and /dev/sdb2 on the drive /dev/sdb with adequate disk space for the cloning.
    However /dev/sda1 begins a 63, while my /dev/sdb1 begins at 2048.

    Disk /dev/sda: 480.1 GB, 480103981056 bytes
    255 heads, 63 sectors/track, 58369 cylinders, total 937703088 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0xdac9de00

    Device Boot Start End Blocks Id System
    /dev/sda1 63 851444 425691 7 HPFS/NTFS/exFAT
    /dev/sda2 851445 308118208 153633382 7 HPFS/NTFS/exFAT

    /dev/sda3 * 308119552 937701375 314790912 f W95 Ext'd (LBA)
    /dev/sda5 308121600 312336383 2107392 82 Linux swap / Solaris
    /dev/sda6 312338432 442365951 65013760 83 Linux
    /dev/sda7 442368000 937682943 247657472 83 Linux

    Disk /dev/sdb: 320.1 GB, 320072933376 bytes
    255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x9a09bb3d

    Device Boot Start End Blocks Id System
    /dev/sdb1 2048 1124351 561152 7 HPFS/NTFS/exFAT
    /dev/sdb2 1124352 625141759 312008704 7 HPFS/NTFS/exFAT

  3. #3
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    16,065

    Default Re: Using dd to clone Windows

    Please post computer text between CODE tags to keep it readable. Use the # button in the toolbar above the post editor.
    Henk van Velden

  4. #4

    Default Re: Using dd to clone Windows

    Any administrator/moderator who could open my post so I could edit it to include CODE tags?


    Anyway another update:
    I tried both gparted and KDE partitionmanager to copy both partitions over to /dev/sdb, but unsuccessful.

    KDE partitionmanager failed when trying to check file system.

    Code:
    Create a new partition table on ‘/dev/sdb’ 
    Job: Create new partition table on device ‘/dev/sdb’ 
    Create new partition table on device ‘/dev/sdb’: Success
    Create a new partition table on ‘/dev/sdb’: Success
    
    Copy partition ‘/dev/sda1’ (415,71 MiB, ntfs) to unallocated space (starting at 31,50 KiB) on ‘/dev/sdb’ and grow it to 423,56 MiB 
    Job: Check file system on partition ‘/dev/sda1’ 
    Command: ntfsresize -P -i -f -v /dev/sda1 
    ntfsresize v2012.1.15 (libntfs-3g)
    Device name        : /dev/sda1
    NTFS volume version: 3.1
    Cluster size       : 4096 bytes
    Current volume size: 435905024 bytes (436 MB)
    Current device size: 435907584 bytes (436 MB)
    Checking for bad sectors ...
    Checking filesystem consistency ...
    Accounting clusters ...
    Space in use       : 28 MB (6.3%)
    Collecting resizing constraints ...
    Estimating smallest shrunken size supported ...
    File feature         Last used at      By inode
    $MFT               :        24 MB             0
    $MFTMirr           :         1 MB             1
    Ordinary           :        28 MB             6
    You might resize at 27590656 bytes or 28 MB (freeing 408 MB).
    Please make a test run using both the -n and -s options before real resizing! 
    Check file system on partition ‘/dev/sda1’: Success
    
    Job: Create new partition ‘Copy of /dev/sdb1’ 
    Create new partition ‘/dev/sdb1’: Success
    
    Job: Copy file system on partition ‘/dev/sda1’ to partition ‘/dev/sdb1’ 
    Command: ntfsclone -f --overwrite /dev/sdb1 /dev/sda1 
    ntfsclone v2012.1.15 (libntfs-3g)
    NTFS volume version: 3.1
    Cluster size       : 4096 bytes
    Current volume size: 435904512 bytes (436 MB)
    Current device size: 435907584 bytes (436 MB)
    Scanning volume ...
      0.00 percent completed 39.22 percent completed 78.43 percent completed100.00 percent completed
    Accounting clusters ...
    Space in use       : 28 MB (6.3%)   
    Cloning NTFS ...
      1.48 percent completed  2.97 percent completed  4.45 percent completed  5.94 percent completed  7.42 percent completed  8.91 percent completed 10.39 percent completed 11.88 percent completed 13.36 percent completed 14.85 percent completed 16.33 percent completed 17.81 percent completed 19.30 percent completed 20.78 percent completed 22.27 percent completed 23.75 percent completed 25.24 percent completed 26.72 percent completed 28.21 percent completed 29.69 percent completed 31.18 percent completed 32.66 percent completed 34.14 percent completed 35.63 percent completed 37.11 percent completed 38.60 percent completed 40.08 percent completed 41.57 percent completed 43.05 percent completed 44.54 percent completed 46.02 percent completed 47.51 percent completed 48.99 percent completed 50.48 percent completed 51.96 percent completed 53.44 percent completed 54.93 percent completed 56.41 percent completed 57.90 percent completed 59.38 percent completed 60.87 percent completed 62.35 percent completed 63.84 percent completed 65.32 percent completed 66.81 percent completed 68.29 percent completed 69.77 percent completed 71.26 percent completed 72.74 percent completed 74.23 percent completed 75.71 percent completed 77.20 percent completed 78.68 percent completed 80.17 percent completed 81.65 percent completed 83.14 percent completed 84.62 percent completed 86.10 percent completed 87.59 percent completed 89.07 percent completed 90.56 percent completed 92.04 percent completed 93.53 percent completed 95.01 percent completed 96.50 percent completed 97.98 percent completed 99.47 percent completed100.00 percent completed
    Syncing ... 
    
    Command: dd of=/dev/sdb1 bs=1 count=8 seek=72 
    8+0 records in
    8+0 records out
    8 bytes (8 B) copied, 4.8516e-05 s, 165 kB/s 
    
    Updating boot sector for NTFS file system on partition ‘/dev/sdb1’. 
    Copy file system on partition ‘/dev/sda1’ to partition ‘/dev/sdb1’: Success
    
    Job: Check file system on partition ‘/dev/sdb1’ 
    Command: ntfsresize -P -i -f -v /dev/sdb1 
    ntfsresize v2012.1.15 (libntfs-3g)
    Error reading bootsector: Invalid argument
    ERROR(22): Opening '/dev/sdb1' as NTFS failed: Invalid argument
    The device '/dev/sdb1' doesn't have a valid NTFS.
    Maybe you selected the wrong partition? Or the whole disk instead of a
    partition (e.g. /dev/hda, not /dev/hda1)? This error might also occur
    if the disk was incorrectly repartitioned (see the ntfsresize FAQ). 
    Check file system on partition ‘/dev/sdb1’: Error
    
    Checking target partition ‘/dev/sdb1’ after copy failed. 
    Copy partition ‘/dev/sda1’ (415,71 MiB, ntfs) to unallocated space (starting at 31,50 KiB) on ‘/dev/sdb’ and grow it to 423,56 MiB: Error

  5. #5
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    16,065

    Default Re: Using dd to clone Windows

    Quote Originally Posted by DJViking View Post
    Any administrator/moderator who could open my post so I could edit it to include CODE tags?
    Useless, the layout is gone and can not be reconstructed by putting CODE tags later. You should copy direct from your terminal in between the tags. Which you managed to do in your last post
    Last edited by hcvv; 15-Feb-2013 at 08:49.
    Henk van Velden

  6. #6
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    16,065

    Default Re: Using dd to clone Windows

    I tried to assess this using your first two posts, but either the clue is not there, or I still am misreading because of the failing columns. Also I see a blank line somewhere where it shouldn't be.

    Now it seems that it is of not much use to ask you to show in one unitnerrupted sweep the fdisk -l and the two dd commands because you already changed the situation by using all sorts of other tools. So I am completely lost on what your present situation is.
    Henk van Velden

  7. #7
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    22,777

    Default Re: Using dd to clone Windows

    On 2013-02-15 15:26, DJViking wrote:
    >
    > I'm trying to use dd to clone my Windows partitions from linux. I want
    > to get rid of Windows and put it on another harddrive. Do not want to
    > delete Windows since it is a OEM version.


    I would attempt a blunt dd of the entire disk. It will fail at some
    point because of the different size, at which point you have to remove
    the extra partition entries beyond sdb2.

    Why your dd of sda2 fails I can not see. It should work, I believe.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 12.1 x86_64 "Asparagus" at Telcontar)

  8. #8

    Default Re: Using dd to clone Windows

    hcvv wrote:

    >
    > I tried to assess this using your first two posts, but either the clue
    > is not there, or I still am misreading because of the failing columns.
    > Also I see a blank line somewhere where it shouldn't be.
    >
    > Now it seems that it is of not much use to ask you to show in one
    > unitnerrupted sweep the fdisk -l and the two dd commands because you
    > already changed the situation by using all sorts of other tools. So I am
    > completely lost on what your present situation is.
    >
    >

    I may be wrong about this but was your b drive partitioned in any way. If I
    recall correctly I had much the same problem. If your b drive had only one
    partition that occupied the drive dd will copy your partition from a to be
    but will not truncate the b drive partition to the size of the partition on
    the a drive therefore it doesn't find any free space on the b drive. You
    might try dd if=/dev/sda of=/dev/sdb instead of trying each partition
    separately.

  9. #9
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    16,065

    Default Re: Using dd to clone Windows

    Quote Originally Posted by aemau View Post
    hcvv wrote:

    >
    > I tried to assess this using your first two posts, but either the clue
    > is not there, or I still am misreading because of the failing columns.
    > Also I see a blank line somewhere where it shouldn't be.
    >
    > Now it seems that it is of not much use to ask you to show in one
    > unitnerrupted sweep the fdisk -l and the two dd commands because you
    > already changed the situation by using all sorts of other tools. So I am
    > completely lost on what your present situation is.
    >
    >

    I may be wrong about this but was your b drive partitioned in any way. If I
    recall correctly I had much the same problem. If your b drive had only one
    partition that occupied the drive dd will copy your partition from a to be
    but will not truncate the b drive partition to the size of the partition on
    the a drive therefore it doesn't find any free space on the b drive. You
    might try dd if=/dev/sda of=/dev/sdb instead of trying each partition
    separately.
    What I read from his (distorted) fdisk listing in post #2 is that sdb has two partitions that are both bigger then the partitions with the same sequence number on sda. I might misread as I said earlier, but I do not understand how you see that there are no parttitions at all on sdb. The more so because the dd of sda1 to sdb1 is successfully, thus there must be at least one partition.

    Also when there isn't a partition sdb2 at all there would be an error message from dd that /dev/sdb2 doesnot exist, which is not the case. tehre is even a lot of blocks copied.

    Also dd does not "truncate" partitions. dd simply copies blocks from the input file to output file. It does not even have any real knowledge about partitions. When there are no more blocks to copy (End-of-file on input from the kernel) it stops and does not do anything whether there are more blocks available out the output file or not. When, during writing, it gets an End-of file from the kernel it then says: No space left.

    (BTW it is not my "b drive", but the OP's disk).
    Last edited by hcvv; 15-Feb-2013 at 12:45.
    Henk van Velden

  10. #10

    Default Re: Using dd to clone Windows

    Will try cloning the entrie sda drive on monday when I get back to work. I hate unfinished work before weekend.
    Anyway when it will fail due to lack of space will not the sdb drive have a incomplete partition table?

    Since linux had problems creating the sdb drive I could perhaps try create the sdb1 and sdb2 drive formatted in NTFS within Windows before I try to clone it.

    The reason fdisk -l showed 2 partitions on /dev/sdb is because I created them before I preceded with the cloning with the same size as the /dev/sda partitions I was trying to clone. As stated I have tried the cloning with or without partitions on /dev/sdb. That time I tried without partitions and the first clone worked without problems there was none on the receiving end.

Page 1 of 6 123 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •