Is it possible to use dd to clone only the part of the hard drive which is used?2019 Community Moderator ElectionUsing DD to copy only half (part) of removable deviceClone whole partition or hard drive to a sparse fileIs `dd` really necessary to clone a disk?why does does windows run checkdisk after I clone into a vm disk it using dd?Cloning hard drive using the dd utilityLinux Mint hard drive clone failed can't boot into KDEDrive name? What is the correct term for the “sda” part of “/dev/sda”?linux - Increase size sdaClone Drive with only Partitioned SpaceEncrypting hard drive containing the MBR with VeracryptHow to mount sda hard drive

What is the smallest number n> 5 so that 5 ^ n ends with "3125"?

El Dorado Word Puzzle II: Videogame Edition

Language involving irrational number is not a CFL

How to get directions in deep space?

Is there a RAID 0 Equivalent for RAM?

Can I run 125kHz RF circuit on a breadboard?

What does "Scientists rise up against statistical significance" mean? (Comment in Nature)

If Captain Marvel (MCU) were to have a child with a human male, would the child be human or Kree?

I'm just a whisper. Who am I?

Identifying "long and narrow" polygons in with PostGIS

Why the "ls" command is showing the permissions of files in a FAT32 partition?

Quoting Keynes in a lecture

The Digit Triangles

Did I make a mistake by ccing email to boss to others?

Would a primitive species be able to learn English from reading books alone?

Mimic lecturing on blackboard, facing audience

Does the Crossbow Expert feat's extra crossbow attack work with the reaction attack from a Hunter ranger's Giant Killer feature?

How do I fix the group tension caused by my character stealing and possibly killing without provocation?

How were servants to the Kaiser of Imperial Germany treated and where may I find more information on them

In One Punch Man, is King actually weak?

Typing CO_2 easily

Can I cause damage to electrical appliances by unplugging them when they are turned on?

Does Doodling or Improvising on the Piano Have Any Benefits?

Why didn’t Eve recognize the little cockroach as a living organism?



Is it possible to use dd to clone only the part of the hard drive which is used?



2019 Community Moderator ElectionUsing DD to copy only half (part) of removable deviceClone whole partition or hard drive to a sparse fileIs `dd` really necessary to clone a disk?why does does windows run checkdisk after I clone into a vm disk it using dd?Cloning hard drive using the dd utilityLinux Mint hard drive clone failed can't boot into KDEDrive name? What is the correct term for the “sda” part of “/dev/sda”?linux - Increase size sdaClone Drive with only Partitioned SpaceEncrypting hard drive containing the MBR with VeracryptHow to mount sda hard drive










2















if only 1/3 of a 300GB hard disk is used. Is it possible to use dd to clone the drive (but only the 100GB that is used)?



dd if=/dev/sda of=clone.img










share|improve this question






















  • What do you mean by used, exactly? Are you saying you have a 100GB partition on the drive, or a 300GB partition with 100GB of data on it?

    – ChemicalRascal
    Sep 10 '14 at 0:57












  • ChemicalRascal - I mean a 300GB particition (C Drive on Windows) with 100 gig of data on it.

    – yoshiserry
    Sep 10 '14 at 1:01











  • Why exactly do you need to use dd?

    – Volker Siegel
    Sep 10 '14 at 1:26











  • I see an interesting solution from here. serverfault.com/a/439149

    – Ramesh
    Sep 10 '14 at 1:29











  • @Ramesh That's brilliant indeed!

    – Volker Siegel
    Sep 10 '14 at 1:40















2















if only 1/3 of a 300GB hard disk is used. Is it possible to use dd to clone the drive (but only the 100GB that is used)?



dd if=/dev/sda of=clone.img










share|improve this question






















  • What do you mean by used, exactly? Are you saying you have a 100GB partition on the drive, or a 300GB partition with 100GB of data on it?

    – ChemicalRascal
    Sep 10 '14 at 0:57












  • ChemicalRascal - I mean a 300GB particition (C Drive on Windows) with 100 gig of data on it.

    – yoshiserry
    Sep 10 '14 at 1:01











  • Why exactly do you need to use dd?

    – Volker Siegel
    Sep 10 '14 at 1:26











  • I see an interesting solution from here. serverfault.com/a/439149

    – Ramesh
    Sep 10 '14 at 1:29











  • @Ramesh That's brilliant indeed!

    – Volker Siegel
    Sep 10 '14 at 1:40













2












2








2








if only 1/3 of a 300GB hard disk is used. Is it possible to use dd to clone the drive (but only the 100GB that is used)?



dd if=/dev/sda of=clone.img










share|improve this question














if only 1/3 of a 300GB hard disk is used. Is it possible to use dd to clone the drive (but only the 100GB that is used)?



dd if=/dev/sda of=clone.img







linux dd file-copy






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Sep 10 '14 at 0:29









yoshiserryyoshiserry

17326




17326












  • What do you mean by used, exactly? Are you saying you have a 100GB partition on the drive, or a 300GB partition with 100GB of data on it?

    – ChemicalRascal
    Sep 10 '14 at 0:57












  • ChemicalRascal - I mean a 300GB particition (C Drive on Windows) with 100 gig of data on it.

    – yoshiserry
    Sep 10 '14 at 1:01











  • Why exactly do you need to use dd?

    – Volker Siegel
    Sep 10 '14 at 1:26











  • I see an interesting solution from here. serverfault.com/a/439149

    – Ramesh
    Sep 10 '14 at 1:29











  • @Ramesh That's brilliant indeed!

    – Volker Siegel
    Sep 10 '14 at 1:40

















  • What do you mean by used, exactly? Are you saying you have a 100GB partition on the drive, or a 300GB partition with 100GB of data on it?

    – ChemicalRascal
    Sep 10 '14 at 0:57












  • ChemicalRascal - I mean a 300GB particition (C Drive on Windows) with 100 gig of data on it.

    – yoshiserry
    Sep 10 '14 at 1:01











  • Why exactly do you need to use dd?

    – Volker Siegel
    Sep 10 '14 at 1:26











  • I see an interesting solution from here. serverfault.com/a/439149

    – Ramesh
    Sep 10 '14 at 1:29











  • @Ramesh That's brilliant indeed!

    – Volker Siegel
    Sep 10 '14 at 1:40
















What do you mean by used, exactly? Are you saying you have a 100GB partition on the drive, or a 300GB partition with 100GB of data on it?

– ChemicalRascal
Sep 10 '14 at 0:57






What do you mean by used, exactly? Are you saying you have a 100GB partition on the drive, or a 300GB partition with 100GB of data on it?

– ChemicalRascal
Sep 10 '14 at 0:57














ChemicalRascal - I mean a 300GB particition (C Drive on Windows) with 100 gig of data on it.

– yoshiserry
Sep 10 '14 at 1:01





ChemicalRascal - I mean a 300GB particition (C Drive on Windows) with 100 gig of data on it.

– yoshiserry
Sep 10 '14 at 1:01













Why exactly do you need to use dd?

– Volker Siegel
Sep 10 '14 at 1:26





Why exactly do you need to use dd?

– Volker Siegel
Sep 10 '14 at 1:26













I see an interesting solution from here. serverfault.com/a/439149

– Ramesh
Sep 10 '14 at 1:29





I see an interesting solution from here. serverfault.com/a/439149

– Ramesh
Sep 10 '14 at 1:29













@Ramesh That's brilliant indeed!

– Volker Siegel
Sep 10 '14 at 1:40





@Ramesh That's brilliant indeed!

– Volker Siegel
Sep 10 '14 at 1:40










2 Answers
2






active

oldest

votes


















3














Can not dd parts of filesystem



You can use dd to copy a whole partition, which could be only a part of the harddisk.



You are asking whether you can use dd to copy part of a partition.



In the general case, that can not work:

It would mean you copy only a part of a file system. There is no reason the actual data should be at the start of the available space. And even if it was, there will still be relevant information in other parts in general.



It something like this would work - possibly with a different tool than dd, that tool would need to understand how the data is structured on the partition - that is, it needs to understand the filesystem.



It sounds more useful to let the normal filesystem driver understand how the data is arranged on the disk, and use tar or similar to pack up that data to put it somewhere else.



Resize filesystem, use dd then



One way to do something similar to what you ask for would be to resize the partition.



In a first step, resize the 300GB partition that is only filled to one third to a partition of slightly above 100GB which is almost full.



gparted, a GNOME-focused GUI front-end for the libparted library, is a commonly recommended partitioning manager, but the parted CLI front-end also exists (and is actually the reference implementation for libparted). cfdisk, fdisk and the like are also CLI options, and while I'd say they're less friendly than gparted most Linux distros should have them as part of the core utilities package.



After resizing, you can use dd in the standard way on a complete partition, containing a complete file system.



Filesystem archive tool



Depending on what you want to do, this may also be helpful:



fsarchiver is a tool that creates custom images from filesystems in a compressed format, that need to be unpacked with the same tool.



I would not recommend the tool in general to create images because of the custom format, but as an intermediate state it may make sense. You would create an image of the existing partition, that will not need space for the empty part of the file system. Then, you can use it to unpack it to a different partition and a different file system. The filesystem is generated by fsarchiver as part of the unpacking.






share|improve this answer
































    0














    partclone (from the same authors as CloneZilla) can do that. It does not seem to use a DD compatible image format though.



    partimage can also do that, with less supported filesystems.



    You should be able to convert the images to DD compatible format by restoring the images to a file. (You might want to convert it to sparse file as well)



    You won't be able to restore the image to a smaller disk, since it is still a block image, but it uses knowledge of the filesystem to skipped the unused parts.



    Exact commands needs more info, like the source filesystem, since partimage comes in filesystem-specific versions.






    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',
      autoActivateHeartbeat: false,
      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%2f154698%2fis-it-possible-to-use-dd-to-clone-only-the-part-of-the-hard-drive-which-is-used%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      3














      Can not dd parts of filesystem



      You can use dd to copy a whole partition, which could be only a part of the harddisk.



      You are asking whether you can use dd to copy part of a partition.



      In the general case, that can not work:

      It would mean you copy only a part of a file system. There is no reason the actual data should be at the start of the available space. And even if it was, there will still be relevant information in other parts in general.



      It something like this would work - possibly with a different tool than dd, that tool would need to understand how the data is structured on the partition - that is, it needs to understand the filesystem.



      It sounds more useful to let the normal filesystem driver understand how the data is arranged on the disk, and use tar or similar to pack up that data to put it somewhere else.



      Resize filesystem, use dd then



      One way to do something similar to what you ask for would be to resize the partition.



      In a first step, resize the 300GB partition that is only filled to one third to a partition of slightly above 100GB which is almost full.



      gparted, a GNOME-focused GUI front-end for the libparted library, is a commonly recommended partitioning manager, but the parted CLI front-end also exists (and is actually the reference implementation for libparted). cfdisk, fdisk and the like are also CLI options, and while I'd say they're less friendly than gparted most Linux distros should have them as part of the core utilities package.



      After resizing, you can use dd in the standard way on a complete partition, containing a complete file system.



      Filesystem archive tool



      Depending on what you want to do, this may also be helpful:



      fsarchiver is a tool that creates custom images from filesystems in a compressed format, that need to be unpacked with the same tool.



      I would not recommend the tool in general to create images because of the custom format, but as an intermediate state it may make sense. You would create an image of the existing partition, that will not need space for the empty part of the file system. Then, you can use it to unpack it to a different partition and a different file system. The filesystem is generated by fsarchiver as part of the unpacking.






      share|improve this answer





























        3














        Can not dd parts of filesystem



        You can use dd to copy a whole partition, which could be only a part of the harddisk.



        You are asking whether you can use dd to copy part of a partition.



        In the general case, that can not work:

        It would mean you copy only a part of a file system. There is no reason the actual data should be at the start of the available space. And even if it was, there will still be relevant information in other parts in general.



        It something like this would work - possibly with a different tool than dd, that tool would need to understand how the data is structured on the partition - that is, it needs to understand the filesystem.



        It sounds more useful to let the normal filesystem driver understand how the data is arranged on the disk, and use tar or similar to pack up that data to put it somewhere else.



        Resize filesystem, use dd then



        One way to do something similar to what you ask for would be to resize the partition.



        In a first step, resize the 300GB partition that is only filled to one third to a partition of slightly above 100GB which is almost full.



        gparted, a GNOME-focused GUI front-end for the libparted library, is a commonly recommended partitioning manager, but the parted CLI front-end also exists (and is actually the reference implementation for libparted). cfdisk, fdisk and the like are also CLI options, and while I'd say they're less friendly than gparted most Linux distros should have them as part of the core utilities package.



        After resizing, you can use dd in the standard way on a complete partition, containing a complete file system.



        Filesystem archive tool



        Depending on what you want to do, this may also be helpful:



        fsarchiver is a tool that creates custom images from filesystems in a compressed format, that need to be unpacked with the same tool.



        I would not recommend the tool in general to create images because of the custom format, but as an intermediate state it may make sense. You would create an image of the existing partition, that will not need space for the empty part of the file system. Then, you can use it to unpack it to a different partition and a different file system. The filesystem is generated by fsarchiver as part of the unpacking.






        share|improve this answer



























          3












          3








          3







          Can not dd parts of filesystem



          You can use dd to copy a whole partition, which could be only a part of the harddisk.



          You are asking whether you can use dd to copy part of a partition.



          In the general case, that can not work:

          It would mean you copy only a part of a file system. There is no reason the actual data should be at the start of the available space. And even if it was, there will still be relevant information in other parts in general.



          It something like this would work - possibly with a different tool than dd, that tool would need to understand how the data is structured on the partition - that is, it needs to understand the filesystem.



          It sounds more useful to let the normal filesystem driver understand how the data is arranged on the disk, and use tar or similar to pack up that data to put it somewhere else.



          Resize filesystem, use dd then



          One way to do something similar to what you ask for would be to resize the partition.



          In a first step, resize the 300GB partition that is only filled to one third to a partition of slightly above 100GB which is almost full.



          gparted, a GNOME-focused GUI front-end for the libparted library, is a commonly recommended partitioning manager, but the parted CLI front-end also exists (and is actually the reference implementation for libparted). cfdisk, fdisk and the like are also CLI options, and while I'd say they're less friendly than gparted most Linux distros should have them as part of the core utilities package.



          After resizing, you can use dd in the standard way on a complete partition, containing a complete file system.



          Filesystem archive tool



          Depending on what you want to do, this may also be helpful:



          fsarchiver is a tool that creates custom images from filesystems in a compressed format, that need to be unpacked with the same tool.



          I would not recommend the tool in general to create images because of the custom format, but as an intermediate state it may make sense. You would create an image of the existing partition, that will not need space for the empty part of the file system. Then, you can use it to unpack it to a different partition and a different file system. The filesystem is generated by fsarchiver as part of the unpacking.






          share|improve this answer















          Can not dd parts of filesystem



          You can use dd to copy a whole partition, which could be only a part of the harddisk.



          You are asking whether you can use dd to copy part of a partition.



          In the general case, that can not work:

          It would mean you copy only a part of a file system. There is no reason the actual data should be at the start of the available space. And even if it was, there will still be relevant information in other parts in general.



          It something like this would work - possibly with a different tool than dd, that tool would need to understand how the data is structured on the partition - that is, it needs to understand the filesystem.



          It sounds more useful to let the normal filesystem driver understand how the data is arranged on the disk, and use tar or similar to pack up that data to put it somewhere else.



          Resize filesystem, use dd then



          One way to do something similar to what you ask for would be to resize the partition.



          In a first step, resize the 300GB partition that is only filled to one third to a partition of slightly above 100GB which is almost full.



          gparted, a GNOME-focused GUI front-end for the libparted library, is a commonly recommended partitioning manager, but the parted CLI front-end also exists (and is actually the reference implementation for libparted). cfdisk, fdisk and the like are also CLI options, and while I'd say they're less friendly than gparted most Linux distros should have them as part of the core utilities package.



          After resizing, you can use dd in the standard way on a complete partition, containing a complete file system.



          Filesystem archive tool



          Depending on what you want to do, this may also be helpful:



          fsarchiver is a tool that creates custom images from filesystems in a compressed format, that need to be unpacked with the same tool.



          I would not recommend the tool in general to create images because of the custom format, but as an intermediate state it may make sense. You would create an image of the existing partition, that will not need space for the empty part of the file system. Then, you can use it to unpack it to a different partition and a different file system. The filesystem is generated by fsarchiver as part of the unpacking.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 10 '14 at 10:49









          ChemicalRascal

          1831113




          1831113










          answered Sep 10 '14 at 1:16









          Volker SiegelVolker Siegel

          11.1k33261




          11.1k33261























              0














              partclone (from the same authors as CloneZilla) can do that. It does not seem to use a DD compatible image format though.



              partimage can also do that, with less supported filesystems.



              You should be able to convert the images to DD compatible format by restoring the images to a file. (You might want to convert it to sparse file as well)



              You won't be able to restore the image to a smaller disk, since it is still a block image, but it uses knowledge of the filesystem to skipped the unused parts.



              Exact commands needs more info, like the source filesystem, since partimage comes in filesystem-specific versions.






              share|improve this answer



























                0














                partclone (from the same authors as CloneZilla) can do that. It does not seem to use a DD compatible image format though.



                partimage can also do that, with less supported filesystems.



                You should be able to convert the images to DD compatible format by restoring the images to a file. (You might want to convert it to sparse file as well)



                You won't be able to restore the image to a smaller disk, since it is still a block image, but it uses knowledge of the filesystem to skipped the unused parts.



                Exact commands needs more info, like the source filesystem, since partimage comes in filesystem-specific versions.






                share|improve this answer

























                  0












                  0








                  0







                  partclone (from the same authors as CloneZilla) can do that. It does not seem to use a DD compatible image format though.



                  partimage can also do that, with less supported filesystems.



                  You should be able to convert the images to DD compatible format by restoring the images to a file. (You might want to convert it to sparse file as well)



                  You won't be able to restore the image to a smaller disk, since it is still a block image, but it uses knowledge of the filesystem to skipped the unused parts.



                  Exact commands needs more info, like the source filesystem, since partimage comes in filesystem-specific versions.






                  share|improve this answer













                  partclone (from the same authors as CloneZilla) can do that. It does not seem to use a DD compatible image format though.



                  partimage can also do that, with less supported filesystems.



                  You should be able to convert the images to DD compatible format by restoring the images to a file. (You might want to convert it to sparse file as well)



                  You won't be able to restore the image to a smaller disk, since it is still a block image, but it uses knowledge of the filesystem to skipped the unused parts.



                  Exact commands needs more info, like the source filesystem, since partimage comes in filesystem-specific versions.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 20 hours ago









                  Gert van den BergGert van den Berg

                  1,045616




                  1,045616



























                      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.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f154698%2fis-it-possible-to-use-dd-to-clone-only-the-part-of-the-hard-drive-which-is-used%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

                      getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

                      Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

                      Marilyn Monroe Ny fiainany manokana | Jereo koa | Meny fitetezanafanitarana azy.