How to copy partitions from one device to another, including boot partitions?











up vote
3
down vote

favorite












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?










share|improve this question




















  • 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 5 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 5 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 6 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
    Dec 6 at 3:59










  • If the disk hardware is broken, then there's nothing you can do
    – 神秘德里克
    Dec 6 at 12:52















up vote
3
down vote

favorite












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?










share|improve this question




















  • 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 5 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 5 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 6 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
    Dec 6 at 3:59










  • If the disk hardware is broken, then there's nothing you can do
    – 神秘德里克
    Dec 6 at 12:52













up vote
3
down vote

favorite









up vote
3
down vote

favorite











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?










share|improve this question















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?







hard-disk data shared-partition move-partition clone






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago









justinnoor.io

340218




340218










asked Dec 5 at 17:14









MathCubes

176119




176119








  • 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 5 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 5 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 6 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
    Dec 6 at 3:59










  • If the disk hardware is broken, then there's nothing you can do
    – 神秘德里克
    Dec 6 at 12:52














  • 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 5 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 5 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 6 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
    Dec 6 at 3:59










  • If the disk hardware is broken, then there's nothing you can do
    – 神秘德里克
    Dec 6 at 12:52








1




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 5 at 19:13




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 5 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 5 at 20:23




@cryptarch Yeah, I know. I have 3k rep in AU its was I was too lazy and wanted to show it exactly.
– MathCubes
Dec 5 at 20:23




1




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 6 at 2:43






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 6 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
Dec 6 at 3:59




@神秘德里克 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 6 at 3:59












If the disk hardware is broken, then there's nothing you can do
– 神秘德里克
Dec 6 at 12:52




If the disk hardware is broken, then there's nothing you can do
– 神秘德里克
Dec 6 at 12:52










1 Answer
1






active

oldest

votes

















up vote
0
down vote













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.






share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f486198%2fhow-to-copy-partitions-from-one-device-to-another-including-boot-partitions%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    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.






    share|improve this answer

























      up vote
      0
      down vote













      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.






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        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.






        share|improve this answer












        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 6 at 8:04









        dirkt

        16.4k21335




        16.4k21335






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f486198%2fhow-to-copy-partitions-from-one-device-to-another-including-boot-partitions%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            サソリ

            広島県道265号伴広島線

            Setup Asymptote in Texstudio