25

I bought a new laptop with Windows installed on it. I'm going to wipe all partitions and install Ubuntu.

One day I'll probably sell that laptop, so it'll be nice to recover it to the manufacturer state. I want to backup recovery partition, save it to some file and keep that in cloud. One day I'll restore it and reinstall Windows from the recovery partition.

What tools should I use to make it painless? I tried some Windows tools with my current laptop when I first bought it, but after 3 years I'm unable to recover the partition. I created the backup on Windows, so now I don't want to make the same mistake twice.

  • I would like to see a good answer to this but if you can't get a good answer, you could always buy a new hard drive and swap it out. – mchid Jul 18 '16 at 23:47
  • @mchid this is a laptop with no access to hard drive, you have to disassemble it to swap the drive - and you're also going to void your warranty. – tomrozb Jul 19 '16 at 0:58
  • I guess there is no access plate like there usually is on the bottom of the laptop? You need to disassemble the laptop for routine maintenance such as fan cleaning anyhow, double check that warranty? – mchid Jul 19 '16 at 1:04
  • @mchid yes, no access to RAM, fans, drive... – tomrozb Jul 19 '16 at 1:15
25
+500

Here's the VeryEasyWay™ to do this:

  • download the CloneZilla Live CD,
  • boot it
  • follow the device-image manual to do the imaging. A disk-to-image will compress the disk image before writing it so the entire space taken up by the image itself will be far less then the allocated space on the disk itself!
  • store the image of the disk you created in your cloud together with the image of the CloneZilla Live CD! (Just in case a future version of CloneZilla would not be able to restore it)
  • Only to be super-safe: keep the CloneZilla CD and the HDD you backed this up to in your bank safe just in case that your cloud software doesn't exist any more in the future and your house burns down afterwards... ;-)
  • do I understand correctly that I don't have to backup all partitions? I've 5 partitions, the biggest one has Windows installed on it. I'm going to backup 4 of them, creating a file for each on the 5th partition. Is that enough to restore the partitions and recover Windows later if I wipe the disc by removing current partitions, then formatting them to ext and installing Linux? – tomrozb Aug 7 '16 at 2:13
  • @tomrozb nope, you backup your entire drive into 1 fille.... – Fabby Aug 15 '16 at 23:37
  • 1
    Your solution is fine, but I'll end up with 512GB (I know the size is smaller than 512GB) file where 500GB is just an empty space. Isn't it possible to copy just what I want without copying the unnecessary space that I don't care of? Like the C:/ partition? – tomrozb Aug 16 '16 at 15:07
  • 1
    Ok, so that's the easiest and safest way. You should update your answer with this important info. Accepted, thank you! – tomrozb Aug 21 '16 at 10:47
  • 2
    Whoaa. 500 point Thank You. You're a star :)... have another 10! – WinEunuuchs2Unix Apr 25 '18 at 1:46
11

I Would do this:

Change to ROOT mode from a Live CD/USB Preferrably, if not it will still work from a dual-booted Linux install. Open a terminal and type:

sudo -i

Then, find out which partition is your Windows via this command:

fdisk -l

Mine shows this:

/dev/sda1  *         2048    206847    204800   100M  7 HPFS/NTFS/exFAT
/dev/sda2          206848 240818175 240611328 114.8G  7 HPFS/NTFS/exFAT
/dev/sda3       240820224 312498175  71677952  34.2G  5 Extended
/dev/sda5       240822272 312498175  71675904  34.2G  7 HPFS/NTFS/exFAT

So in my case, /dev/sda1 is the recovery bootloader (windows). They vary in size, mine was 100M but I have seen others for example if the image was installed with MDT then they are bigger.

Next Disk Dump Backup the /dev/sda1 partition to a file, and store it anywhere you want. In this case I saved it in my root folder's home directory:

dd if=/dev/sda1 bs=16m of=/home/wubilover/BackupOfSda1-WinRecovPartition.dd

Remember that DD takes a long time to run, so wait until it finishes :)

That's it. To restore it, swap the if= and of= of the above command. :) Enjoy.


To Perform a FULL Backup of the entire Drive you can buy a USB Drive that is larger, and then save it to a .dd file in the bigger drive. This way if you break something, you can boot into the Live CD/USB and attach your external drive and restore.

Full Backup to external drive:

  • Boot into Live CD/USB wait for ubuntu to load and then open a terminal

  • Plug in your external drive which is LARGER then the internal drive, ensure that it is NTFS or EXT3 or higher so that it can hold the large file. This is confirmed via running the command:

    gksudo gparted
    

    Then go ahead and partition it to Ext3 or Ntfs (doesn’t matter, but if you are using windows i recommend ntfs)

  • Confirm that it is mounted via

    df -kh
    
  • BACKUP THE HARD DRIVE to the EXTERNAL HARD DRIVE VIA (Notice the command is different from above):

    dd if=/dev/sda bs=16m of=/media/MyUSBStick/BackupOfSda-TheEntireHD.dd
    
  • And... if something goes wrong you can RESTORE THE EXTERNAL HARD DRIVE's .dd file to the INTERNAL HARD DRIVE VIA (Notice the command is different from above):

    dd bs=16m if=/media/MyUSBStick/BackupOfSda-TheEntireHD.dd of=/dev/sda 
    
  • 2
    I would strongly suggest to backup starting from the first sector (partition table), including the recovery partition and possibly a bit more. :) Actually, it could be easier to backup using Clonezilla. – Andrea Lazzarotto Jul 19 '16 at 10:34
  • 3
    I also like to pipe dd through gzip for compression. on a brand new laptop there will be a lot of empty blocks to compress for cheap. it should look something like dd if=${drive} bs=512k conv=sync,noerror | gzip | dd of=${file} – redbow_kimee Jul 20 '16 at 4:21
  • 2
    @KissMeKimmi: On most drives it would be much faster yo use an I/O block size in the ranges of multiple megabytes. I typically use 8 or 16 MiB, since a slightly too large buffer doesn't decrease throughput significantly as long as you have enough memory (so if you're not on an embedded system). – David Foerster Jul 24 '16 at 7:19
  • 2
    @WubiUbuntu1980: Decompression would work like this: gunzip < backup.dd.gz | dd of=/dev/sdX bs=8m. The conv=sync,noerror are completely unnecessary and even pointless in my opinion unless you have a very specific use case for them (which you don't). – David Foerster Jul 24 '16 at 7:24
  • 2
    Copying the disk including the boot sector and the whole recovery partition should be enough. But don't put it in the cloud (well, not only there). I suggest you invest some euros/dollars into a 16 GB USB drive and keep it in a safe, dry place. – Andrea Lazzarotto Aug 7 '16 at 10:14
2

This method which images the entire drive works flawlessly to backup any operating system, including any version of Windows. I've used it repeatedly over the years. The only possible downside is that you'll need to restore (and store) the image to a drive of equal (or greater) size due to not using compression. The upside is it takes very little of your time.

  • Um you know your link is to a Fabby answer who is already slated to be awarded the 500 point bounty for his answer above? ;)... Nonetheless +1 here and +1 on the link. – WinEunuuchs2Unix Apr 25 '18 at 1:49
  • @WinEunuuchs2Unix The link was a typo. Thanks for the heads up. Yes, I know Fabby is explicitly slated for the bounty. – Elder Geek Apr 25 '18 at 2:38
  • Elder I already upvoted your new link some time last year or the year before. It's a good answer. – WinEunuuchs2Unix Apr 25 '18 at 2:45
  • Oh! Just noticed this one! +1 ;-) – Fabby Dec 16 '18 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.