I have just gone through this exact process successfully, so at the risk of bumping an oldish thread here it is.
Scenario: Ubuntu 16.04, windows xp dual-boot. There are old windows games I still love which won't run under wine...
1x ancient IDE, with / and swap
1x 450GB SATA with home directory and winxp partition
spanking new 2TB SATA.
power down. Add 2TB disk. Boot from ubuntu liveCD (I used workstation 16.04). You will need to set up networking somehow for the next step--unfortunately not everything you need is on the liveCD.
Enable ubuntu universe and install uuid.
# apt update
# apt install uuid
- Start gparted. This tool has a copy function which can resize a partition on the fly. It's a winner.
Gparted will show the existing partitions and most likely unallocated space on the new drive. Delete everything on the new drive, no need to prepare partitions.
Using gparted copy and paste, you can copy any partition and paste it into the unallocated space on the new disk. gparted will do everything needed for the copy and resize operation.
So much for the easy bit...
Now you have your original partitions and the new copies under the liveCD root. At this point you need to do four more things for success:
- Change the partition UUIDs on the copies to new ones. For each copied partition:
- use uuid to generate a new UUID
- use tune2fs -U [UUID from above step] /dev/[device] to apply it to
your COPY. This is so you don't mangle your existing, working system. NOTE:do not do this to an NTFS partition. The UUID is used by windows to validate itself and as I understand it, you are in for trouble if you change it. See below, Cleanup.
UPDATE: gparted can create a new UUID for you. Only noticed this just now.
- Edit fstab
- assuming you mount your "/" drive copy on /mnt
- edit /mnt/etc/fstab and replace the UUID for all old your mounts with those of your copies which you have just changed. If you have mounts using devices only, consider changing this approach which is now well and truly legacy.
- Reinstall GRUB2. I used the chroot method, and heartfelt thanks go to Nathan Kidd.
mount /dev/sdXY /mnt
for dir in /dev /dev/pts /proc /sys /run; do
mount --bind $dir /mnt$dir
This bind-mount bit appears to be essential but I do not know why grub even cares about these run-time things. However, it seems to be magic. This step even worked out the new location of my XP partition.
- In XP itself, the boot.ini may need to be modified. You will most likely need to change the default and multi incantations so the windows boot loader can find everything else. Documentation for this part is in the usual microsofty places. You will know this is the case if you get a message about missing HAL.DLL. Don't start copying files, fix up boot.ini and it should come good. I did this by fuse-mounting the NTFS partition on the liveCD root and editing it by hand.
Then you remove your old drives and reboot into the new drive. Worked for me, including windows with no invalidation of licence. YMMV, it seems to be pretty random in my experience.
- Cleanup: Now that I have a working new drive, I'm going to reboot into liveCD with both of the SATA disks and zap the contents of the old 450GB disk. This is because I believe that if you have two NTFS partitions with the same UUID mounted on the system, Bad Things can happen. I could be wrong...but why risk it? Also, make sure you disable any previously bootable disk in your BIOS. I forgot to do this and wasted a bit of time with a not-booting system until I worked out what was going on.
It can then be reused for something else. The IDE drive, who cares?
I have gone to the trouble of posting this because it's taken me two days to sift through the contradictory and often outdated or sketchy info on this topic. I hope it is useful to someone and saves some effort and trouble.