0

I have a setup (UEFI) with two SSDs, which contain a Windows partition, a Linux partition, boot and swap partitions and a data partition. I want to move all of these to a single new SSD. How do I go about this? I have so far copied the Windows and data partition to the new drive (which were on one of the SSDs) with clonezilla, but now I would also like to transfer the Linux drive partitions to this new drive. If I used clonezilla, it would delete the partitions I copied already.

I thought that dd is probably the way to go, but I cannot find out if dd will overwrite what's there as well.

I have tried to find a solution online, but the terms are so overloaded I get answers to different problems only.

I can restart if need be, I am not yet dependent on the partitions already cloned on the new drive, the old ones still exist.

0

2 Answers 2

1

I assume you are trying to merge two disks from your computer into one larger one, and I also assume that one of the disks is the boot disk.

I would do it like this :

  • Clone the entire boot disk to the target disk, erasing all the data currently stored on it
  • Try to boot from the new disk to verify the copy. Verify also that the cloning software can see the real size of the new disk doesn't think that the entire disk is of the same size as the old one, so there is enough unallocated space on the disk.
  • Create manually on the target partitions with the same name and attributes as from the second disk, and make them a little bit larger
  • Clone the partitions one by one to the new disk (as they now exist they can be named as the target)
  • Boot and check your disks. You might need to correct the boot entry for Linux.
0

With trial and error, I managed to get it done. My Linux system is Arch Linux, but I assume you can get it to work with any distro - however, ymmv. Also, I'm not sure if this would work with Windows / macOS, but I am rather sure it won't work with two Windows partitions.

Before you do any of this, make sure to back up both your old windows and your old linux drive. Also, if anyone sees a huge problem in what I did, please let me know.

  1. Clone the windows disk to the new drive (e.g. I used RescueZilla for this) and then remove the old drive (just to make sure you don't accidentally erase the old drive). Make sure the clone works by just booting into the cloned Windows partition once.
  2. Create a linux live system to boot from and boot it
  3. Create the partitions you want / need for your linux system. They may differ from your old system, but obviously the root (if applicable, also the /home) partition on the new drive need to be at least as large as the old partitions. You can basically follow the arch linux installation guide from the top until (and including) 3.1, generating the fstab file. IT IS IMPORTANT to actually "install" (i.e. pacstrap) a new linux - I tried without it, but mkinitcpio wouldn't work then. It probably is not necessary, but I also added dhcpcd, vim and git to the pacstrap packages.
  4. Now that the system exists, backup (/rename) the fstab file mv /mnt/etc/fstab /mnt/etc/fstab_new
  5. Mount your old linux partition (mount --mkdir /old /dev/sd123 where 123 is the partition of your old system) and copy over all your data except the old /boot/ folder. Make sure all meta data is kept in tact. I used rsync. Given the above mentioned mount, it can be done like this: rsync -axAHX --info=progress2 --exclude 'boot' /old/ /mnt/. Make sure the src and dst folders are postfixed with the forward slash, otherwise you don't copy the contents of src into the destination folder.
  6. You may remove the old linux drive now (again, just to make sure you don't accidentally erase it), and then reboot into the live linux.
  7. The system is copied over, but you need to take care of the bootloader and mounts now. If you rebooted, mount the new linux system again (both /mnt and /mnt/boot as the arch linux installation guide suggested before). Change root into the new system arch-chroot /mnt. Make sure the old system works. I checked for packages I knew were installed with pacman -Qe.
  8. Create the initial ramdisk: mkinitcpio -p linux
  9. Install grub (/whatever bootloader) to the (probably) efi partition you created. grub-install --targe=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB (or replace the id with whatever you want to name it).
  10. Recreate the grub config (I'm not sure this is necessary, but it shouldn't hurt either). grub-mkconfig -o /boot/grub/grub.cfg
  11. Move your old fstab file (since the UUIDs will be changed now) mv /etc/fstab /etc/fstab_old and use your previously created fstab instead mv /etc/fstab_new /etc/fstab. If you had any further drives mounted in your old system, you may copy those over from the old fstab to the new fstab. Afterwards, I assume you can delete the old fstab file.

And that's it, the system should work now. Boot into both windows and linux for testing.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .