How does one make a copy of an operating system and place it in another partition as a back up, and then copy the back up over to the original partition as a fresh installation of the original copy?

For example, I have two partitions:

Partition : Original OS | Partition : Empty

I make a copy of the original OS

Partition : Original OS | Partition : Original OS

I label the second copy as a Back Up

Partition : Original OS | Partition : Original OS Back Up

At a later time the Original OS becomes corrupted

Partition : Original OS Corrupted | Partition : Original OS Back Up

I copy the Original OS back up over to the corrupted partition as a fresh install

Partition : Original OS | Partition : Original OS Back Up

1 Answer 1


For Linux (there is a WINDOWS tag on this; read up on "Ghost" and similar tools in that case)

man dd and man gzip may be what you need.
You will also need to boot from other media than those you're 'hampering' with - e.g. Ubuntu install media.

But as with any capable tool mistakes may be very devastating, please remember that. :-)

dd basically grabs pure data and puts if elsewhere. dd if=/dev/sda1 of=/dev/sda2 is the basis of what you want, assuming that your disk is /dev/sda .
Restore the backup by just switching if and of. Note though that /dev/sda2 must be at least as large as /dev/sda1, if it is larger you will get an error message from dd as you do the restore (no harm by THAT though).

lsblk will tell you which devices you have active, and possibly where the partitions has been mounted (no need to sudo for the basics).

Now, I'd suggest you consider having the second partition mounted allowing access through any file system, e.g as /media/backups/ . This makes it possible to use /media/backups/ for other things as well. In that case just create a file from the first partition, e.g. by:
dd if=/dev/sda1 of=- | gzip --fast /media/backups/first-partition-backup.dd.gz
Restore with gzip -d /media/backups/first-partition-backup.dd.gz | dd if=- of=/dev/sda1

NOTE: UNTESTED COMMANDS, check syntax and switches before actual use!
The dash is normally a standin for stdin/stdout , here redirected through a pipe.

The negative side of doing it with dd (either way above) is the fact that the entire partition is copied, also 'free' portions of the file system. i.e. deleted files remains as data in free blocks - these will still take up space (even when compressed by gzip).

  • I do have linux as another operating system with my dual boot. If I understand your answer correctly, I can perform this type of back up procedure manually from my linux operator system? If so, that would be amazing. I am not sure if your suggesting that this might be a bad idea. Dec 7, 2014 at 18:11
  • This will work for any OS that resides on a single partition. There is just two downsides: you must have the data back to a partition that is the same size, and it has to be named the same as the system boots from that partition - and then the fact in the last paragraph above on top of that.
    – Hannu
    Dec 7, 2014 at 18:18
  • The actual dual-boot settings/setup may cause trouble - I have not tried out that to the extent that I can suggest any "counter measures" for avoiding trouble there.
    – Hannu
    Dec 7, 2014 at 18:21
  • This may be more than what I am searching for. I would like to make a back up of windows that I can use to easily restore my windows as painless as possible. This to me seemed like one way of doing it, however this might be the classical XY problem. The solution you propose seems very simple and elegant, however the draw backs must be heavily considered from what I understand from your considerations. Currently one problem I must figure out is the renaming of partitions? Also, will Windows complain if it was copied to another partition? Dec 7, 2014 at 18:26
  • Windows wasn't in the question from the beginning. So Windows 'automatic' things will possibly cause trouble. Please check up on Symantec/Norton Ghost or whatever it is named today. It does the above and more for Windows and maybe other OS'es too.
    – Hannu
    Dec 7, 2014 at 18:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .