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?

MathCubes
  • 301
  • 1
  • 2
  • 11
  • 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 Dec 05 '18 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 Dec 05 '18 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. – 炸鱼薯条德里克 Dec 06 '18 at 02: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 Dec 06 '18 at 03:59
  • If the disk hardware is broken, then there's nothing you can do – 炸鱼薯条德里克 Dec 06 '18 at 12:52
  • @神秘德里克 Doesn't do the point. This question is not specified to that hdd. – MathCubes Dec 06 '18 at 18:16
  • Bad sectors means hardware is broken. If wim can't backup that filesystem, then try ghost. – 炸鱼薯条德里克 Dec 07 '18 at 01:02
  • I would use cloning software like `clonezilla`, create an image, and then restore it. As a bonus, you now have a backup copy of your system at this state. – ivanivan Dec 09 '18 at 15:22

1 Answers1

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.

dirkt
  • 31,679
  • 3
  • 40
  • 73