Copy entire file system hierarchy from one drive to another












87















I would like to copy the entire file system hierarchy from one drive to another..i.e contents of each directory as well as regular files in Linux platform. Would be gratefull to know the best way to do that with possibly Linuxes in-built functions. The file system is a ext family.










share|improve this question















migrated from stackoverflow.com Jul 7 '11 at 9:07


This question came from our site for professional and enthusiast programmers.














  • 1





    Umm... where is the love for dd? dd if=/dev/sda1 of=/dev/sdb1 bs=4096

    – juniorRubyist
    Mar 25 '17 at 5:08













  • @juniorRubyist +1 for dd. I always use that. But which flags to use? I use conv=notrunc,noerror,sync.

    – BeniBela
    Aug 30 '17 at 12:10
















87















I would like to copy the entire file system hierarchy from one drive to another..i.e contents of each directory as well as regular files in Linux platform. Would be gratefull to know the best way to do that with possibly Linuxes in-built functions. The file system is a ext family.










share|improve this question















migrated from stackoverflow.com Jul 7 '11 at 9:07


This question came from our site for professional and enthusiast programmers.














  • 1





    Umm... where is the love for dd? dd if=/dev/sda1 of=/dev/sdb1 bs=4096

    – juniorRubyist
    Mar 25 '17 at 5:08













  • @juniorRubyist +1 for dd. I always use that. But which flags to use? I use conv=notrunc,noerror,sync.

    – BeniBela
    Aug 30 '17 at 12:10














87












87








87


59






I would like to copy the entire file system hierarchy from one drive to another..i.e contents of each directory as well as regular files in Linux platform. Would be gratefull to know the best way to do that with possibly Linuxes in-built functions. The file system is a ext family.










share|improve this question
















I would like to copy the entire file system hierarchy from one drive to another..i.e contents of each directory as well as regular files in Linux platform. Would be gratefull to know the best way to do that with possibly Linuxes in-built functions. The file system is a ext family.







linux filesystems






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 24 '14 at 9:11









Chenmunka

2,79481931




2,79481931










asked Jul 7 '11 at 3:30









JugglerJuggler

536154




536154




migrated from stackoverflow.com Jul 7 '11 at 9:07


This question came from our site for professional and enthusiast programmers.









migrated from stackoverflow.com Jul 7 '11 at 9:07


This question came from our site for professional and enthusiast programmers.










  • 1





    Umm... where is the love for dd? dd if=/dev/sda1 of=/dev/sdb1 bs=4096

    – juniorRubyist
    Mar 25 '17 at 5:08













  • @juniorRubyist +1 for dd. I always use that. But which flags to use? I use conv=notrunc,noerror,sync.

    – BeniBela
    Aug 30 '17 at 12:10














  • 1





    Umm... where is the love for dd? dd if=/dev/sda1 of=/dev/sdb1 bs=4096

    – juniorRubyist
    Mar 25 '17 at 5:08













  • @juniorRubyist +1 for dd. I always use that. But which flags to use? I use conv=notrunc,noerror,sync.

    – BeniBela
    Aug 30 '17 at 12:10








1




1





Umm... where is the love for dd? dd if=/dev/sda1 of=/dev/sdb1 bs=4096

– juniorRubyist
Mar 25 '17 at 5:08







Umm... where is the love for dd? dd if=/dev/sda1 of=/dev/sdb1 bs=4096

– juniorRubyist
Mar 25 '17 at 5:08















@juniorRubyist +1 for dd. I always use that. But which flags to use? I use conv=notrunc,noerror,sync.

– BeniBela
Aug 30 '17 at 12:10





@juniorRubyist +1 for dd. I always use that. But which flags to use? I use conv=notrunc,noerror,sync.

– BeniBela
Aug 30 '17 at 12:10










10 Answers
10






active

oldest

votes


















32














I often use



> cp -ax / /mnt


Presuming /mnt is the new disk mounted on /mnt and there are no other mounts on /.



the -x keeps it on the one filesystem.



This of course needs to be done as root or using sudo.



This link has some alternatives, including the one above



http://linuxdocs.org/HOWTOs/mini/Hard-Disk-Upgrade/copy.html






share|improve this answer































    178














    What you want is rsync.



    This command can be used to synchronize a folder, and also resume copying when it's aborted half way. The command to copy one disk is:



    rsync -avxHAX --progress / /new-disk/


    The options are:



    -a  : all files, with permissions, etc..
    -v : verbose, mention files
    -x : stay on one file system
    -H : preserve hard links (not included with -a)
    -A : preserve ACLs/permissions (not included with -a)
    -X : preserve extended attributes (not included with -a)


    To improve the copy speed, add -W (--whole-file), to avoid calculating deltas/diffs of the files. This is the default when both the source and destination are specified as local paths, since the real benefit of rsync's delta-transfer algorithm is reducing network usage.



    Also consider adding --numeric-ids to avoid mapping uid/gid values by user/group name.






    share|improve this answer





















    • 1





      Genius, thank you. Btw, I ended up using rsync -avxHAWX --numeric-ids --progress / mnt/ but I should have done rsync -avxHAWX --numeric-ids --progress / mnt/ > ~/rsync.out. I suspect pouring the output to the terminal slowed the process. :D

      – Chris K
      Jan 15 '14 at 10:15






    • 22





      --info=progress2 instead of --progress is useful for large transfers, as it gives overall progress, instead of (millions of lines for) individual files.

      – Florian
      Sep 27 '15 at 8:43






    • 3





      I had to replace X and A with E, because extended attributes and ACLs are covered by E on my mac. Tested: rsync version 2.6.9 protocol version 29

      – Jonathan Komar
      Aug 4 '16 at 5:17








    • 1





      In addition to > ~/rsync.out, 2> ~/rsync.err will save any errors in a separate file.

      – Aneel
      Mar 5 '17 at 0:45






    • 1





      If you're copying from some other folder than /, note that having a trailing slash (or not) on the source directory makes a difference: rsync source/ dest/ copies everything inside source/ to dest/, while rsync source dest/ copies the folder source and everything inside into dest/.

      – semi-extrinsic
      Mar 20 '17 at 8:22





















    29














    Michael Aaron Safyan's answer doesn't account for sparse files. -S option fixes that.



    Also this variant doesn't spam with the each file progressing and doesn't do delta syncing which kills performance in non-network cases.



    Perfect for copying filesystem from one local drive to another local drive.



    rsync -axHAWXS --numeric-ids --info=progress2





    share|improve this answer



















    • 1





      Amazing. This is really doing a good job

      – Gildas
      Jul 26 '18 at 8:13






    • 1





      This should be the accepted answer, works great. Example 55,431,669,792 57% 97.47MB/s 0:06:56 xfr#2888, ir-chk=5593/8534)

      – Drew
      Aug 4 '18 at 3:11








    • 1





      <3 this is perfect

      – Tim Strijdhorst
      Jan 21 at 15:10



















    6














    For a one shot local copy from one drive to another, I guess cp suffices as described by Wolfmann here above.



    For bigger works like local or remote backups for instance, the best is rsync.



    Of course, rsync is significantly more complex to use.



    Why rsync :




    • this allows you to copy (synchronized
      copy) all or part of your drive A to
      drive B, with many options, like
      excluding some directories from the
      copy (for instance excluding /proc).


    • Another big advantage is that this
      native tool monitors the file
      transfer: eg for massive transfers,
      if the connection is interrupted, it
      will continue from the breakpoint.


    • And last but not least, rsync uses
      ssh connection, so this allow you to
      achive remote synchronized secured
      "copies". Have a look to the man
      page
      as well as here for some
      examples.







    share|improve this answer































      3














      Like Michael Safyan suggests above, I've used rsync for this purpose. I suggest using some additional options to exclude directories that you probably don't want to copy.



      This version is fairly specific to Gnome- and Debian/Ubuntu-based systems, since it includes subdirectories of users' home directories which are specific to Gnome, as well as the APT package cache.



      The last line will exclude any directory named cache/Cache/.cache, which may be too aggressive for some uses:



      rsync -WavxHAX --delete-excluded --progress 
      /mnt/from/ /mnt/to/
      --exclude='/home/*/.gvfs'
      --exclude='/home/*/.local/share/Trash'
      --exclude='/var/run/*'
      --exclude='/var/lock/*'
      --exclude='/lib/modules/*/volatile/.mounted'
      --exclude='/var/cache/apt/archives/*'
      --exclude='/home/*/.mozilla/firefox/*/Cache'
      --exclude='/home/*/.cache/chromium'
      --exclude='home/*/.thumbnails'
      --exclude=.cache --exclude Cache --exclude cache





      share|improve this answer































        2














        Adding two useful bits to the thread re rsync: changing cypher, and using --update:



        As per Wolfman's post, cp -ax is elegant, and cool for local stuff.



        However, rsync is awesome also. Further to Michael's answer re -W, changing the cypher can also speed things up (read up on any security implications though).



        rsync --progress --rsh="ssh -c blowfish" / /mnt/dest -auvx


        There is some discussion (and benchmarks) around the place about a slow CPU being the actual bottleneck, but it does seem to help me when machine is loaded up doing other concurrent things.



        One of the other big reasons for using rsync in a large, recursive copy like this is because of the -u switch (or --update). If there is a problem during the copy, you can fix it up, and rsync will pick up where it left off (I don't think scp has this). Doing it locally, cp also has a -u switch.



        (I'm not certain what the implications of --update and --whole-file together are, but they always seem to work sensibly for me in this type of task)



        I realise this isn't a thread about rsync's features, but some of the most common I use for this are:





        • --delete-after etc (as Michael mentioned in follow-up), if you want to sync the new system back to the original place or something like that. And,


        • --exclude - for skipping directories/files, for instances like copying/creating a new system to a new place whilst skipping user home directories etc (either you are mounting homes from somewhere else, or creating new users etc).


        Incidentally, if I ever have to use windows, I use rsync from cygwin to do large recursive copies, because of explorer's slightly brain-dead wanting to start from the beginning (although I find Finder is OS X even worse)






        share|improve this answer

































          2














          rsync




          "This approach is considered to be better than disk cloning with dd
          since it allows for a different size, partition table and filesystem
          to be used, and better than copying with cp -a as well, because it
          allows greater control over file permissions, attributes, Access
          Control Lists (ACLs) and extended attributes."




          From:



          https://wiki.archlinux.org/index.php/Full_system_backup_with_rsync



          Man Page Here






          share|improve this answer

































            1














            As mentioned in the comments by juniorRubyist, the preferred approach here should be to use dd. The main reason is performance, it's a block-by-block copy instead of file-by-file.



            Cloning a partition



            # dd if=/dev/sda1 of=/dev/sdb1 bs=64K conv=noerror,sync status=progress


            Cloning an entire disk



            # dd if=/dev/sdX of=/dev/sdY bs=64K conv=noerror,sync status=progress


            References




            1. https://wiki.archlinux.org/index.php/disk_cloning






            share|improve this answer

































              1














              'dd' is awesome, but ddrescue (apt install gddrescue) is even better. If dd gets interrupted, there is no way to restart (another good reason to use rsync). When you use ddrescue with a logfile, it keeps track of which blocks have been copied.



              When backing up a dual boot Windows/Linux system, I use ntfsclone for the Windows partitions and ddrescue for the Linux partition and dd for the MBR. (I haven't tried to back up a dual boot system using GPT/UEFI.)



              What I'd love to see is a ddrescue tool that can create files like ntfsclone where unallocated space is marked with control characters. This makes the image not directly mountable, but allows it to be only as big as the contained data.



              Someone please come up with the ntfsclone "special image format" for ddrescue...






              share|improve this answer































                0














                rsync is the perfect solution as explained above.



                I'd just add -S to "handle sparse files efficiently" in case there is a docker devicemapper volume or similar to be copied.






                share|improve this answer
































                  10 Answers
                  10






                  active

                  oldest

                  votes








                  10 Answers
                  10






                  active

                  oldest

                  votes









                  active

                  oldest

                  votes






                  active

                  oldest

                  votes









                  32














                  I often use



                  > cp -ax / /mnt


                  Presuming /mnt is the new disk mounted on /mnt and there are no other mounts on /.



                  the -x keeps it on the one filesystem.



                  This of course needs to be done as root or using sudo.



                  This link has some alternatives, including the one above



                  http://linuxdocs.org/HOWTOs/mini/Hard-Disk-Upgrade/copy.html






                  share|improve this answer




























                    32














                    I often use



                    > cp -ax / /mnt


                    Presuming /mnt is the new disk mounted on /mnt and there are no other mounts on /.



                    the -x keeps it on the one filesystem.



                    This of course needs to be done as root or using sudo.



                    This link has some alternatives, including the one above



                    http://linuxdocs.org/HOWTOs/mini/Hard-Disk-Upgrade/copy.html






                    share|improve this answer


























                      32












                      32








                      32







                      I often use



                      > cp -ax / /mnt


                      Presuming /mnt is the new disk mounted on /mnt and there are no other mounts on /.



                      the -x keeps it on the one filesystem.



                      This of course needs to be done as root or using sudo.



                      This link has some alternatives, including the one above



                      http://linuxdocs.org/HOWTOs/mini/Hard-Disk-Upgrade/copy.html






                      share|improve this answer













                      I often use



                      > cp -ax / /mnt


                      Presuming /mnt is the new disk mounted on /mnt and there are no other mounts on /.



                      the -x keeps it on the one filesystem.



                      This of course needs to be done as root or using sudo.



                      This link has some alternatives, including the one above



                      http://linuxdocs.org/HOWTOs/mini/Hard-Disk-Upgrade/copy.html







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Jul 7 '11 at 3:42









                      WolfmanJMWolfmanJM

                      79445




                      79445

























                          178














                          What you want is rsync.



                          This command can be used to synchronize a folder, and also resume copying when it's aborted half way. The command to copy one disk is:



                          rsync -avxHAX --progress / /new-disk/


                          The options are:



                          -a  : all files, with permissions, etc..
                          -v : verbose, mention files
                          -x : stay on one file system
                          -H : preserve hard links (not included with -a)
                          -A : preserve ACLs/permissions (not included with -a)
                          -X : preserve extended attributes (not included with -a)


                          To improve the copy speed, add -W (--whole-file), to avoid calculating deltas/diffs of the files. This is the default when both the source and destination are specified as local paths, since the real benefit of rsync's delta-transfer algorithm is reducing network usage.



                          Also consider adding --numeric-ids to avoid mapping uid/gid values by user/group name.






                          share|improve this answer





















                          • 1





                            Genius, thank you. Btw, I ended up using rsync -avxHAWX --numeric-ids --progress / mnt/ but I should have done rsync -avxHAWX --numeric-ids --progress / mnt/ > ~/rsync.out. I suspect pouring the output to the terminal slowed the process. :D

                            – Chris K
                            Jan 15 '14 at 10:15






                          • 22





                            --info=progress2 instead of --progress is useful for large transfers, as it gives overall progress, instead of (millions of lines for) individual files.

                            – Florian
                            Sep 27 '15 at 8:43






                          • 3





                            I had to replace X and A with E, because extended attributes and ACLs are covered by E on my mac. Tested: rsync version 2.6.9 protocol version 29

                            – Jonathan Komar
                            Aug 4 '16 at 5:17








                          • 1





                            In addition to > ~/rsync.out, 2> ~/rsync.err will save any errors in a separate file.

                            – Aneel
                            Mar 5 '17 at 0:45






                          • 1





                            If you're copying from some other folder than /, note that having a trailing slash (or not) on the source directory makes a difference: rsync source/ dest/ copies everything inside source/ to dest/, while rsync source dest/ copies the folder source and everything inside into dest/.

                            – semi-extrinsic
                            Mar 20 '17 at 8:22


















                          178














                          What you want is rsync.



                          This command can be used to synchronize a folder, and also resume copying when it's aborted half way. The command to copy one disk is:



                          rsync -avxHAX --progress / /new-disk/


                          The options are:



                          -a  : all files, with permissions, etc..
                          -v : verbose, mention files
                          -x : stay on one file system
                          -H : preserve hard links (not included with -a)
                          -A : preserve ACLs/permissions (not included with -a)
                          -X : preserve extended attributes (not included with -a)


                          To improve the copy speed, add -W (--whole-file), to avoid calculating deltas/diffs of the files. This is the default when both the source and destination are specified as local paths, since the real benefit of rsync's delta-transfer algorithm is reducing network usage.



                          Also consider adding --numeric-ids to avoid mapping uid/gid values by user/group name.






                          share|improve this answer





















                          • 1





                            Genius, thank you. Btw, I ended up using rsync -avxHAWX --numeric-ids --progress / mnt/ but I should have done rsync -avxHAWX --numeric-ids --progress / mnt/ > ~/rsync.out. I suspect pouring the output to the terminal slowed the process. :D

                            – Chris K
                            Jan 15 '14 at 10:15






                          • 22





                            --info=progress2 instead of --progress is useful for large transfers, as it gives overall progress, instead of (millions of lines for) individual files.

                            – Florian
                            Sep 27 '15 at 8:43






                          • 3





                            I had to replace X and A with E, because extended attributes and ACLs are covered by E on my mac. Tested: rsync version 2.6.9 protocol version 29

                            – Jonathan Komar
                            Aug 4 '16 at 5:17








                          • 1





                            In addition to > ~/rsync.out, 2> ~/rsync.err will save any errors in a separate file.

                            – Aneel
                            Mar 5 '17 at 0:45






                          • 1





                            If you're copying from some other folder than /, note that having a trailing slash (or not) on the source directory makes a difference: rsync source/ dest/ copies everything inside source/ to dest/, while rsync source dest/ copies the folder source and everything inside into dest/.

                            – semi-extrinsic
                            Mar 20 '17 at 8:22
















                          178












                          178








                          178







                          What you want is rsync.



                          This command can be used to synchronize a folder, and also resume copying when it's aborted half way. The command to copy one disk is:



                          rsync -avxHAX --progress / /new-disk/


                          The options are:



                          -a  : all files, with permissions, etc..
                          -v : verbose, mention files
                          -x : stay on one file system
                          -H : preserve hard links (not included with -a)
                          -A : preserve ACLs/permissions (not included with -a)
                          -X : preserve extended attributes (not included with -a)


                          To improve the copy speed, add -W (--whole-file), to avoid calculating deltas/diffs of the files. This is the default when both the source and destination are specified as local paths, since the real benefit of rsync's delta-transfer algorithm is reducing network usage.



                          Also consider adding --numeric-ids to avoid mapping uid/gid values by user/group name.






                          share|improve this answer















                          What you want is rsync.



                          This command can be used to synchronize a folder, and also resume copying when it's aborted half way. The command to copy one disk is:



                          rsync -avxHAX --progress / /new-disk/


                          The options are:



                          -a  : all files, with permissions, etc..
                          -v : verbose, mention files
                          -x : stay on one file system
                          -H : preserve hard links (not included with -a)
                          -A : preserve ACLs/permissions (not included with -a)
                          -X : preserve extended attributes (not included with -a)


                          To improve the copy speed, add -W (--whole-file), to avoid calculating deltas/diffs of the files. This is the default when both the source and destination are specified as local paths, since the real benefit of rsync's delta-transfer algorithm is reducing network usage.



                          Also consider adding --numeric-ids to avoid mapping uid/gid values by user/group name.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Jul 6 '13 at 5:39









                          Raman

                          18316




                          18316










                          answered Jul 7 '11 at 3:36









                          Michael Aaron SafyanMichael Aaron Safyan

                          2,28531114




                          2,28531114








                          • 1





                            Genius, thank you. Btw, I ended up using rsync -avxHAWX --numeric-ids --progress / mnt/ but I should have done rsync -avxHAWX --numeric-ids --progress / mnt/ > ~/rsync.out. I suspect pouring the output to the terminal slowed the process. :D

                            – Chris K
                            Jan 15 '14 at 10:15






                          • 22





                            --info=progress2 instead of --progress is useful for large transfers, as it gives overall progress, instead of (millions of lines for) individual files.

                            – Florian
                            Sep 27 '15 at 8:43






                          • 3





                            I had to replace X and A with E, because extended attributes and ACLs are covered by E on my mac. Tested: rsync version 2.6.9 protocol version 29

                            – Jonathan Komar
                            Aug 4 '16 at 5:17








                          • 1





                            In addition to > ~/rsync.out, 2> ~/rsync.err will save any errors in a separate file.

                            – Aneel
                            Mar 5 '17 at 0:45






                          • 1





                            If you're copying from some other folder than /, note that having a trailing slash (or not) on the source directory makes a difference: rsync source/ dest/ copies everything inside source/ to dest/, while rsync source dest/ copies the folder source and everything inside into dest/.

                            – semi-extrinsic
                            Mar 20 '17 at 8:22
















                          • 1





                            Genius, thank you. Btw, I ended up using rsync -avxHAWX --numeric-ids --progress / mnt/ but I should have done rsync -avxHAWX --numeric-ids --progress / mnt/ > ~/rsync.out. I suspect pouring the output to the terminal slowed the process. :D

                            – Chris K
                            Jan 15 '14 at 10:15






                          • 22





                            --info=progress2 instead of --progress is useful for large transfers, as it gives overall progress, instead of (millions of lines for) individual files.

                            – Florian
                            Sep 27 '15 at 8:43






                          • 3





                            I had to replace X and A with E, because extended attributes and ACLs are covered by E on my mac. Tested: rsync version 2.6.9 protocol version 29

                            – Jonathan Komar
                            Aug 4 '16 at 5:17








                          • 1





                            In addition to > ~/rsync.out, 2> ~/rsync.err will save any errors in a separate file.

                            – Aneel
                            Mar 5 '17 at 0:45






                          • 1





                            If you're copying from some other folder than /, note that having a trailing slash (or not) on the source directory makes a difference: rsync source/ dest/ copies everything inside source/ to dest/, while rsync source dest/ copies the folder source and everything inside into dest/.

                            – semi-extrinsic
                            Mar 20 '17 at 8:22










                          1




                          1





                          Genius, thank you. Btw, I ended up using rsync -avxHAWX --numeric-ids --progress / mnt/ but I should have done rsync -avxHAWX --numeric-ids --progress / mnt/ > ~/rsync.out. I suspect pouring the output to the terminal slowed the process. :D

                          – Chris K
                          Jan 15 '14 at 10:15





                          Genius, thank you. Btw, I ended up using rsync -avxHAWX --numeric-ids --progress / mnt/ but I should have done rsync -avxHAWX --numeric-ids --progress / mnt/ > ~/rsync.out. I suspect pouring the output to the terminal slowed the process. :D

                          – Chris K
                          Jan 15 '14 at 10:15




                          22




                          22





                          --info=progress2 instead of --progress is useful for large transfers, as it gives overall progress, instead of (millions of lines for) individual files.

                          – Florian
                          Sep 27 '15 at 8:43





                          --info=progress2 instead of --progress is useful for large transfers, as it gives overall progress, instead of (millions of lines for) individual files.

                          – Florian
                          Sep 27 '15 at 8:43




                          3




                          3





                          I had to replace X and A with E, because extended attributes and ACLs are covered by E on my mac. Tested: rsync version 2.6.9 protocol version 29

                          – Jonathan Komar
                          Aug 4 '16 at 5:17







                          I had to replace X and A with E, because extended attributes and ACLs are covered by E on my mac. Tested: rsync version 2.6.9 protocol version 29

                          – Jonathan Komar
                          Aug 4 '16 at 5:17






                          1




                          1





                          In addition to > ~/rsync.out, 2> ~/rsync.err will save any errors in a separate file.

                          – Aneel
                          Mar 5 '17 at 0:45





                          In addition to > ~/rsync.out, 2> ~/rsync.err will save any errors in a separate file.

                          – Aneel
                          Mar 5 '17 at 0:45




                          1




                          1





                          If you're copying from some other folder than /, note that having a trailing slash (or not) on the source directory makes a difference: rsync source/ dest/ copies everything inside source/ to dest/, while rsync source dest/ copies the folder source and everything inside into dest/.

                          – semi-extrinsic
                          Mar 20 '17 at 8:22







                          If you're copying from some other folder than /, note that having a trailing slash (or not) on the source directory makes a difference: rsync source/ dest/ copies everything inside source/ to dest/, while rsync source dest/ copies the folder source and everything inside into dest/.

                          – semi-extrinsic
                          Mar 20 '17 at 8:22













                          29














                          Michael Aaron Safyan's answer doesn't account for sparse files. -S option fixes that.



                          Also this variant doesn't spam with the each file progressing and doesn't do delta syncing which kills performance in non-network cases.



                          Perfect for copying filesystem from one local drive to another local drive.



                          rsync -axHAWXS --numeric-ids --info=progress2





                          share|improve this answer



















                          • 1





                            Amazing. This is really doing a good job

                            – Gildas
                            Jul 26 '18 at 8:13






                          • 1





                            This should be the accepted answer, works great. Example 55,431,669,792 57% 97.47MB/s 0:06:56 xfr#2888, ir-chk=5593/8534)

                            – Drew
                            Aug 4 '18 at 3:11








                          • 1





                            <3 this is perfect

                            – Tim Strijdhorst
                            Jan 21 at 15:10
















                          29














                          Michael Aaron Safyan's answer doesn't account for sparse files. -S option fixes that.



                          Also this variant doesn't spam with the each file progressing and doesn't do delta syncing which kills performance in non-network cases.



                          Perfect for copying filesystem from one local drive to another local drive.



                          rsync -axHAWXS --numeric-ids --info=progress2





                          share|improve this answer



















                          • 1





                            Amazing. This is really doing a good job

                            – Gildas
                            Jul 26 '18 at 8:13






                          • 1





                            This should be the accepted answer, works great. Example 55,431,669,792 57% 97.47MB/s 0:06:56 xfr#2888, ir-chk=5593/8534)

                            – Drew
                            Aug 4 '18 at 3:11








                          • 1





                            <3 this is perfect

                            – Tim Strijdhorst
                            Jan 21 at 15:10














                          29












                          29








                          29







                          Michael Aaron Safyan's answer doesn't account for sparse files. -S option fixes that.



                          Also this variant doesn't spam with the each file progressing and doesn't do delta syncing which kills performance in non-network cases.



                          Perfect for copying filesystem from one local drive to another local drive.



                          rsync -axHAWXS --numeric-ids --info=progress2





                          share|improve this answer













                          Michael Aaron Safyan's answer doesn't account for sparse files. -S option fixes that.



                          Also this variant doesn't spam with the each file progressing and doesn't do delta syncing which kills performance in non-network cases.



                          Perfect for copying filesystem from one local drive to another local drive.



                          rsync -axHAWXS --numeric-ids --info=progress2






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Mar 5 '17 at 10:42









                          Ilia SidorenkoIlia Sidorenko

                          39135




                          39135








                          • 1





                            Amazing. This is really doing a good job

                            – Gildas
                            Jul 26 '18 at 8:13






                          • 1





                            This should be the accepted answer, works great. Example 55,431,669,792 57% 97.47MB/s 0:06:56 xfr#2888, ir-chk=5593/8534)

                            – Drew
                            Aug 4 '18 at 3:11








                          • 1





                            <3 this is perfect

                            – Tim Strijdhorst
                            Jan 21 at 15:10














                          • 1





                            Amazing. This is really doing a good job

                            – Gildas
                            Jul 26 '18 at 8:13






                          • 1





                            This should be the accepted answer, works great. Example 55,431,669,792 57% 97.47MB/s 0:06:56 xfr#2888, ir-chk=5593/8534)

                            – Drew
                            Aug 4 '18 at 3:11








                          • 1





                            <3 this is perfect

                            – Tim Strijdhorst
                            Jan 21 at 15:10








                          1




                          1





                          Amazing. This is really doing a good job

                          – Gildas
                          Jul 26 '18 at 8:13





                          Amazing. This is really doing a good job

                          – Gildas
                          Jul 26 '18 at 8:13




                          1




                          1





                          This should be the accepted answer, works great. Example 55,431,669,792 57% 97.47MB/s 0:06:56 xfr#2888, ir-chk=5593/8534)

                          – Drew
                          Aug 4 '18 at 3:11







                          This should be the accepted answer, works great. Example 55,431,669,792 57% 97.47MB/s 0:06:56 xfr#2888, ir-chk=5593/8534)

                          – Drew
                          Aug 4 '18 at 3:11






                          1




                          1





                          <3 this is perfect

                          – Tim Strijdhorst
                          Jan 21 at 15:10





                          <3 this is perfect

                          – Tim Strijdhorst
                          Jan 21 at 15:10











                          6














                          For a one shot local copy from one drive to another, I guess cp suffices as described by Wolfmann here above.



                          For bigger works like local or remote backups for instance, the best is rsync.



                          Of course, rsync is significantly more complex to use.



                          Why rsync :




                          • this allows you to copy (synchronized
                            copy) all or part of your drive A to
                            drive B, with many options, like
                            excluding some directories from the
                            copy (for instance excluding /proc).


                          • Another big advantage is that this
                            native tool monitors the file
                            transfer: eg for massive transfers,
                            if the connection is interrupted, it
                            will continue from the breakpoint.


                          • And last but not least, rsync uses
                            ssh connection, so this allow you to
                            achive remote synchronized secured
                            "copies". Have a look to the man
                            page
                            as well as here for some
                            examples.







                          share|improve this answer




























                            6














                            For a one shot local copy from one drive to another, I guess cp suffices as described by Wolfmann here above.



                            For bigger works like local or remote backups for instance, the best is rsync.



                            Of course, rsync is significantly more complex to use.



                            Why rsync :




                            • this allows you to copy (synchronized
                              copy) all or part of your drive A to
                              drive B, with many options, like
                              excluding some directories from the
                              copy (for instance excluding /proc).


                            • Another big advantage is that this
                              native tool monitors the file
                              transfer: eg for massive transfers,
                              if the connection is interrupted, it
                              will continue from the breakpoint.


                            • And last but not least, rsync uses
                              ssh connection, so this allow you to
                              achive remote synchronized secured
                              "copies". Have a look to the man
                              page
                              as well as here for some
                              examples.







                            share|improve this answer


























                              6












                              6








                              6







                              For a one shot local copy from one drive to another, I guess cp suffices as described by Wolfmann here above.



                              For bigger works like local or remote backups for instance, the best is rsync.



                              Of course, rsync is significantly more complex to use.



                              Why rsync :




                              • this allows you to copy (synchronized
                                copy) all or part of your drive A to
                                drive B, with many options, like
                                excluding some directories from the
                                copy (for instance excluding /proc).


                              • Another big advantage is that this
                                native tool monitors the file
                                transfer: eg for massive transfers,
                                if the connection is interrupted, it
                                will continue from the breakpoint.


                              • And last but not least, rsync uses
                                ssh connection, so this allow you to
                                achive remote synchronized secured
                                "copies". Have a look to the man
                                page
                                as well as here for some
                                examples.







                              share|improve this answer













                              For a one shot local copy from one drive to another, I guess cp suffices as described by Wolfmann here above.



                              For bigger works like local or remote backups for instance, the best is rsync.



                              Of course, rsync is significantly more complex to use.



                              Why rsync :




                              • this allows you to copy (synchronized
                                copy) all or part of your drive A to
                                drive B, with many options, like
                                excluding some directories from the
                                copy (for instance excluding /proc).


                              • Another big advantage is that this
                                native tool monitors the file
                                transfer: eg for massive transfers,
                                if the connection is interrupted, it
                                will continue from the breakpoint.


                              • And last but not least, rsync uses
                                ssh connection, so this allow you to
                                achive remote synchronized secured
                                "copies". Have a look to the man
                                page
                                as well as here for some
                                examples.








                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Jul 7 '11 at 20:53









                              hornetbzzhornetbzz

                              191212




                              191212























                                  3














                                  Like Michael Safyan suggests above, I've used rsync for this purpose. I suggest using some additional options to exclude directories that you probably don't want to copy.



                                  This version is fairly specific to Gnome- and Debian/Ubuntu-based systems, since it includes subdirectories of users' home directories which are specific to Gnome, as well as the APT package cache.



                                  The last line will exclude any directory named cache/Cache/.cache, which may be too aggressive for some uses:



                                  rsync -WavxHAX --delete-excluded --progress 
                                  /mnt/from/ /mnt/to/
                                  --exclude='/home/*/.gvfs'
                                  --exclude='/home/*/.local/share/Trash'
                                  --exclude='/var/run/*'
                                  --exclude='/var/lock/*'
                                  --exclude='/lib/modules/*/volatile/.mounted'
                                  --exclude='/var/cache/apt/archives/*'
                                  --exclude='/home/*/.mozilla/firefox/*/Cache'
                                  --exclude='/home/*/.cache/chromium'
                                  --exclude='home/*/.thumbnails'
                                  --exclude=.cache --exclude Cache --exclude cache





                                  share|improve this answer




























                                    3














                                    Like Michael Safyan suggests above, I've used rsync for this purpose. I suggest using some additional options to exclude directories that you probably don't want to copy.



                                    This version is fairly specific to Gnome- and Debian/Ubuntu-based systems, since it includes subdirectories of users' home directories which are specific to Gnome, as well as the APT package cache.



                                    The last line will exclude any directory named cache/Cache/.cache, which may be too aggressive for some uses:



                                    rsync -WavxHAX --delete-excluded --progress 
                                    /mnt/from/ /mnt/to/
                                    --exclude='/home/*/.gvfs'
                                    --exclude='/home/*/.local/share/Trash'
                                    --exclude='/var/run/*'
                                    --exclude='/var/lock/*'
                                    --exclude='/lib/modules/*/volatile/.mounted'
                                    --exclude='/var/cache/apt/archives/*'
                                    --exclude='/home/*/.mozilla/firefox/*/Cache'
                                    --exclude='/home/*/.cache/chromium'
                                    --exclude='home/*/.thumbnails'
                                    --exclude=.cache --exclude Cache --exclude cache





                                    share|improve this answer


























                                      3












                                      3








                                      3







                                      Like Michael Safyan suggests above, I've used rsync for this purpose. I suggest using some additional options to exclude directories that you probably don't want to copy.



                                      This version is fairly specific to Gnome- and Debian/Ubuntu-based systems, since it includes subdirectories of users' home directories which are specific to Gnome, as well as the APT package cache.



                                      The last line will exclude any directory named cache/Cache/.cache, which may be too aggressive for some uses:



                                      rsync -WavxHAX --delete-excluded --progress 
                                      /mnt/from/ /mnt/to/
                                      --exclude='/home/*/.gvfs'
                                      --exclude='/home/*/.local/share/Trash'
                                      --exclude='/var/run/*'
                                      --exclude='/var/lock/*'
                                      --exclude='/lib/modules/*/volatile/.mounted'
                                      --exclude='/var/cache/apt/archives/*'
                                      --exclude='/home/*/.mozilla/firefox/*/Cache'
                                      --exclude='/home/*/.cache/chromium'
                                      --exclude='home/*/.thumbnails'
                                      --exclude=.cache --exclude Cache --exclude cache





                                      share|improve this answer













                                      Like Michael Safyan suggests above, I've used rsync for this purpose. I suggest using some additional options to exclude directories that you probably don't want to copy.



                                      This version is fairly specific to Gnome- and Debian/Ubuntu-based systems, since it includes subdirectories of users' home directories which are specific to Gnome, as well as the APT package cache.



                                      The last line will exclude any directory named cache/Cache/.cache, which may be too aggressive for some uses:



                                      rsync -WavxHAX --delete-excluded --progress 
                                      /mnt/from/ /mnt/to/
                                      --exclude='/home/*/.gvfs'
                                      --exclude='/home/*/.local/share/Trash'
                                      --exclude='/var/run/*'
                                      --exclude='/var/lock/*'
                                      --exclude='/lib/modules/*/volatile/.mounted'
                                      --exclude='/var/cache/apt/archives/*'
                                      --exclude='/home/*/.mozilla/firefox/*/Cache'
                                      --exclude='/home/*/.cache/chromium'
                                      --exclude='home/*/.thumbnails'
                                      --exclude=.cache --exclude Cache --exclude cache






                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Feb 6 '14 at 6:11









                                      DanDan

                                      1956




                                      1956























                                          2














                                          Adding two useful bits to the thread re rsync: changing cypher, and using --update:



                                          As per Wolfman's post, cp -ax is elegant, and cool for local stuff.



                                          However, rsync is awesome also. Further to Michael's answer re -W, changing the cypher can also speed things up (read up on any security implications though).



                                          rsync --progress --rsh="ssh -c blowfish" / /mnt/dest -auvx


                                          There is some discussion (and benchmarks) around the place about a slow CPU being the actual bottleneck, but it does seem to help me when machine is loaded up doing other concurrent things.



                                          One of the other big reasons for using rsync in a large, recursive copy like this is because of the -u switch (or --update). If there is a problem during the copy, you can fix it up, and rsync will pick up where it left off (I don't think scp has this). Doing it locally, cp also has a -u switch.



                                          (I'm not certain what the implications of --update and --whole-file together are, but they always seem to work sensibly for me in this type of task)



                                          I realise this isn't a thread about rsync's features, but some of the most common I use for this are:





                                          • --delete-after etc (as Michael mentioned in follow-up), if you want to sync the new system back to the original place or something like that. And,


                                          • --exclude - for skipping directories/files, for instances like copying/creating a new system to a new place whilst skipping user home directories etc (either you are mounting homes from somewhere else, or creating new users etc).


                                          Incidentally, if I ever have to use windows, I use rsync from cygwin to do large recursive copies, because of explorer's slightly brain-dead wanting to start from the beginning (although I find Finder is OS X even worse)






                                          share|improve this answer






























                                            2














                                            Adding two useful bits to the thread re rsync: changing cypher, and using --update:



                                            As per Wolfman's post, cp -ax is elegant, and cool for local stuff.



                                            However, rsync is awesome also. Further to Michael's answer re -W, changing the cypher can also speed things up (read up on any security implications though).



                                            rsync --progress --rsh="ssh -c blowfish" / /mnt/dest -auvx


                                            There is some discussion (and benchmarks) around the place about a slow CPU being the actual bottleneck, but it does seem to help me when machine is loaded up doing other concurrent things.



                                            One of the other big reasons for using rsync in a large, recursive copy like this is because of the -u switch (or --update). If there is a problem during the copy, you can fix it up, and rsync will pick up where it left off (I don't think scp has this). Doing it locally, cp also has a -u switch.



                                            (I'm not certain what the implications of --update and --whole-file together are, but they always seem to work sensibly for me in this type of task)



                                            I realise this isn't a thread about rsync's features, but some of the most common I use for this are:





                                            • --delete-after etc (as Michael mentioned in follow-up), if you want to sync the new system back to the original place or something like that. And,


                                            • --exclude - for skipping directories/files, for instances like copying/creating a new system to a new place whilst skipping user home directories etc (either you are mounting homes from somewhere else, or creating new users etc).


                                            Incidentally, if I ever have to use windows, I use rsync from cygwin to do large recursive copies, because of explorer's slightly brain-dead wanting to start from the beginning (although I find Finder is OS X even worse)






                                            share|improve this answer




























                                              2












                                              2








                                              2







                                              Adding two useful bits to the thread re rsync: changing cypher, and using --update:



                                              As per Wolfman's post, cp -ax is elegant, and cool for local stuff.



                                              However, rsync is awesome also. Further to Michael's answer re -W, changing the cypher can also speed things up (read up on any security implications though).



                                              rsync --progress --rsh="ssh -c blowfish" / /mnt/dest -auvx


                                              There is some discussion (and benchmarks) around the place about a slow CPU being the actual bottleneck, but it does seem to help me when machine is loaded up doing other concurrent things.



                                              One of the other big reasons for using rsync in a large, recursive copy like this is because of the -u switch (or --update). If there is a problem during the copy, you can fix it up, and rsync will pick up where it left off (I don't think scp has this). Doing it locally, cp also has a -u switch.



                                              (I'm not certain what the implications of --update and --whole-file together are, but they always seem to work sensibly for me in this type of task)



                                              I realise this isn't a thread about rsync's features, but some of the most common I use for this are:





                                              • --delete-after etc (as Michael mentioned in follow-up), if you want to sync the new system back to the original place or something like that. And,


                                              • --exclude - for skipping directories/files, for instances like copying/creating a new system to a new place whilst skipping user home directories etc (either you are mounting homes from somewhere else, or creating new users etc).


                                              Incidentally, if I ever have to use windows, I use rsync from cygwin to do large recursive copies, because of explorer's slightly brain-dead wanting to start from the beginning (although I find Finder is OS X even worse)






                                              share|improve this answer















                                              Adding two useful bits to the thread re rsync: changing cypher, and using --update:



                                              As per Wolfman's post, cp -ax is elegant, and cool for local stuff.



                                              However, rsync is awesome also. Further to Michael's answer re -W, changing the cypher can also speed things up (read up on any security implications though).



                                              rsync --progress --rsh="ssh -c blowfish" / /mnt/dest -auvx


                                              There is some discussion (and benchmarks) around the place about a slow CPU being the actual bottleneck, but it does seem to help me when machine is loaded up doing other concurrent things.



                                              One of the other big reasons for using rsync in a large, recursive copy like this is because of the -u switch (or --update). If there is a problem during the copy, you can fix it up, and rsync will pick up where it left off (I don't think scp has this). Doing it locally, cp also has a -u switch.



                                              (I'm not certain what the implications of --update and --whole-file together are, but they always seem to work sensibly for me in this type of task)



                                              I realise this isn't a thread about rsync's features, but some of the most common I use for this are:





                                              • --delete-after etc (as Michael mentioned in follow-up), if you want to sync the new system back to the original place or something like that. And,


                                              • --exclude - for skipping directories/files, for instances like copying/creating a new system to a new place whilst skipping user home directories etc (either you are mounting homes from somewhere else, or creating new users etc).


                                              Incidentally, if I ever have to use windows, I use rsync from cygwin to do large recursive copies, because of explorer's slightly brain-dead wanting to start from the beginning (although I find Finder is OS X even worse)







                                              share|improve this answer














                                              share|improve this answer



                                              share|improve this answer








                                              edited Dec 2 '12 at 18:13









                                              cdeszaq

                                              1085




                                              1085










                                              answered Mar 19 '12 at 23:53









                                              herdingofthecatsherdingofthecats

                                              33326




                                              33326























                                                  2














                                                  rsync




                                                  "This approach is considered to be better than disk cloning with dd
                                                  since it allows for a different size, partition table and filesystem
                                                  to be used, and better than copying with cp -a as well, because it
                                                  allows greater control over file permissions, attributes, Access
                                                  Control Lists (ACLs) and extended attributes."




                                                  From:



                                                  https://wiki.archlinux.org/index.php/Full_system_backup_with_rsync



                                                  Man Page Here






                                                  share|improve this answer






























                                                    2














                                                    rsync




                                                    "This approach is considered to be better than disk cloning with dd
                                                    since it allows for a different size, partition table and filesystem
                                                    to be used, and better than copying with cp -a as well, because it
                                                    allows greater control over file permissions, attributes, Access
                                                    Control Lists (ACLs) and extended attributes."




                                                    From:



                                                    https://wiki.archlinux.org/index.php/Full_system_backup_with_rsync



                                                    Man Page Here






                                                    share|improve this answer




























                                                      2












                                                      2








                                                      2







                                                      rsync




                                                      "This approach is considered to be better than disk cloning with dd
                                                      since it allows for a different size, partition table and filesystem
                                                      to be used, and better than copying with cp -a as well, because it
                                                      allows greater control over file permissions, attributes, Access
                                                      Control Lists (ACLs) and extended attributes."




                                                      From:



                                                      https://wiki.archlinux.org/index.php/Full_system_backup_with_rsync



                                                      Man Page Here






                                                      share|improve this answer















                                                      rsync




                                                      "This approach is considered to be better than disk cloning with dd
                                                      since it allows for a different size, partition table and filesystem
                                                      to be used, and better than copying with cp -a as well, because it
                                                      allows greater control over file permissions, attributes, Access
                                                      Control Lists (ACLs) and extended attributes."




                                                      From:



                                                      https://wiki.archlinux.org/index.php/Full_system_backup_with_rsync



                                                      Man Page Here







                                                      share|improve this answer














                                                      share|improve this answer



                                                      share|improve this answer








                                                      edited May 18 '15 at 17:48









                                                      Francisco Tapia

                                                      2,23331340




                                                      2,23331340










                                                      answered May 18 '15 at 15:45









                                                      Mauro ColellaMauro Colella

                                                      1213




                                                      1213























                                                          1














                                                          As mentioned in the comments by juniorRubyist, the preferred approach here should be to use dd. The main reason is performance, it's a block-by-block copy instead of file-by-file.



                                                          Cloning a partition



                                                          # dd if=/dev/sda1 of=/dev/sdb1 bs=64K conv=noerror,sync status=progress


                                                          Cloning an entire disk



                                                          # dd if=/dev/sdX of=/dev/sdY bs=64K conv=noerror,sync status=progress


                                                          References




                                                          1. https://wiki.archlinux.org/index.php/disk_cloning






                                                          share|improve this answer






























                                                            1














                                                            As mentioned in the comments by juniorRubyist, the preferred approach here should be to use dd. The main reason is performance, it's a block-by-block copy instead of file-by-file.



                                                            Cloning a partition



                                                            # dd if=/dev/sda1 of=/dev/sdb1 bs=64K conv=noerror,sync status=progress


                                                            Cloning an entire disk



                                                            # dd if=/dev/sdX of=/dev/sdY bs=64K conv=noerror,sync status=progress


                                                            References




                                                            1. https://wiki.archlinux.org/index.php/disk_cloning






                                                            share|improve this answer




























                                                              1












                                                              1








                                                              1







                                                              As mentioned in the comments by juniorRubyist, the preferred approach here should be to use dd. The main reason is performance, it's a block-by-block copy instead of file-by-file.



                                                              Cloning a partition



                                                              # dd if=/dev/sda1 of=/dev/sdb1 bs=64K conv=noerror,sync status=progress


                                                              Cloning an entire disk



                                                              # dd if=/dev/sdX of=/dev/sdY bs=64K conv=noerror,sync status=progress


                                                              References




                                                              1. https://wiki.archlinux.org/index.php/disk_cloning






                                                              share|improve this answer















                                                              As mentioned in the comments by juniorRubyist, the preferred approach here should be to use dd. The main reason is performance, it's a block-by-block copy instead of file-by-file.



                                                              Cloning a partition



                                                              # dd if=/dev/sda1 of=/dev/sdb1 bs=64K conv=noerror,sync status=progress


                                                              Cloning an entire disk



                                                              # dd if=/dev/sdX of=/dev/sdY bs=64K conv=noerror,sync status=progress


                                                              References




                                                              1. https://wiki.archlinux.org/index.php/disk_cloning







                                                              share|improve this answer














                                                              share|improve this answer



                                                              share|improve this answer








                                                              edited Jun 14 '18 at 18:03

























                                                              answered Jun 14 '18 at 17:30









                                                              Rikard SöderströmRikard Söderström

                                                              1515




                                                              1515























                                                                  1














                                                                  'dd' is awesome, but ddrescue (apt install gddrescue) is even better. If dd gets interrupted, there is no way to restart (another good reason to use rsync). When you use ddrescue with a logfile, it keeps track of which blocks have been copied.



                                                                  When backing up a dual boot Windows/Linux system, I use ntfsclone for the Windows partitions and ddrescue for the Linux partition and dd for the MBR. (I haven't tried to back up a dual boot system using GPT/UEFI.)



                                                                  What I'd love to see is a ddrescue tool that can create files like ntfsclone where unallocated space is marked with control characters. This makes the image not directly mountable, but allows it to be only as big as the contained data.



                                                                  Someone please come up with the ntfsclone "special image format" for ddrescue...






                                                                  share|improve this answer




























                                                                    1














                                                                    'dd' is awesome, but ddrescue (apt install gddrescue) is even better. If dd gets interrupted, there is no way to restart (another good reason to use rsync). When you use ddrescue with a logfile, it keeps track of which blocks have been copied.



                                                                    When backing up a dual boot Windows/Linux system, I use ntfsclone for the Windows partitions and ddrescue for the Linux partition and dd for the MBR. (I haven't tried to back up a dual boot system using GPT/UEFI.)



                                                                    What I'd love to see is a ddrescue tool that can create files like ntfsclone where unallocated space is marked with control characters. This makes the image not directly mountable, but allows it to be only as big as the contained data.



                                                                    Someone please come up with the ntfsclone "special image format" for ddrescue...






                                                                    share|improve this answer


























                                                                      1












                                                                      1








                                                                      1







                                                                      'dd' is awesome, but ddrescue (apt install gddrescue) is even better. If dd gets interrupted, there is no way to restart (another good reason to use rsync). When you use ddrescue with a logfile, it keeps track of which blocks have been copied.



                                                                      When backing up a dual boot Windows/Linux system, I use ntfsclone for the Windows partitions and ddrescue for the Linux partition and dd for the MBR. (I haven't tried to back up a dual boot system using GPT/UEFI.)



                                                                      What I'd love to see is a ddrescue tool that can create files like ntfsclone where unallocated space is marked with control characters. This makes the image not directly mountable, but allows it to be only as big as the contained data.



                                                                      Someone please come up with the ntfsclone "special image format" for ddrescue...






                                                                      share|improve this answer













                                                                      'dd' is awesome, but ddrescue (apt install gddrescue) is even better. If dd gets interrupted, there is no way to restart (another good reason to use rsync). When you use ddrescue with a logfile, it keeps track of which blocks have been copied.



                                                                      When backing up a dual boot Windows/Linux system, I use ntfsclone for the Windows partitions and ddrescue for the Linux partition and dd for the MBR. (I haven't tried to back up a dual boot system using GPT/UEFI.)



                                                                      What I'd love to see is a ddrescue tool that can create files like ntfsclone where unallocated space is marked with control characters. This makes the image not directly mountable, but allows it to be only as big as the contained data.



                                                                      Someone please come up with the ntfsclone "special image format" for ddrescue...







                                                                      share|improve this answer












                                                                      share|improve this answer



                                                                      share|improve this answer










                                                                      answered Jan 27 at 21:53









                                                                      ECJBECJB

                                                                      112




                                                                      112























                                                                          0














                                                                          rsync is the perfect solution as explained above.



                                                                          I'd just add -S to "handle sparse files efficiently" in case there is a docker devicemapper volume or similar to be copied.






                                                                          share|improve this answer






























                                                                            0














                                                                            rsync is the perfect solution as explained above.



                                                                            I'd just add -S to "handle sparse files efficiently" in case there is a docker devicemapper volume or similar to be copied.






                                                                            share|improve this answer




























                                                                              0












                                                                              0








                                                                              0







                                                                              rsync is the perfect solution as explained above.



                                                                              I'd just add -S to "handle sparse files efficiently" in case there is a docker devicemapper volume or similar to be copied.






                                                                              share|improve this answer















                                                                              rsync is the perfect solution as explained above.



                                                                              I'd just add -S to "handle sparse files efficiently" in case there is a docker devicemapper volume or similar to be copied.







                                                                              share|improve this answer














                                                                              share|improve this answer



                                                                              share|improve this answer








                                                                              edited Aug 7 '15 at 22:59









                                                                              Francisco Tapia

                                                                              2,23331340




                                                                              2,23331340










                                                                              answered Aug 7 '15 at 18:04









                                                                              Jürgen WeigertJürgen Weigert

                                                                              1012




                                                                              1012















                                                                                  Popular posts from this blog

                                                                                  Plaza Victoria

                                                                                  Puebla de Zaragoza

                                                                                  Musa