Click here to Skip to main content
14,920,219 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Needed to modify existing code as below to achieve cloning of a Physical disk on another Physical Disk(PhysicalDrive0 to PhysicalDrive1)

Below are the sample code for drive to image(PhysicalDrive0 to File) which is working fine.

What I have tried:

RawDisk disk = new RawDisk(DiskNumberType.PhysicalDisk, Convert.ToInt32(devnum), FileAccess.Read);
        long diskReadLength = disk.SizeBytes;
        long totalRead = 0;
        int increment = (int)(((16f * 1024f * 1024f) / disk.SectorSize) * disk.SectorSize);
        byte[] input = new byte[increment];
        Stopwatch sw = new Stopwatch();

        FileStream fs = new FileStream(path, FileMode.Create);

Drive to Image File reference taken from GitHub: GitHub - turningpointtech/tptDiskImager: Takes raw sector by sector disk copy and saves to a file[^]

Want to achieve Physical Drive to Physical Drive(PhysicalDrive0 to PhysicalDrive1) Cloning.
Posted
Updated 29-Oct-19 21:16pm
v3
Comments
OriginalGriff 30-Oct-19 3:05am
   
And?
What is your question?
What have you tried?
Where are you stuck?
What help do you need?

1 solution

Here is one, but I'm afraid it's Linux only: GitHub - devel0/clone-disk: Utility to clone disk reading parallel to write[^]

You might also be interested in: Volume Shadow Copies from .NET[^]
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900