move partition from one disk to another from the Windows CLI

11,087

You can't really copy a "partition", as a partition is just marking a section of disk off to be used for holding a file system, which is what's actually holding your data.

So the general steps would be:

  1. Create new partition.
  2. Format it with desired file system.
  3. Copy data from the existing file system on the existing partition, to the new file system on the new partition.

There are 3rd party partitioning tools that can help you those steps, such as gPartEd, but it's not really a utility intended for automation.

Another method for duplicating partitions is "cloning". This is a block by block copy of a section of the drive, done without actually reading the data in the blocks. If you clone a section of the drive that contains the partition (and the file system, and data it holds), you can then stamp that clone onto another drive. The advantage to this is that structurally the files will be in the same relative locations, allowing things like maintaining the boot ability of a partition.

One of the most popular cloning tools is dd ("Disk Dump"), which is included in most Linux distributions, and there are ports to Windows available.

Perhaps check these questions/answers out:

Share:
11,087

Related videos on Youtube

kuzko
Author by

kuzko

in training, learning and all related stuff... will probably last all life.

Updated on September 18, 2022

Comments

  • kuzko
    kuzko over 1 year

    As the title says, I'm looking for a way to move let's say partition 1 on disk of Id 1 to partition 2 on disk 2...

    The Windows cmd diskpart options doesn't mention a copy or move option, the Powershell storage cmdlets have no such option either. C.F. https://technet.microsoft.com/fr-fr/library/hh848705(v=wps.630).aspx

    The DISM utility has only the Capture Image capability and other tools are often accessible only by GUI.

    I would like to automate that partition moving process, what command should I look into?

  • Peter Hahndorf
    Peter Hahndorf over 7 years
    But there is a big difference between a file based copy and a sector based copy which most partitioning tools use to copy/move partitions.
  • Ƭᴇcʜιᴇ007
    Ƭᴇcʜιᴇ007 over 7 years
    @PeterHahndorf True, I was trying to keep it general to match the general question about "copying/moving", and to point towards why there's no simple tool included for doing it (or rather, why the partitioning tools don't do file copies). I'll put in a mention about "cloning" as well.
  • kuzko
    kuzko over 7 years
    Turns out, there is a way on Windows to do it, I've been investigating, and because relies heavily on NTFS, and it's system utilities, using DISM, bcdedit or bcdboot, the Windows AIK and a bit of powershell, there should be a way, I'll have an answer when my script is ready. Link to the related Windows documentation msdn.microsoft.com/fr-ch/windows/hardware/commercialize/…
  • Ƭᴇcʜιᴇ007
    Ƭᴇcʜιᴇ007 over 7 years
    @kuzko Looking forward to your solution. :)