Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: [EN] Moving Windows partition to new disk  (Read 2426 times)

Offline finotti

  • User
  • Posts: 269
[EN] Moving Windows partition to new disk
« on: 2020/10/19, 02:37:35 »
I bought a new SSD and need to move a Windows partition to the new drive.  The new Windows partition will be larger.
What is the best way to do that? 

One of my concerns if I will be able to boot Windows after moving the partition.  Will grub just find the new partition, or do I need to do anything to make sure I can boot Windows?
Code: [Select]
# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0   3.6T  0 disk
├─sda1   8:1    0   3.6T  0 part /media/sg4tb
└─sda2   8:2    0  31.3G  0 part [SWAP]
sdb      8:16   0 238.5G  0 disk
├─sdb1   8:17   0   200M  0 part /boot/efi
└─sdb2   8:18   0 238.3G  0 part /
sdc      8:32   0   1.8T  0 disk
├─sdc1   8:33   0   1.7T  0 part /media/data2
├─sdc2   8:34   0  50.2G  0 part
└─sdc5   8:37   0  27.9G  0 part
sdd      8:48   0   1.8T  0 disk
└─sdd1   8:49   0   1.8T  0 part /media/data3
sde      8:64   0 931.5G  0 disk
└─sde1   8:65   0 931.5G  0 part /media/music
sdf      8:80   0   3.6T  0 disk
└─sdf1   8:81   0   3.6T  0 part /media/media
sr0     11:0    1  1024M  0 rom
The Windows partition is sdc2.

Code: [Select]
# fdisk -l /dev/sdc
Disk /dev/sdc: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: WDC WD20EARX-00P
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 5B0E5CA5-7E87-464E-B2CB-9578A87EDDA1

Device          Start        End    Sectors  Size Type
/dev/sdc1          63 3743199231 3743199169  1.7T Linux filesystem
/dev/sdc2  3743199232 3848435560  105236329 50.2G Microsoft basic data
/dev/sdc5  3848435712 3907028991   58593280 27.9G Linux filesystem

Partition 1 does not start on physical sector boundary.
The boot partition is at /dev/sdb
Code: [Select]
# fdisk -l /dev/sdb
Disk /dev/sdb: 238.47 GiB, 256060514304 bytes, 500118192 sectors
Disk model: Samsung SSD 840
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 9A9C5D55-7D80-48E2-9F49-E5A11EAD69B5

Device      Start       End   Sectors   Size Type
/dev/sdb1    2048    411647    409600   200M EFI System
/dev/sdb2  411648 500118158 499706511 238.3G Linux filesystem
Any suggestions would be greatly appreciated.

Offline finotti

  • User
  • Posts: 269
Re: Moving Windows partition to new disk
« Reply #1 on: 2020/10/24, 23:07:43 »
OK, so I installed the new disk, paritioned it:
Code: [Select]
Disk /dev/sde: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: CT2000MX500SSD1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: CE602A32-7962-4443-BEB8-73EFA5CF0448

Device          Start        End    Sectors  Size Type
/dev/sde1        2048    1026047    1024000  500M EFI System
/dev/sde2     1026048 1469032447 1468006400  700G EFI System
/dev/sde3  1469032448 3907029134 2437996687  1.1T Linux filesystem
I used Clonezilla to clone the original smaller Windows partition (sdb2 below) to sde2.
Code: [Select]
Disk /dev/sdb: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: WDC WD20EARX-00P
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 5B0E5CA5-7E87-464E-B2CB-9578A87EDDA1

Device          Start        End    Sectors  Size Type
/dev/sdb1          63 3743199231 3743199169  1.7T Linux filesystem
/dev/sdb2  3743199232 3848435560  105236329 50.2G Microsoft basic data
/dev/sdb5  3848435712 3907028991   58593280 27.9G Linux filesystem

Partition 1 does not start on physical sector boundary.
Running update-grub, if finds the Windows boot manager in sdc1:

Code: [Select]
# update-grub
Generating grub configuration file ...
[snip]Found Windows Boot Manager on /dev/sdc1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
done
But when choosing that option in grub (when booting), it takes me straight to the old Windows installation.
Can anyone offer any help?

Offline sunrat

  • User
  • Posts: 406
Re: Moving Windows partition to new disk
« Reply #2 on: 2020/10/25, 09:18:24 »
I'm no expert but this looks wrong:
Code: [Select]
/dev/sde2     1026048 1469032447 1468006400  700G EFI Systempartition type should not be "EFI System" but "Microsoft basic data"

Offline finotti

  • User
  • Posts: 269
Re: Moving Windows partition to new disk
« Reply #3 on: 2020/10/26, 13:22:35 »
Thanks, sunrat!  Indeed, the flag was incorrect in the partition.  I've fixed it now.
At this point I think it is a "Windows problem", not Linux.  Grub finds the Windows bootloader, but the Windows bootloader does not find the new copy...  (Or maybe cloning with Clonezilla does not work for Windows?)  So, it might not be an appropriate question here anymore.  But I greatly appreciate you taking the time to respond and trying to help!

Offline sunrat

  • User
  • Posts: 406
Re: Moving Windows partition to new disk
« Reply #4 on: 2020/10/26, 14:40:58 »
I'm sure I've successfully cloned and restored Win 10 with Clonezilla but it was a while ago. I would have thought restoring the partition to a different disk would not change the original partition type or size. It's rather mysterious how you got a 700GB ESP from a 50GB cloned Win image. IIRC, Clonezilla writes back the partition image the same size as the original and then needs another tool to enlarge it, I think I used Gparted from a live usb boot distro.

Offline finotti

  • User
  • Posts: 269
Re: Moving Windows partition to new disk
« Reply #5 on: 2020/10/27, 12:38:24 »
So, I had the partition beforehand, and just asked Clonezilla to copy one partition to the other and it kept the size.  I tried it dd, which keeps the partition size, but was having problems using ntfsresize, so I decided to try Clonezilla.

I can't say for sure everything is fine, since I cannot boot from this new partition, but I can see it fine when booting from the old one.

At this point I will probably give up and make a new install of Windows, instead of trying to clone the old one...

Thanks again for the help!

Strela17

  • Guest
Re: Moving Windows partition to new disk
« Reply #6 on: 2020/12/28, 20:04:28 »
Thanks for your feedback! I was looking for a way to move the whole package from one disk to another, but it looks like it won't be possible... I'll then follow your advice and go for a full blown reinstall on the new disk.

Offline unklarer

  • User
  • Posts: 811
Re: Moving Windows partition to new disk
« Reply #7 on: 2021/01/01, 10:21:31 »
Thanks for your feedback! I was looking for a way to move the whole package from one disk to another, but it looks like it won't be possible... I'll then follow your advice and go for a full blown reinstall on the new disk.

Why do you want to do that?   ???

It seems to me that in the above example it was forgotten that the Windows bootloader must of course be installed NEW if it is now on another disk.
Windows-typically this destroys first of all everything that is called GRUB.

Then reinstalling GRUB should fix everything.