How can I clone/backup/restore Windows 10 from Linux?












1















Case scenario:



$ sudo fdisk -l
Disk /dev/sda: 223,6 GiB, 240057409536 bytes, 468862128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x13a30a5a

Device Boot Start Final Sectors Size Id Type
/dev/sda1 * 2048 1333247 1331200 650M 27 WinRE NTFS hidden
/dev/sda2 1333248 264058879 262725632 125,3G 7 HPFS/NTFS/exFAT
/dev/sda3 264060926 468860927 204800002 97,7G 5 Extended
/dev/sda5 264060928 434049023 169988096 81,1G 7 HPFS/NTFS/exFAT
/dev/sda6 434051072 464771775 30720704 14,7G 83 Linux
/dev/sda7 464773120 468860927 4087808 2G 82 Linux swap / Solaris


Windows 10 is installed on /dev/sda2 and I assume that /dev/sda1 is a hidden partition from the same Windows system.



How can I backup my Windows 10 installation from Linux in order to restore it later?



Further data upon request:




  • By "Installation" I mean the "full partition" (or partitions) required to return Windows to the moment the cloning was made.

  • Being able to restore to the same system (computer, hardware) and even hard drive would enough. I.e: I installed Windows 10, made backup, and a few months ago I want to restore the backup I made, so there is no need to perform the full installation of Windows 10 (drivers, printers, programs...etc) again.


Tested until now (all tests performed on the same computer with the same partition layout):





  • PartImage (cloning sda1 and sda2): not working. The restored operating system will not boot.


  • FSArchiver (cloning sda1 and sda2): not working. The restored operating system will not boot.










share|improve this question

























  • What on Earth is the downvote for???

    – ajeh
    May 15 '18 at 21:13











  • If by 'installation' you meant the entire partition, then dd is the most reliable way. If however you meant files on the partition, then tar can do that just fine. This is worth clarifying in your question. How are you testing the restore - onto the same drive, or a different drive with a different partition layout?

    – ajeh
    May 15 '18 at 21:14













  • Added the data you requested, @ajeh . I just want the classic full wiping (of the Windows partition) & restoring used by Norton Ghost, PartImage or FSArchiver. If dd can do it, it could be OK for me, but please remember there are more partitions on the drive.

    – Sopalajo de Arrierez
    May 15 '18 at 21:52











  • Okay, dd can certainly do that and I use it all the time to image drives, including Windows. All you need to do is grab images of all involved partitions and store them so that you would know to which device to restore, i.e. name them after sda1.img, sda2.img etc. And as there will be tons of free space in most cases, pipe dd output through pbzip2 or p7zip to create sda1.img.bz etc. to save space.

    – ajeh
    May 15 '18 at 22:01








  • 1





    I used dd with up to Windows 8.1 images, as well as QNX, Apple Mac, Solaris, FreeBSD and OS/2. I do not have a Windows 10 distro to try, as I consider this a giant malware to stay away from.

    – ajeh
    May 15 '18 at 22:08
















1















Case scenario:



$ sudo fdisk -l
Disk /dev/sda: 223,6 GiB, 240057409536 bytes, 468862128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x13a30a5a

Device Boot Start Final Sectors Size Id Type
/dev/sda1 * 2048 1333247 1331200 650M 27 WinRE NTFS hidden
/dev/sda2 1333248 264058879 262725632 125,3G 7 HPFS/NTFS/exFAT
/dev/sda3 264060926 468860927 204800002 97,7G 5 Extended
/dev/sda5 264060928 434049023 169988096 81,1G 7 HPFS/NTFS/exFAT
/dev/sda6 434051072 464771775 30720704 14,7G 83 Linux
/dev/sda7 464773120 468860927 4087808 2G 82 Linux swap / Solaris


Windows 10 is installed on /dev/sda2 and I assume that /dev/sda1 is a hidden partition from the same Windows system.



How can I backup my Windows 10 installation from Linux in order to restore it later?



Further data upon request:




  • By "Installation" I mean the "full partition" (or partitions) required to return Windows to the moment the cloning was made.

  • Being able to restore to the same system (computer, hardware) and even hard drive would enough. I.e: I installed Windows 10, made backup, and a few months ago I want to restore the backup I made, so there is no need to perform the full installation of Windows 10 (drivers, printers, programs...etc) again.


Tested until now (all tests performed on the same computer with the same partition layout):





  • PartImage (cloning sda1 and sda2): not working. The restored operating system will not boot.


  • FSArchiver (cloning sda1 and sda2): not working. The restored operating system will not boot.










share|improve this question

























  • What on Earth is the downvote for???

    – ajeh
    May 15 '18 at 21:13











  • If by 'installation' you meant the entire partition, then dd is the most reliable way. If however you meant files on the partition, then tar can do that just fine. This is worth clarifying in your question. How are you testing the restore - onto the same drive, or a different drive with a different partition layout?

    – ajeh
    May 15 '18 at 21:14













  • Added the data you requested, @ajeh . I just want the classic full wiping (of the Windows partition) & restoring used by Norton Ghost, PartImage or FSArchiver. If dd can do it, it could be OK for me, but please remember there are more partitions on the drive.

    – Sopalajo de Arrierez
    May 15 '18 at 21:52











  • Okay, dd can certainly do that and I use it all the time to image drives, including Windows. All you need to do is grab images of all involved partitions and store them so that you would know to which device to restore, i.e. name them after sda1.img, sda2.img etc. And as there will be tons of free space in most cases, pipe dd output through pbzip2 or p7zip to create sda1.img.bz etc. to save space.

    – ajeh
    May 15 '18 at 22:01








  • 1





    I used dd with up to Windows 8.1 images, as well as QNX, Apple Mac, Solaris, FreeBSD and OS/2. I do not have a Windows 10 distro to try, as I consider this a giant malware to stay away from.

    – ajeh
    May 15 '18 at 22:08














1












1








1


1






Case scenario:



$ sudo fdisk -l
Disk /dev/sda: 223,6 GiB, 240057409536 bytes, 468862128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x13a30a5a

Device Boot Start Final Sectors Size Id Type
/dev/sda1 * 2048 1333247 1331200 650M 27 WinRE NTFS hidden
/dev/sda2 1333248 264058879 262725632 125,3G 7 HPFS/NTFS/exFAT
/dev/sda3 264060926 468860927 204800002 97,7G 5 Extended
/dev/sda5 264060928 434049023 169988096 81,1G 7 HPFS/NTFS/exFAT
/dev/sda6 434051072 464771775 30720704 14,7G 83 Linux
/dev/sda7 464773120 468860927 4087808 2G 82 Linux swap / Solaris


Windows 10 is installed on /dev/sda2 and I assume that /dev/sda1 is a hidden partition from the same Windows system.



How can I backup my Windows 10 installation from Linux in order to restore it later?



Further data upon request:




  • By "Installation" I mean the "full partition" (or partitions) required to return Windows to the moment the cloning was made.

  • Being able to restore to the same system (computer, hardware) and even hard drive would enough. I.e: I installed Windows 10, made backup, and a few months ago I want to restore the backup I made, so there is no need to perform the full installation of Windows 10 (drivers, printers, programs...etc) again.


Tested until now (all tests performed on the same computer with the same partition layout):





  • PartImage (cloning sda1 and sda2): not working. The restored operating system will not boot.


  • FSArchiver (cloning sda1 and sda2): not working. The restored operating system will not boot.










share|improve this question
















Case scenario:



$ sudo fdisk -l
Disk /dev/sda: 223,6 GiB, 240057409536 bytes, 468862128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x13a30a5a

Device Boot Start Final Sectors Size Id Type
/dev/sda1 * 2048 1333247 1331200 650M 27 WinRE NTFS hidden
/dev/sda2 1333248 264058879 262725632 125,3G 7 HPFS/NTFS/exFAT
/dev/sda3 264060926 468860927 204800002 97,7G 5 Extended
/dev/sda5 264060928 434049023 169988096 81,1G 7 HPFS/NTFS/exFAT
/dev/sda6 434051072 464771775 30720704 14,7G 83 Linux
/dev/sda7 464773120 468860927 4087808 2G 82 Linux swap / Solaris


Windows 10 is installed on /dev/sda2 and I assume that /dev/sda1 is a hidden partition from the same Windows system.



How can I backup my Windows 10 installation from Linux in order to restore it later?



Further data upon request:




  • By "Installation" I mean the "full partition" (or partitions) required to return Windows to the moment the cloning was made.

  • Being able to restore to the same system (computer, hardware) and even hard drive would enough. I.e: I installed Windows 10, made backup, and a few months ago I want to restore the backup I made, so there is no need to perform the full installation of Windows 10 (drivers, printers, programs...etc) again.


Tested until now (all tests performed on the same computer with the same partition layout):





  • PartImage (cloning sda1 and sda2): not working. The restored operating system will not boot.


  • FSArchiver (cloning sda1 and sda2): not working. The restored operating system will not boot.







windows cloning






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 15 '18 at 21:46







Sopalajo de Arrierez

















asked May 15 '18 at 20:42









Sopalajo de ArrierezSopalajo de Arrierez

1,73993562




1,73993562













  • What on Earth is the downvote for???

    – ajeh
    May 15 '18 at 21:13











  • If by 'installation' you meant the entire partition, then dd is the most reliable way. If however you meant files on the partition, then tar can do that just fine. This is worth clarifying in your question. How are you testing the restore - onto the same drive, or a different drive with a different partition layout?

    – ajeh
    May 15 '18 at 21:14













  • Added the data you requested, @ajeh . I just want the classic full wiping (of the Windows partition) & restoring used by Norton Ghost, PartImage or FSArchiver. If dd can do it, it could be OK for me, but please remember there are more partitions on the drive.

    – Sopalajo de Arrierez
    May 15 '18 at 21:52











  • Okay, dd can certainly do that and I use it all the time to image drives, including Windows. All you need to do is grab images of all involved partitions and store them so that you would know to which device to restore, i.e. name them after sda1.img, sda2.img etc. And as there will be tons of free space in most cases, pipe dd output through pbzip2 or p7zip to create sda1.img.bz etc. to save space.

    – ajeh
    May 15 '18 at 22:01








  • 1





    I used dd with up to Windows 8.1 images, as well as QNX, Apple Mac, Solaris, FreeBSD and OS/2. I do not have a Windows 10 distro to try, as I consider this a giant malware to stay away from.

    – ajeh
    May 15 '18 at 22:08



















  • What on Earth is the downvote for???

    – ajeh
    May 15 '18 at 21:13











  • If by 'installation' you meant the entire partition, then dd is the most reliable way. If however you meant files on the partition, then tar can do that just fine. This is worth clarifying in your question. How are you testing the restore - onto the same drive, or a different drive with a different partition layout?

    – ajeh
    May 15 '18 at 21:14













  • Added the data you requested, @ajeh . I just want the classic full wiping (of the Windows partition) & restoring used by Norton Ghost, PartImage or FSArchiver. If dd can do it, it could be OK for me, but please remember there are more partitions on the drive.

    – Sopalajo de Arrierez
    May 15 '18 at 21:52











  • Okay, dd can certainly do that and I use it all the time to image drives, including Windows. All you need to do is grab images of all involved partitions and store them so that you would know to which device to restore, i.e. name them after sda1.img, sda2.img etc. And as there will be tons of free space in most cases, pipe dd output through pbzip2 or p7zip to create sda1.img.bz etc. to save space.

    – ajeh
    May 15 '18 at 22:01








  • 1





    I used dd with up to Windows 8.1 images, as well as QNX, Apple Mac, Solaris, FreeBSD and OS/2. I do not have a Windows 10 distro to try, as I consider this a giant malware to stay away from.

    – ajeh
    May 15 '18 at 22:08

















What on Earth is the downvote for???

– ajeh
May 15 '18 at 21:13





What on Earth is the downvote for???

– ajeh
May 15 '18 at 21:13













If by 'installation' you meant the entire partition, then dd is the most reliable way. If however you meant files on the partition, then tar can do that just fine. This is worth clarifying in your question. How are you testing the restore - onto the same drive, or a different drive with a different partition layout?

– ajeh
May 15 '18 at 21:14







If by 'installation' you meant the entire partition, then dd is the most reliable way. If however you meant files on the partition, then tar can do that just fine. This is worth clarifying in your question. How are you testing the restore - onto the same drive, or a different drive with a different partition layout?

– ajeh
May 15 '18 at 21:14















Added the data you requested, @ajeh . I just want the classic full wiping (of the Windows partition) & restoring used by Norton Ghost, PartImage or FSArchiver. If dd can do it, it could be OK for me, but please remember there are more partitions on the drive.

– Sopalajo de Arrierez
May 15 '18 at 21:52





Added the data you requested, @ajeh . I just want the classic full wiping (of the Windows partition) & restoring used by Norton Ghost, PartImage or FSArchiver. If dd can do it, it could be OK for me, but please remember there are more partitions on the drive.

– Sopalajo de Arrierez
May 15 '18 at 21:52













Okay, dd can certainly do that and I use it all the time to image drives, including Windows. All you need to do is grab images of all involved partitions and store them so that you would know to which device to restore, i.e. name them after sda1.img, sda2.img etc. And as there will be tons of free space in most cases, pipe dd output through pbzip2 or p7zip to create sda1.img.bz etc. to save space.

– ajeh
May 15 '18 at 22:01







Okay, dd can certainly do that and I use it all the time to image drives, including Windows. All you need to do is grab images of all involved partitions and store them so that you would know to which device to restore, i.e. name them after sda1.img, sda2.img etc. And as there will be tons of free space in most cases, pipe dd output through pbzip2 or p7zip to create sda1.img.bz etc. to save space.

– ajeh
May 15 '18 at 22:01






1




1





I used dd with up to Windows 8.1 images, as well as QNX, Apple Mac, Solaris, FreeBSD and OS/2. I do not have a Windows 10 distro to try, as I consider this a giant malware to stay away from.

– ajeh
May 15 '18 at 22:08





I used dd with up to Windows 8.1 images, as well as QNX, Apple Mac, Solaris, FreeBSD and OS/2. I do not have a Windows 10 distro to try, as I consider this a giant malware to stay away from.

– ajeh
May 15 '18 at 22:08










4 Answers
4






active

oldest

votes


















2















pv method



You could use pv (man page) utility like so:



sudo sh -c 'pv < /dev/sda > /destination'


Of course you could become root first:



sudo -i


And then just do the backup:



pv < /dev/sda > /BackupDestination


And then when needed do the restore:



pv < /BackupDestination > /dev/sda


Notes




  • This basically does the same job as dd in the other answer, but is faster and shows progress.


  • This method may be slower than rsync, but that just copies files, which is not intended.


  • It copies everything 1:1, a perfect copy might you say.


  • You need also the boot sector for it to boot later on. The simplest method is to backup the whole drive.



  • To show progress with dd (man page), you could just add to the command:



    status=progress



Tip



For you to be able to effectively compress the image afterwards, don't forget to zero free space.






share|improve this answer


























  • Why cloning the other partitions? The question is just about backup/restore Windows 10.

    – Sopalajo de Arrierez
    May 16 '18 at 0:29











  • pv is not faster than dd unless you give dd a tiny bs value.

    – user1133275
    May 16 '18 at 8:35











  • @user1133275 Have you ever made some benchmark? Never mind, don't bother. cat without progress or pv with progress is preferable method of cloning for me at least.

    – Vlastimil
    May 16 '18 at 8:47



















1














Yes, the most simple solution is



dd if=/dev/sda of="/media/usb/$(date).img"


That is slow and takes up a lot of space so you can




  • just copy the partition[s] + boot sector you want

  • zero and compress free space

  • file instead of block based backups

  • rdiff-backup for reverse diffs (dramatic size reduction after the first)

  • rsync (for dramatic speedup over slow networks)

  • cow FS (btrfs/zfs) for faster/smaller than rsync/diff backups are only an option if you put windows in a VM, and I'm not sure how well they are suited to that scenario.


Likely you missed the boot sector, UUIDs and should read up on grub and
https://en.m.wikipedia.org/wiki/Windows_Vista_startup_process






share|improve this answer


























  • Why cloning the other partitions? The question is just about backup/restore Windows 10.

    – Sopalajo de Arrierez
    May 16 '18 at 0:29






  • 1





    @SopalajodeArrierez the whole thing is the simple method, otherwise you need to think about partition tabe type, boot sector, UUIDs, alignment, flags, utility partitions etc.

    – user1133275
    May 16 '18 at 1:15



















0














Like other solutions posted until now, this one show progress (like the pv solution, not relative to total, just number of MB transferred) and does not compress (a 100GB partition would result in a 100GB file), but it backups only the partition (sda1), not the entire disk:



dcfldd if=/dev/sda1 of=Image.dd bs=2M


The dcfldd tool is a simple dd that shows progress.

The buffer size bs=2M seems to me a good value for USB devices (a 120 GB partition copied in about 15-20 minutes).



Tested working on Windows 10 version 1803. No need (or so it seems) to backup too the entire hard disk, happily.



Of course, compressing the resulting file later would probably be a good idea.






share|improve this answer

































    0














    I have just successfully finished the described scenario of backing up Windows 10 from Linux to a file and restoring them on a new drive.



    With the old disk zero free space from Windows by doing



    zdelete -z c:


    using SDelete.



    Get some live Linux USB to boot and backup MBR and partition table to a spare drive



    dd if=/dev/sda of=/somewhere/mbr bs=512 count=63


    copy the boot partition to a file



    dd if=/dev/sda1 bs=1M status=progress | lz4 > /somewhere/sda1.lz4


    copy the system partition to a file



    dd if=/dev/sda2 bs=1M status=progress | lz4 > /somewhere/sda2.lz4


    Place the new disk into the computer, boot the live Linux again
    and restore the beginning of the disk



    dd of=/dev/sda if=/somewhere/file.mbr


    That gets you the same primary partition layout (partitions inside extended partition
    are stored somewhere else and will not be restored by doing this).



    Now restore the two Windows partitions



    dd of=/dev/sda1 bs=1M status=progress < lz4cat /somewhere/sda1.lz4
    dd of=/dev/sda2 bs=1M status=progress < lz4cat /somewhere/sda2.lz4


    The drive didn't boot at this stage (grub complaining). So boot windows rescue disk
    or the installation media and select "repair". In Troubleshooting start cmd prompt
    and run



    bootrec /fixmbr


    At this stage I got the original Windows system to boot on the new bigger drive. I got 50% compression rate with both gzip and lz4 (with 70% full drive) but gzip was limited by the CPU speed (27MB/s in my case) while lz4 was not (480MB/s CPU limit, 180MB/s my backup drive limit).



    My first try was with ntfsclone but that didn't produce bootable Windows (it was complaining of some missing files in WindowsSystem32). I am not sure why it didn't work. At the end the dd + lz4 solution created smaller image than ntfsclone by itself. Your mileage may vary based on how full the disk is modulo bugs in ntfsclone - dd seems much easier to get right :-)






    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%2f444019%2fhow-can-i-clone-backup-restore-windows-10-from-linux%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2















      pv method



      You could use pv (man page) utility like so:



      sudo sh -c 'pv < /dev/sda > /destination'


      Of course you could become root first:



      sudo -i


      And then just do the backup:



      pv < /dev/sda > /BackupDestination


      And then when needed do the restore:



      pv < /BackupDestination > /dev/sda


      Notes




      • This basically does the same job as dd in the other answer, but is faster and shows progress.


      • This method may be slower than rsync, but that just copies files, which is not intended.


      • It copies everything 1:1, a perfect copy might you say.


      • You need also the boot sector for it to boot later on. The simplest method is to backup the whole drive.



      • To show progress with dd (man page), you could just add to the command:



        status=progress



      Tip



      For you to be able to effectively compress the image afterwards, don't forget to zero free space.






      share|improve this answer


























      • Why cloning the other partitions? The question is just about backup/restore Windows 10.

        – Sopalajo de Arrierez
        May 16 '18 at 0:29











      • pv is not faster than dd unless you give dd a tiny bs value.

        – user1133275
        May 16 '18 at 8:35











      • @user1133275 Have you ever made some benchmark? Never mind, don't bother. cat without progress or pv with progress is preferable method of cloning for me at least.

        – Vlastimil
        May 16 '18 at 8:47
















      2















      pv method



      You could use pv (man page) utility like so:



      sudo sh -c 'pv < /dev/sda > /destination'


      Of course you could become root first:



      sudo -i


      And then just do the backup:



      pv < /dev/sda > /BackupDestination


      And then when needed do the restore:



      pv < /BackupDestination > /dev/sda


      Notes




      • This basically does the same job as dd in the other answer, but is faster and shows progress.


      • This method may be slower than rsync, but that just copies files, which is not intended.


      • It copies everything 1:1, a perfect copy might you say.


      • You need also the boot sector for it to boot later on. The simplest method is to backup the whole drive.



      • To show progress with dd (man page), you could just add to the command:



        status=progress



      Tip



      For you to be able to effectively compress the image afterwards, don't forget to zero free space.






      share|improve this answer


























      • Why cloning the other partitions? The question is just about backup/restore Windows 10.

        – Sopalajo de Arrierez
        May 16 '18 at 0:29











      • pv is not faster than dd unless you give dd a tiny bs value.

        – user1133275
        May 16 '18 at 8:35











      • @user1133275 Have you ever made some benchmark? Never mind, don't bother. cat without progress or pv with progress is preferable method of cloning for me at least.

        – Vlastimil
        May 16 '18 at 8:47














      2












      2








      2








      pv method



      You could use pv (man page) utility like so:



      sudo sh -c 'pv < /dev/sda > /destination'


      Of course you could become root first:



      sudo -i


      And then just do the backup:



      pv < /dev/sda > /BackupDestination


      And then when needed do the restore:



      pv < /BackupDestination > /dev/sda


      Notes




      • This basically does the same job as dd in the other answer, but is faster and shows progress.


      • This method may be slower than rsync, but that just copies files, which is not intended.


      • It copies everything 1:1, a perfect copy might you say.


      • You need also the boot sector for it to boot later on. The simplest method is to backup the whole drive.



      • To show progress with dd (man page), you could just add to the command:



        status=progress



      Tip



      For you to be able to effectively compress the image afterwards, don't forget to zero free space.






      share|improve this answer
















      pv method



      You could use pv (man page) utility like so:



      sudo sh -c 'pv < /dev/sda > /destination'


      Of course you could become root first:



      sudo -i


      And then just do the backup:



      pv < /dev/sda > /BackupDestination


      And then when needed do the restore:



      pv < /BackupDestination > /dev/sda


      Notes




      • This basically does the same job as dd in the other answer, but is faster and shows progress.


      • This method may be slower than rsync, but that just copies files, which is not intended.


      • It copies everything 1:1, a perfect copy might you say.


      • You need also the boot sector for it to boot later on. The simplest method is to backup the whole drive.



      • To show progress with dd (man page), you could just add to the command:



        status=progress



      Tip



      For you to be able to effectively compress the image afterwards, don't forget to zero free space.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited May 16 '18 at 5:16

























      answered May 16 '18 at 0:13









      VlastimilVlastimil

      8,0291363136




      8,0291363136













      • Why cloning the other partitions? The question is just about backup/restore Windows 10.

        – Sopalajo de Arrierez
        May 16 '18 at 0:29











      • pv is not faster than dd unless you give dd a tiny bs value.

        – user1133275
        May 16 '18 at 8:35











      • @user1133275 Have you ever made some benchmark? Never mind, don't bother. cat without progress or pv with progress is preferable method of cloning for me at least.

        – Vlastimil
        May 16 '18 at 8:47



















      • Why cloning the other partitions? The question is just about backup/restore Windows 10.

        – Sopalajo de Arrierez
        May 16 '18 at 0:29











      • pv is not faster than dd unless you give dd a tiny bs value.

        – user1133275
        May 16 '18 at 8:35











      • @user1133275 Have you ever made some benchmark? Never mind, don't bother. cat without progress or pv with progress is preferable method of cloning for me at least.

        – Vlastimil
        May 16 '18 at 8:47

















      Why cloning the other partitions? The question is just about backup/restore Windows 10.

      – Sopalajo de Arrierez
      May 16 '18 at 0:29





      Why cloning the other partitions? The question is just about backup/restore Windows 10.

      – Sopalajo de Arrierez
      May 16 '18 at 0:29













      pv is not faster than dd unless you give dd a tiny bs value.

      – user1133275
      May 16 '18 at 8:35





      pv is not faster than dd unless you give dd a tiny bs value.

      – user1133275
      May 16 '18 at 8:35













      @user1133275 Have you ever made some benchmark? Never mind, don't bother. cat without progress or pv with progress is preferable method of cloning for me at least.

      – Vlastimil
      May 16 '18 at 8:47





      @user1133275 Have you ever made some benchmark? Never mind, don't bother. cat without progress or pv with progress is preferable method of cloning for me at least.

      – Vlastimil
      May 16 '18 at 8:47













      1














      Yes, the most simple solution is



      dd if=/dev/sda of="/media/usb/$(date).img"


      That is slow and takes up a lot of space so you can




      • just copy the partition[s] + boot sector you want

      • zero and compress free space

      • file instead of block based backups

      • rdiff-backup for reverse diffs (dramatic size reduction after the first)

      • rsync (for dramatic speedup over slow networks)

      • cow FS (btrfs/zfs) for faster/smaller than rsync/diff backups are only an option if you put windows in a VM, and I'm not sure how well they are suited to that scenario.


      Likely you missed the boot sector, UUIDs and should read up on grub and
      https://en.m.wikipedia.org/wiki/Windows_Vista_startup_process






      share|improve this answer


























      • Why cloning the other partitions? The question is just about backup/restore Windows 10.

        – Sopalajo de Arrierez
        May 16 '18 at 0:29






      • 1





        @SopalajodeArrierez the whole thing is the simple method, otherwise you need to think about partition tabe type, boot sector, UUIDs, alignment, flags, utility partitions etc.

        – user1133275
        May 16 '18 at 1:15
















      1














      Yes, the most simple solution is



      dd if=/dev/sda of="/media/usb/$(date).img"


      That is slow and takes up a lot of space so you can




      • just copy the partition[s] + boot sector you want

      • zero and compress free space

      • file instead of block based backups

      • rdiff-backup for reverse diffs (dramatic size reduction after the first)

      • rsync (for dramatic speedup over slow networks)

      • cow FS (btrfs/zfs) for faster/smaller than rsync/diff backups are only an option if you put windows in a VM, and I'm not sure how well they are suited to that scenario.


      Likely you missed the boot sector, UUIDs and should read up on grub and
      https://en.m.wikipedia.org/wiki/Windows_Vista_startup_process






      share|improve this answer


























      • Why cloning the other partitions? The question is just about backup/restore Windows 10.

        – Sopalajo de Arrierez
        May 16 '18 at 0:29






      • 1





        @SopalajodeArrierez the whole thing is the simple method, otherwise you need to think about partition tabe type, boot sector, UUIDs, alignment, flags, utility partitions etc.

        – user1133275
        May 16 '18 at 1:15














      1












      1








      1







      Yes, the most simple solution is



      dd if=/dev/sda of="/media/usb/$(date).img"


      That is slow and takes up a lot of space so you can




      • just copy the partition[s] + boot sector you want

      • zero and compress free space

      • file instead of block based backups

      • rdiff-backup for reverse diffs (dramatic size reduction after the first)

      • rsync (for dramatic speedup over slow networks)

      • cow FS (btrfs/zfs) for faster/smaller than rsync/diff backups are only an option if you put windows in a VM, and I'm not sure how well they are suited to that scenario.


      Likely you missed the boot sector, UUIDs and should read up on grub and
      https://en.m.wikipedia.org/wiki/Windows_Vista_startup_process






      share|improve this answer















      Yes, the most simple solution is



      dd if=/dev/sda of="/media/usb/$(date).img"


      That is slow and takes up a lot of space so you can




      • just copy the partition[s] + boot sector you want

      • zero and compress free space

      • file instead of block based backups

      • rdiff-backup for reverse diffs (dramatic size reduction after the first)

      • rsync (for dramatic speedup over slow networks)

      • cow FS (btrfs/zfs) for faster/smaller than rsync/diff backups are only an option if you put windows in a VM, and I'm not sure how well they are suited to that scenario.


      Likely you missed the boot sector, UUIDs and should read up on grub and
      https://en.m.wikipedia.org/wiki/Windows_Vista_startup_process







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited May 16 '18 at 1:16

























      answered May 15 '18 at 23:48









      user1133275user1133275

      3,184723




      3,184723













      • Why cloning the other partitions? The question is just about backup/restore Windows 10.

        – Sopalajo de Arrierez
        May 16 '18 at 0:29






      • 1





        @SopalajodeArrierez the whole thing is the simple method, otherwise you need to think about partition tabe type, boot sector, UUIDs, alignment, flags, utility partitions etc.

        – user1133275
        May 16 '18 at 1:15



















      • Why cloning the other partitions? The question is just about backup/restore Windows 10.

        – Sopalajo de Arrierez
        May 16 '18 at 0:29






      • 1





        @SopalajodeArrierez the whole thing is the simple method, otherwise you need to think about partition tabe type, boot sector, UUIDs, alignment, flags, utility partitions etc.

        – user1133275
        May 16 '18 at 1:15

















      Why cloning the other partitions? The question is just about backup/restore Windows 10.

      – Sopalajo de Arrierez
      May 16 '18 at 0:29





      Why cloning the other partitions? The question is just about backup/restore Windows 10.

      – Sopalajo de Arrierez
      May 16 '18 at 0:29




      1




      1





      @SopalajodeArrierez the whole thing is the simple method, otherwise you need to think about partition tabe type, boot sector, UUIDs, alignment, flags, utility partitions etc.

      – user1133275
      May 16 '18 at 1:15





      @SopalajodeArrierez the whole thing is the simple method, otherwise you need to think about partition tabe type, boot sector, UUIDs, alignment, flags, utility partitions etc.

      – user1133275
      May 16 '18 at 1:15











      0














      Like other solutions posted until now, this one show progress (like the pv solution, not relative to total, just number of MB transferred) and does not compress (a 100GB partition would result in a 100GB file), but it backups only the partition (sda1), not the entire disk:



      dcfldd if=/dev/sda1 of=Image.dd bs=2M


      The dcfldd tool is a simple dd that shows progress.

      The buffer size bs=2M seems to me a good value for USB devices (a 120 GB partition copied in about 15-20 minutes).



      Tested working on Windows 10 version 1803. No need (or so it seems) to backup too the entire hard disk, happily.



      Of course, compressing the resulting file later would probably be a good idea.






      share|improve this answer






























        0














        Like other solutions posted until now, this one show progress (like the pv solution, not relative to total, just number of MB transferred) and does not compress (a 100GB partition would result in a 100GB file), but it backups only the partition (sda1), not the entire disk:



        dcfldd if=/dev/sda1 of=Image.dd bs=2M


        The dcfldd tool is a simple dd that shows progress.

        The buffer size bs=2M seems to me a good value for USB devices (a 120 GB partition copied in about 15-20 minutes).



        Tested working on Windows 10 version 1803. No need (or so it seems) to backup too the entire hard disk, happily.



        Of course, compressing the resulting file later would probably be a good idea.






        share|improve this answer




























          0












          0








          0







          Like other solutions posted until now, this one show progress (like the pv solution, not relative to total, just number of MB transferred) and does not compress (a 100GB partition would result in a 100GB file), but it backups only the partition (sda1), not the entire disk:



          dcfldd if=/dev/sda1 of=Image.dd bs=2M


          The dcfldd tool is a simple dd that shows progress.

          The buffer size bs=2M seems to me a good value for USB devices (a 120 GB partition copied in about 15-20 minutes).



          Tested working on Windows 10 version 1803. No need (or so it seems) to backup too the entire hard disk, happily.



          Of course, compressing the resulting file later would probably be a good idea.






          share|improve this answer















          Like other solutions posted until now, this one show progress (like the pv solution, not relative to total, just number of MB transferred) and does not compress (a 100GB partition would result in a 100GB file), but it backups only the partition (sda1), not the entire disk:



          dcfldd if=/dev/sda1 of=Image.dd bs=2M


          The dcfldd tool is a simple dd that shows progress.

          The buffer size bs=2M seems to me a good value for USB devices (a 120 GB partition copied in about 15-20 minutes).



          Tested working on Windows 10 version 1803. No need (or so it seems) to backup too the entire hard disk, happily.



          Of course, compressing the resulting file later would probably be a good idea.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited May 16 '18 at 14:52

























          answered May 16 '18 at 3:35









          Sopalajo de ArrierezSopalajo de Arrierez

          1,73993562




          1,73993562























              0














              I have just successfully finished the described scenario of backing up Windows 10 from Linux to a file and restoring them on a new drive.



              With the old disk zero free space from Windows by doing



              zdelete -z c:


              using SDelete.



              Get some live Linux USB to boot and backup MBR and partition table to a spare drive



              dd if=/dev/sda of=/somewhere/mbr bs=512 count=63


              copy the boot partition to a file



              dd if=/dev/sda1 bs=1M status=progress | lz4 > /somewhere/sda1.lz4


              copy the system partition to a file



              dd if=/dev/sda2 bs=1M status=progress | lz4 > /somewhere/sda2.lz4


              Place the new disk into the computer, boot the live Linux again
              and restore the beginning of the disk



              dd of=/dev/sda if=/somewhere/file.mbr


              That gets you the same primary partition layout (partitions inside extended partition
              are stored somewhere else and will not be restored by doing this).



              Now restore the two Windows partitions



              dd of=/dev/sda1 bs=1M status=progress < lz4cat /somewhere/sda1.lz4
              dd of=/dev/sda2 bs=1M status=progress < lz4cat /somewhere/sda2.lz4


              The drive didn't boot at this stage (grub complaining). So boot windows rescue disk
              or the installation media and select "repair". In Troubleshooting start cmd prompt
              and run



              bootrec /fixmbr


              At this stage I got the original Windows system to boot on the new bigger drive. I got 50% compression rate with both gzip and lz4 (with 70% full drive) but gzip was limited by the CPU speed (27MB/s in my case) while lz4 was not (480MB/s CPU limit, 180MB/s my backup drive limit).



              My first try was with ntfsclone but that didn't produce bootable Windows (it was complaining of some missing files in WindowsSystem32). I am not sure why it didn't work. At the end the dd + lz4 solution created smaller image than ntfsclone by itself. Your mileage may vary based on how full the disk is modulo bugs in ntfsclone - dd seems much easier to get right :-)






              share|improve this answer




























                0














                I have just successfully finished the described scenario of backing up Windows 10 from Linux to a file and restoring them on a new drive.



                With the old disk zero free space from Windows by doing



                zdelete -z c:


                using SDelete.



                Get some live Linux USB to boot and backup MBR and partition table to a spare drive



                dd if=/dev/sda of=/somewhere/mbr bs=512 count=63


                copy the boot partition to a file



                dd if=/dev/sda1 bs=1M status=progress | lz4 > /somewhere/sda1.lz4


                copy the system partition to a file



                dd if=/dev/sda2 bs=1M status=progress | lz4 > /somewhere/sda2.lz4


                Place the new disk into the computer, boot the live Linux again
                and restore the beginning of the disk



                dd of=/dev/sda if=/somewhere/file.mbr


                That gets you the same primary partition layout (partitions inside extended partition
                are stored somewhere else and will not be restored by doing this).



                Now restore the two Windows partitions



                dd of=/dev/sda1 bs=1M status=progress < lz4cat /somewhere/sda1.lz4
                dd of=/dev/sda2 bs=1M status=progress < lz4cat /somewhere/sda2.lz4


                The drive didn't boot at this stage (grub complaining). So boot windows rescue disk
                or the installation media and select "repair". In Troubleshooting start cmd prompt
                and run



                bootrec /fixmbr


                At this stage I got the original Windows system to boot on the new bigger drive. I got 50% compression rate with both gzip and lz4 (with 70% full drive) but gzip was limited by the CPU speed (27MB/s in my case) while lz4 was not (480MB/s CPU limit, 180MB/s my backup drive limit).



                My first try was with ntfsclone but that didn't produce bootable Windows (it was complaining of some missing files in WindowsSystem32). I am not sure why it didn't work. At the end the dd + lz4 solution created smaller image than ntfsclone by itself. Your mileage may vary based on how full the disk is modulo bugs in ntfsclone - dd seems much easier to get right :-)






                share|improve this answer


























                  0












                  0








                  0







                  I have just successfully finished the described scenario of backing up Windows 10 from Linux to a file and restoring them on a new drive.



                  With the old disk zero free space from Windows by doing



                  zdelete -z c:


                  using SDelete.



                  Get some live Linux USB to boot and backup MBR and partition table to a spare drive



                  dd if=/dev/sda of=/somewhere/mbr bs=512 count=63


                  copy the boot partition to a file



                  dd if=/dev/sda1 bs=1M status=progress | lz4 > /somewhere/sda1.lz4


                  copy the system partition to a file



                  dd if=/dev/sda2 bs=1M status=progress | lz4 > /somewhere/sda2.lz4


                  Place the new disk into the computer, boot the live Linux again
                  and restore the beginning of the disk



                  dd of=/dev/sda if=/somewhere/file.mbr


                  That gets you the same primary partition layout (partitions inside extended partition
                  are stored somewhere else and will not be restored by doing this).



                  Now restore the two Windows partitions



                  dd of=/dev/sda1 bs=1M status=progress < lz4cat /somewhere/sda1.lz4
                  dd of=/dev/sda2 bs=1M status=progress < lz4cat /somewhere/sda2.lz4


                  The drive didn't boot at this stage (grub complaining). So boot windows rescue disk
                  or the installation media and select "repair". In Troubleshooting start cmd prompt
                  and run



                  bootrec /fixmbr


                  At this stage I got the original Windows system to boot on the new bigger drive. I got 50% compression rate with both gzip and lz4 (with 70% full drive) but gzip was limited by the CPU speed (27MB/s in my case) while lz4 was not (480MB/s CPU limit, 180MB/s my backup drive limit).



                  My first try was with ntfsclone but that didn't produce bootable Windows (it was complaining of some missing files in WindowsSystem32). I am not sure why it didn't work. At the end the dd + lz4 solution created smaller image than ntfsclone by itself. Your mileage may vary based on how full the disk is modulo bugs in ntfsclone - dd seems much easier to get right :-)






                  share|improve this answer













                  I have just successfully finished the described scenario of backing up Windows 10 from Linux to a file and restoring them on a new drive.



                  With the old disk zero free space from Windows by doing



                  zdelete -z c:


                  using SDelete.



                  Get some live Linux USB to boot and backup MBR and partition table to a spare drive



                  dd if=/dev/sda of=/somewhere/mbr bs=512 count=63


                  copy the boot partition to a file



                  dd if=/dev/sda1 bs=1M status=progress | lz4 > /somewhere/sda1.lz4


                  copy the system partition to a file



                  dd if=/dev/sda2 bs=1M status=progress | lz4 > /somewhere/sda2.lz4


                  Place the new disk into the computer, boot the live Linux again
                  and restore the beginning of the disk



                  dd of=/dev/sda if=/somewhere/file.mbr


                  That gets you the same primary partition layout (partitions inside extended partition
                  are stored somewhere else and will not be restored by doing this).



                  Now restore the two Windows partitions



                  dd of=/dev/sda1 bs=1M status=progress < lz4cat /somewhere/sda1.lz4
                  dd of=/dev/sda2 bs=1M status=progress < lz4cat /somewhere/sda2.lz4


                  The drive didn't boot at this stage (grub complaining). So boot windows rescue disk
                  or the installation media and select "repair". In Troubleshooting start cmd prompt
                  and run



                  bootrec /fixmbr


                  At this stage I got the original Windows system to boot on the new bigger drive. I got 50% compression rate with both gzip and lz4 (with 70% full drive) but gzip was limited by the CPU speed (27MB/s in my case) while lz4 was not (480MB/s CPU limit, 180MB/s my backup drive limit).



                  My first try was with ntfsclone but that didn't produce bootable Windows (it was complaining of some missing files in WindowsSystem32). I am not sure why it didn't work. At the end the dd + lz4 solution created smaller image than ntfsclone by itself. Your mileage may vary based on how full the disk is modulo bugs in ntfsclone - dd seems much easier to get right :-)







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 26 at 8:23









                  Zbyněk WinklerZbyněk Winkler

                  1




                  1






























                      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%2f444019%2fhow-can-i-clone-backup-restore-windows-10-from-linux%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

                      How to make a Squid Proxy server?

                      第一次世界大戦

                      Touch on Surface Book