3

Basic Explanation

How could I copy partitions sdh1 though shd4 from my 600gb HDD (sdh) to my 1 TB SSD (sdg)? Which are my Windows partitions and still keep it bootable? I used GPT.

Below is a diagram the layouts of my partitions on the 600GB Hard Drive


HDD 1


More in detailed explanation why

Again, I just want to clone the area in which the Windows partitions are on or clone them directly, but not the whole drive because I don't want to waste write cycles on the SSD, as I would need to delete the Linux partitions because I want to redo them such as resize them, reorganize them, and create another partition for /opt. This is will be my new drive for my OSes.

You can skip this, but this what I tried and gives a better understanding of my setup

I believe it should be easy to do but I can't just create a new partition for the Win boot partition -- it must be cloned, and I don't know how to do that. That is for any partition. When I try doing it with dd, I erase the whole partition table and overwrite everything with it.

As a side note, I keep my personal data off of this drive and solely used it for the OSes. I have 5 different HDDs and now 1 SSD, with a use for each, that I keep hook up to my PC. For example, my documents and such is on a different HDD than my OSes. They are automatically mounted and I change values where the dir is located and create symlinks. So the system thinks that the document dir in the home dir is actually located in the home dir but it is really located on that different HDD. I do the same with Windows. It creates a seamless experience and it also allows room for expansion for things like my video archive which I always add to it when I go out for a bicycle ride, and my game library. Or when things failed like when I need to reinstall an OS. I don't need to worry about losing any data.

That explains why I only want to copy the Windows partitions; then I will just probably reinstall Linux if I need to, or just reconfigure it, if that is possible, to mount the /usr dir to this 600gb hdd. I also use it for a Linux game library instead of booting into Windows. This way, I don't lose all of the applications which I installed. It's like having a home dir, but only for applications.


Below is a diagram of my SSD before any attempts SSD before attempt[2]

And when I attempt to copy over the partition by this:Partition comment

This happens:

Afterwards

It erases everything and don't keep any of the flags or properties it had before. Any ideas?

8
  • 1
    When pasting code, it would be better if you used code blocks rather than screenshots, so people can copy it into an answer. I think the problem with your dd command is you are copying one partition to a device, and the device doesn't get a partition table in the process. Try this instead: dd if=/dev/sdh of=/dev/sdg bs=4M. Notice the change from /dev/sdh1 to /dev/sdh. Also, bs=4M to make the transfer faster ;)
    – cryptarch
    Commented Dec 5, 2018 at 19:13
  • @cryptarch Yeah, I know. I have 3k rep in AU its was I was too lazy and wanted to show it exactly.
    – MathCubes
    Commented Dec 5, 2018 at 20:23
  • 1
    I'm too lazy to read your trying or to write a full answer. Just recreate 4 partitions on SSD with exactly same order and size, then dd thos partitions one by one. To be honest, I suggest you should use win instead of byte level copy. Commented Dec 6, 2018 at 2:43
  • @神秘德里克 Can't copy that MS System Reserve Partition. I thought about that already. The problem is there is too many bad sectors. And the drive is form '09. So maybe I should just reinstall it.
    – MathCubes
    Commented Dec 6, 2018 at 3:59
  • If the disk hardware is broken, then there's nothing you can do Commented Dec 6, 2018 at 12:52

1 Answer 1

1

When you do

sudo dd if=/dev/sdh1 of=/dev/sdg bs=4096 conv=notrunc,noerror

you are copying the first partition of sdh to the whole sdg drive, right from the beginning, overwriting the partition table. As you overwrote the partition table, it "erases everything".

So that doesn't work. What you need to do is first to create partitions of proper sizes on sdh, using the proper tools for either MBR (e.g. fdisk, ...) or GBR (e.g. gdisk, gparted, ...). Pick the tool you like best, google for tutorials about how to use them.

After you have created the partitions, you can just copy them (provided the sizes match). So say you want to move the first partition on sdh to the third partition on sdg of the four you have created, you can just do

sudo cp /dev/sdh1 /dev/sdg3

No need to use dd. Double check what you type, if you make a mistake, you'll overwrite stuff you don't want to overwrite.

To keep the partitions bootable, you must mark them in the same way on the new disk as they were marked on the old disk.

1
  • If you make a new partition, it gets a new UUID. If it shall be bootable, the UUIDs must remain as they were before. Don't forget GRUB! For ext4 there is tune2fs -U<copied old UUID>. But for fat, fat32, vfat and for ntfs partitions there is no such tool. askubuntu.com/questions/1406426/… and linux.com/training-tutorials/howto-modify-uuid-ntfs-partition discuss how to fiddle around with the UUIDa aka serial numbers of Microsoft partitions using dd. I consider this quite dangerous. First make a script from it and test it before using! Commented Jan 16 at 22:20

You must log in to answer this question.

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