Okay, I actually feel confident after doing some reading that using
dd will do what you want.
According to this website you can use
dd to create an image of your drive, which is what you want to do.
Backing up your system:
So begin by booting from your live disk.
Switch to root mode if you are not root already.
su root, or
sudo su root
Check that no partitions from your windows drive are mounted.
To do this, you can use
lsblk, which will give you a list of all the drives and their device label. If you see an
sdaX mounted to a location such as
/mt/*, you will want to use
umount /dev/sdaX to unmount it.
The mount your external drive that you want to create the image on.
We will call this drive hda for this example.
First, create a folder to mount into in
/mnt/. I'm going to call it backup.
To do this:
mount -t vfat /dev/hda1 /mnt/backup to mount the drive to that location. (-t vfat says that partition one on your backup drive is a FAT filesystem, which it probably will be if you are running windows, though it may also be ntfs or something of that form.)
Now we actually do the backing up of the drive using the
If we follow the webpage's lead, they use the gzip to zip your image. It is at your discression, I'll follow what they are giving. Also, I'm not so sure about creating a backup with noerror enabled. I'd personally like to know if there is an error.
dd if=/dev/sda conv=sync,noerror bs=64K | gzip -c > /mnt/backup/sda.img.gz
Then to restore your system:
First unzip the image and convert it back:
gunzip -c /mnt/backup/sda.img.gz | dd of=/dev/sda conv=sync,noerror bs=64K
You may need to store some information in order to interpret the partition table stored inside of the image.
fdisk -l /dev/sda > /mnt/backup/sda_fdisk.info
One thing to note:
dd isn't exactly designed for this job specifically, it just makes a blind bit-by-bit copy of your drive. Then when we zip, gzip will try to remove zeros and unnecessary data to make it smaller. So the best thing we can do to help it out is clear out data blocks which are filled. You have probably heard about people saying that your data is never completely gone. Well, we can get pretty dang close with the
dd command. What we can do, is mount the drive and create some empty file anywhere you like. Lets call is "zero". We are going to load a bunch of zeros onto the drive and since this file will get massive, any data you thought was deleted before will actually be gone.
dd if=/dev/zero of=zero bs=8M; rm zero is the command to do this with.
Now, when you go back to zip your drive, any extra deleted bits will be zero, and so the compression algorithm can work better. Hopefully this helps.