When it comes to backup, most of us don’t do enough. But suppose it was as easy as running a script? Would you do it more often? Lets look at how a dual boot computer can use Linux to backup windows.
Computers these days are much more reliable that they were even a dozen years ago. In fact, they are so reliable that many people never remember to backup their files until something disasterous happens. But the simple fact of the matter is that even though computers are highly reliable they do fail sometimes.
So the question becomes not should we backup, but will we backup. Any system can fail, some fail often, and some hardly ever fail. Additionally we should remember that some of the failures can be more traumatic than others. So we need to answer a series of questions about what we are going to do.
Do you have data you want to save on the computer?
If you don’t have any useful data on the computer don’t bother backing it up.
Do you want to backup only the data or the whole computer?
Backing up the data gives you less to backup so your choices of backup media is much larger. Backing up the whole computer makes recovery faster, but requires much larger backup media.
Do you need to backup the data using the primary OS or can you use an alternate?
If you are backing up Windows while running windows, it is not easily restorable. Many backup utilities require you to reinstall windows before you can restore the system. There is also the problem that you can not write a DLL if it has been loaded into memory.
On the other hand if you back Windows from Linux or a Live CD, you can do a complete backup and restore the entire system.
If you are going to backup your data and not the OS how can you structure your data?
To save your data, you need to have a plan and stick to it. Having a plan simply means that you arrange all your data to live in a specific directory tree or partition.
The most efficient method of backing up your system is to plan ahead. Planning is a good idea because by organizing your data you are more likely to be able to find things later. Lets go through what it takes to plan for backup.
The first step is to create a folder to keep all your data in. The idea is that by keeping your data in a structure you only need to backup that folder and it’s subdirectories. So for the sake of argument lets say you start by creating a directory C:\MYDATA. You now have a location to work with.
The next step is to go through all you applications and set them to use a subdirectory under this directory. Let me give you two examples of what I am talking about
For OpenOffice, open the Writer and from the dropdown menu Tools select Options. Under the section OpenOffice.org select Paths. Select the item My Documents, click on edit. You can now set it to something like C:\MYDATA\OpenOffice. This will automatically open up that directory when ever you save a document.
For Firefox here are the steps:
copy/move your bookmarks.html file (and bookmarks.bak) to the location you prefer to keep it.
enter about:config in the Firefox location bar, right-click on any of the listed preferences, and choose New -> String.
enter the preference name: browser.bookmarks.file
for the value, enter the new file path (including the file name) of your bookmarks.html file.
Another important step is to capture the information on your configuration. You can get most of the information by using the built in program msinfo32. You need to make sure you know which drivers are loaded and which applications are installed.
A final piece of information that is good to keep in your MYDATA directory are any drivers used on your system. These files can often be downloaded from the manufacturer and saved in a directory. It will save you much grief during a reinstall if you have a copy of all your drivers in your backup.
That is all there is to it. You can now keep all your data in one location. It will be easier to find and backup.
So you decided to do a backup using Linux instead of trying to use Windows. I will describe two methods one using a Live CD rescue disk and the other using a Dual booting computer with Linux.
We will assume you are doing backups to an external backup device. For this discussion we will assume the device is /dev/sda1. If this is not your backup device you will need to change this device for what ever is your backup device.
This is a link to a talk I gave the WPCUG main group about how to rescue windows. Part of the talk discussed how to use a bootable CD to backup files over the network. Have a look at the article Let the Penguin help you for more information.
For this discussion I am going to assume you have setup your computer for dual booting between Windows and Linux. I will further assume that you know how to use the command line.
One more requirement is that you have formatted your windows partition using VFAT not NTFS. This is important since NTFS is still basically a proprietary file format from Microsoft. Yes there is some support for NTFS in the newer Linux kernels, but it is not totally dependable yet. So I advise against it.
Now lets assume you have started up your computer and booted into Linux. Here are the steps you could use to backup your windows partitions into your home directory under Linux. I will assume you are user john and you also have root permission to mount file system. Finally I am going to give you a series of commands which you can enter from the command line.
Before you can start you need to mount your Windows partition onto your Linux system. So lets create a directory to use as a mount point. As root do:
mkdir /mnt/windows. Now we have a mount point to attach the windows partition to the Linux file tree.
Next we will mount the partition to the Linux tree. I will assume that the windows partition is on
/dev/hda2. If you are unsure of the partition name try doing, as root
fdisk -l /dev/hda You should see a line in the output which looks something like:
/dev/hda2 * 32 1856 14659312+ c W95 FAT32 (LBA) Which shows that the partition /dev/hda2 is of type FAT32, also known as VFAT.
So now as root issue the command
mount -v -t vfat /dev/hda2 /mnt/windows to attach the windows partition to the Linux directory tree.
You now need a place to keep your backup files which has enough space to hold the backup. I am going to use the directory
So as root you would issue the command:
tar cjvf /home/john/backup/backup.20090617.tar.bz2 /mnt/windows/*. This will take all the contents of the windows partition and create an archive file named
backup.20090617.tar.bz2 in your backup directory.
Once the backup is done, you can exit Linux and know you have a complete backup of your windows partition
Now that we have created this archive lets look at what is wrong with it.
The good thing about this type of backup is that you can restore the entire system as though you took a snapshot of it. This can be useful if you have to reformat your windows partition and reinstall the complete system.
Since you backed up everything, the restore will bring back all your programs, settings, data, and temp files. No need to do anything but run the backup and forget it.
There are a number of problems with this method, not to mention that it also backs up your viruses and trojans. Here is a list of the problems I see
You are backing up the
/pagefile.sys which is the swap file. On this computer, with a 15 gig partition, the pagefile.sys is 1.5 gig.
The amount of space required for the backup is enormous. For a 15 gig partition, it could easily take 10 gig of backup space for every backup.
Even though you can restore the entire system in one pass, you have all copied over all the old data left over from uninstalled programs, and bloated registry entries.
This method is the same as the full backup with one important exception. You are only backing up the MYDATA directory.
So the only change is the command you would use for the backup.
tar cjvf /home/john/backup/backup.20090617.tar.bz2 /mnt/windows/MYDATA/*.
The main advantage is much smaller backup size. This allows you to keep multiple backups, even on media like a CD.
Another advantage is that it is easier to find a single file from the backup. You can much more quickly do a directory listing of a single backup and extract only the file of interest.
You can clean up your system, removing old files, and outdated files by reinstalling your system. I have seen systems both shrink in size and improve performance from a reinstall.
The biggest down side is that if you have a full system crash, you will need to reinstall both the OS and the applications. This is time consuming.
Finally, for now I will give you the web sites of some Linux backup utility software. This is not an extensive list but will give you some graphical choices.
The Simple Linux Backup software simplifies the task of backing up a Linux desktop system. The software was originally written to accompany my article on backing up a Linux desktop system. It includes two applications:
The Simple Backup Configuration Program (SBCP). This wizard asks you a few simple questions about what to back up, where to back it up, etc. It records these answers in some configuration files and sets up automatic backups for you.
The backup script, bkup. This shell script actually performs the backups based on the options you set in SBCP. It has no user interface – it is meant to be run automatically by the Linux scheduler, cron, or manually from a command line.
Mondo is reliable. It backs up your GNU/Linux server or workstation to tape, CD-R, CD-RW, DVD-R[W], DVD+R[W], NFS or hard disk partition. In the event of catastrophic data loss, you will be able to restore all of your data [or as much as you want], from bare metal if necessary. Mondo is in use by Lockheed-Martin, Nortel Networks, Siemens, HP, IBM, NASA’s JPL, the US Dept of Agriculture, dozens of smaller companies, and tens of thousands of users.
Mondo is comprehensive. Mondo supports LVM 1/2, RAID, ext2, ext3, ext4, JFS, XFS, ReiserFS, VFAT, and can support additional filesystems easily: just e-mail the mailing list with your request. It supports software raid as well as most hardware raid controllers. It supports adjustments in disk geometry, including migration from non-RAID to RAID. Mondo runs on all major Linux distributions (RedHat, RHEL, SuSE, SLES, Mandriva, Debian, Gentoo) and is getting better all the time. You may even use it to backup non-Linux partitions, such as NTFS.
Mondo is free! It has been published under the GPL v2 (GNU Public License), partly to expose it to thousands of potential beta-testers but mostly as a contribution to the Linux community.
Written by John F. Moore
Last Revised: Tue Nov 1 18:14:06 EDT 2016