If you reached this webpage by means of searching for "backup a windows hard drive using linux", or "make a disk image of windows hard drive using linux", it is probably because you don't know about the linux dd command, ...well... not yet.
The dd command is useful in that it can be used to make an exact copy of your hard drive for restoration later. It is not a file-by-file backup utility such as the script shown in Better Backups With Tar but it is a tool that will paint-over an existing disk drive with an exact copy of previously backed up hard drive data.
The dd command is useful for programmers or users that experiment with various software, then restore it back to the condition it was before the experiments (by experiments you can also include trial software that does not do what was promised and therefore wipe it out completely too). It is also useful for computers that are used on the Internet and have been compromised by root kits, trojans, keyloggers and other malware types of viruses because the restore will completely wipe out all previous problems, but it is only useful if the copy was made before the possibility of a problem since dd is not an anti virus or virus removal tool.
dd is not a smart backup system like several good commercial or more advanced backup programs since it lacks the features of allowing you to restore to a new drive of different parameters, ability to view, pick and choose data from the backup, but it is free, and it is reliable.
There are several examples on the Internet showing how to backup a linux computer, but this article is for windows computer administrators that need a nice easy way to backup a windows based computer onto another computer on their network, using linux, or in this case, using a Knoppix CDrom. Readers familiar with Linux may find many similarities in the steps taken.
The nice things about using a Knoppix CDrom is that you do not affect the hard drive (in question) when making a copy since Knoppix runs from RAM and not the hard drive. Additionally, you can completely restore an otherwise unstartable computer hard drive that refuses to start it's own operating system (whatever operating system - it doesn't matter) by completely restoring an older but complete-and-working copy of the hard drive.
The steps explained below can include computers that run DOS, OS/2, BeOS, the latest Macs, or any computer running an x86 type operating system and with an IBM PC type compatible hardware setup.
So, what do you need to make a backup to a network computer?
Note: This page is for use with Knoppix 6. If you are using an older version such as Knoppix 5 or 4, then use this How-To instead. |
WHAT TO DO - A DETAILED STEP BY STEP GUIDE
Why Knoppix? There are other tools such as Recovery Is Possible! RIP, but Knoppix is easy to find, easy to use, has a nice graphical user interface and a lot of other useful applications squeezed onto one CD.
This is the latest website location where you can find Knoppix. If you do not understand the default language, click the appropriate flag for the language of your choice since Knoppix CDroms come in several languages.
What you will want to do is go to the download section and select an appropriate FTP website where you can download a CDrom ISO. Some FTP websites are more up to date than others and some will download faster than others so you may wish to look at a few FTP websites before downloading.
If you are selecting an English CD ISO it will likely have EN in the title such as ADRIANE-KNOPPIX_V6.4.3CD-2010-12-24-EN.iso so look around. Note, if you are using KNOPPIX 5.1 or an earlier version, you may want to follow this guide instead.
The CDrom ISO files are about 690MB in size (with about 2G of compressed files and programs) while the DVD ISO files are about 4.7GB in size (and contain over 8G of compressed files and programs). These ISO files are large and will take some time to download even if you have a fast Internet connection.
If your CD burner program has a method to verify checksums, you may also want to download the md5 or sha1 ASCII text files which are about 300 bytes in size. These are text checksum files which you can read using a plain notepad or text editor type of program and you can verify the checksum against what your CD burner program calculates as a checksum before you burn a CDrom, this way, you know you downloaded the ISO file without errors and then you can verify that the CDrom you burn is also without errors.
Basically, setup your computer the best you can so that if you need to restore this copy in future, it is a reasonably clean copy to install. For example, if you downloaded the Knoppix ISO mentioned above, deleting the file from your hard drive after creating the CDrom Disk will save you an extra CDrom disk while making backups.
You will want to delete unwanted files, such as temporary files and clean-out the recycle bin, clean-out caches (check your "restore points" since this may be significant in size and some programs hold temp files in subdirectories too) and you may want to defragment the hard drive so that it is reasonably clean if you need to do a future re-install. In summary, you clean up once - now, instead of twice or more - later.
Next, install the Knoppix CDrom in the CD drive and restart your computer to bootup from the CDrom.
Once the Knoppix CDrom boots up, look along the left side of the screen. If you are using version 6.2, you will notice hard drive icon links to locations on your hard drive such as "sda1", "sda2", "sda3", etc. If you are using version 6.4, you will notice a file folder shortcut icon, and inside the file folder, you will see directories on your actual hard drive such as "Windows" or "Program Files". If you want to click on them, go ahead and look. You won't be using these during backup, but it is a good indicator that the Knoppix CDrom recognized your physical hard drive okay.
If you are recovering from a previous disaster, this is a good time to copy your Documents and Data information to another safe location before wiping the drive clean with a previously existing "good" copy because once this is done, all previous information is completely gone.
You may be interested in knowing the entire hard drive is "sda", where "sd" is for today's SATA Drive(s) and "a" is for the 1st primary hard drive (and "b", "c", "d" for following secondary hard drives), then the following numbers are divisions or partitions on the hard drive such as 1, 2, 3.
Before going any further, you should see if you can access the network. One quick easy check is to use an Internet Web Browser to see if your computer has Internet access. If you are using Knoppix version 6.0 or 6.2, in the center of the screen you will have an open Konqueror Web Browser window which may point to "file:/cdrom/index.html" or some other file located on the CDrom itself. If you are using Knoppix 6.4, you'll find the Internet World Browser icon in the bottom left corner (in the shape of a world globe). One quick easy check if your computer has Internet access is to type in an Internet location such as www.JoesCat.com and see if it appears in the browser window, if yes, you are ready to go to the next step since you have a network connection.
If you hover the mouse near the bottom of the screen over the black-box icon it should say something like "Terminal Emulator Program". Click on the "Terminal Program" to bring up a command-line shell.
Next, you want to create a folder which you will link between this computer and the network computer so type in the appropriate commands below:
Here is an explanation of the commands you just did above: In the example shown above, you may note "sda1", "sda5", "sdc". Those are the partitions (divisions) on this particular computer hard drive (your computer may show different values). Knoppix did not mount these yet since you already have a graphical version you can view "My Documents" with the mouse on the left side of the screen. Your computer may have one or more partitions depending on how it was built but that won't matter since you will be copying everything from "sda" to the network backup drive.
Right now, you should have a "/media/backup" directory, but it is not linked yet, that comes next.
Now create the SMB link by using Knoppix's mount command. Check the details below before you begin since you need to substitute your server's raw address location for "server" (for example network address 192.168.0.100), it's correct "share" name, your "username", and your "password" to access the server. It is shown the way it is now so that it all fits on one line. If you are connecting to another type of media, you will need to substitute the appropriate commands where necessary.
These are the commands you did above: Skip this step if you are restoring the hard drive from a backup image.
After much searching around and finding some rather long scripts and programs, the hunt for a solution came up with the rather simple formula shown below. If you were expecting more, nothing else is needed. Making a backup over a network may take some time to complete but most of the work and compression is done before the data is sent to the network machine.
Additionally, due to using a "chmod" command earlier, you can view the directory using any of the Knoppix graphical browsers as work progresses. You may need to refresh the display occasionally to see progress.
You may note that information is piped "|" from the output of one program to the input of the next program and that there are three programs that run consecutively one after the next.
Follow the steps below if you want to make a backup image of the hard drive (Alternatively, there are other programs and tools you can use, but this long command is quite simple and straightforward).
These are the steps you have done above: If you want to read up on other useful ways to use dd check www.linuxquestions.org which was a good source of information for the one-liner answer mentioned here and other dd uses.
Note that, except for copying the files to the server, that all the work of compression and splitting files is done on this computer running Knoppix so that you do not load-down the server computer with extra work. Also note, that the work of backing up the hard drive will take a long period of time depending on the CPU speed of the computer running Knoppix, the size of the hard drive to backup, the network connection speed, and the speed of the server computer to accept the backup data files.
Skip this step if you are only doing a backup.
Instead of sending data to the network drive, use the commands below to restore the image back to the hard drive. Again, it all comes down to a one line command, but make sure your data is seen (using ls) before proceeding with the one-line command.
This explains the steps above: Note that, except for copying the files from the server, that all the work of merging and decompressing files is done on the computer running Knoppix so that you do not load-down the server computer with extra work. Note, that the work of restoring the hard drive will take a long period of time depending on the CPU speed of the computer running Knoppix, the size of the hard drive to backup, the network connection speed, and the speed of the server computer to send the backup data files.
If you are using Knoppix 5 or 4 you may see "hda" instead of "sda".knoppix@Microknoppix:~$ cd /media
knoppix@Microknoppix:/media$ sudo su
root@Microknoppix:/media# mkdir backup
root@Microknoppix:/media# chmod 777 backup
root@Microknoppix:/media# ls -l
total 0
drwxrwxrwx 2 root root 0 Feb 1 12:00 backup
drwxr-xr-x 2 root root 0 Feb 1 11:55 hda1
drwxr-xr-x 2 root root 0 Feb 1 11:55 hda5
drwxr-xr-x 2 root root 0 Feb 1 11:55 hdc
root@Microknoppix:/media#
root@Microknoppix:/media# mount -o username=name,password=secret //server/share backup
root@Microknoppix:/media# ls -a -l backup
drwxr-xr-x 2 root root 0 Jan 1 12:00 .
drwxr-xr-x 8 root root 0 Feb 1 12:17 ..
-rwxr-xr-x 1 root root 7518240 Jan 5 17:15 Firefox Setup 3.0.5.exe
-rwxr-xr-x 1 root root 149353184 Jan 5 17:12 OOo_3.0.1_Win32Intel_install_en-US.exe
-rwxr-xr-x 1 root root 6762400 Jan 5 17:16 Thunderbird Setup 2.0.0.19.exe
root@Microknoppix:/media#
Before following the steps below, you may want to consider a way to make the backup go very fast. Check this other page for additional steps for a fast image backup using option bs (this step is more important for older versions of Knoppix).
root@Microknoppix:/media# dd if=/dev/sda | gzip -c | split -b 638m - backup/backup.img.gz.
root@Microknoppix:/media# ls -l backup
-rwxr-xr-x 1 root root 668991488 Feb 1 14:42 backup.img.gz.aa
-rwxr-xr-x 1 root root 668991488 Feb 1 15:41 backup.img.gz.ab
-rwxr-xr-x 1 root root 668991488 Feb 1 16:37 backup.img.gz.ac
-rwxr-xr-x 1 root root 101479364 Feb 1 17:11 backup.img.gz.ad
-rwxr-xr-x 1 root root 7518240 Jan 5 17:15 Firefox Setup 3.0.5.exe
-rwxr-xr-x 1 root root 149353184 Jan 5 17:12 OOo_3.0.1_Win32Intel_install_en-US.exe
-rwxr-xr-x 1 root root 6762400 Jan 5 17:16 Thunderbird Setup 2.0.0.19.exe
root@Microknoppix:/media#
Before following the steps below, you may want to consider a way to make the restore go very fast. Check this other page for additional steps for a fast image restore using option bs (this step is more important for older versions of Knoppix).
root@Microknoppix:/media# ls -l backup
-rwxr-xr-x 1 root root 668991488 Feb 1 14:42 backup.img.gz.aa
-rwxr-xr-x 1 root root 668991488 Feb 1 15:41 backup.img.gz.ab
-rwxr-xr-x 1 root root 668991488 Feb 1 16:37 backup.img.gz.ac
-rwxr-xr-x 1 root root 101479364 Feb 1 17:11 backup.img.gz.ad
-rwxr-xr-x 1 root root 7518240 Jan 5 17:15 Firefox Setup 3.0.5.exe
-rwxr-xr-x 1 root root 149353184 Jan 5 17:12 OOo_3.0.1_Win32Intel_install_en-US.exe
-rwxr-xr-x 1 root root 6762400 Jan 5 17:16 Thunderbird Setup 2.0.0.19.exe
root@Microknoppix:/media# cat backup/backup.img.gz.* | gzip -dc | dd of=/dev/sda
root@Microknoppix:/media#
Links To Sections Of This How To | |||
---|---|---|---|
Image With Knoppix 5 | Top Of Page | Quick Summary | Detailed Steps |