[ Back to Table of Contents ]
[ << ]
[ >> ]
XXCOPY TECHNICAL BULLETIN #10
From: Kan Yabumoto email@example.com
To: XXCOPY user
Subject: Cloning the Win9x system disk using XXCOPY.
Date: 2003-11-07 (revised)
The disk clone operation has become one of the most popular usages of
the XXCOPY utility. Therefore, I decided to have this dedicated
page just for the subject. But, if you just arrived at this page
for the first time and have not really learned much about XXCOPY,
I would like to remind you that this Disk Clone capability is rather
a small portion of what XXCOPY can do for you. If you are in a hurry,
go ahead and finish your disk clone job by following the instructions
below. But, I suggest you come back and explore the rest of XXCOPY.
In this article, I would like to discuss the most common case of
disk cloning operation. Some related topics which were once part
of this article are moved to another page, XXTB #20.
Note: The technique discussed in this article applies primarily
for Windows 9x and ME cases. If your C: drive is loaded
with Win NT4/2000/XP, you will not get a bootable disk. If you
have a dual-boot system (Win 9X and NT/2000/XP), then it is best
you perform the operation from Win 9x. But even in that case,
the newly cloned drive will not be dual-bootable because XXCOPY
does not touch the Master Boot Record (MBR) of a hard disk
(we believe it should be handled by FDISK or other tools).
As of this writing, we do not have a simple solution to reliably
produce a bootable system disk for an NT4/2000/XP system using
the XXCOPY utility.
System Disk Cloning:
Say, you bought a hard disk with an astronomical number of bytes
(at least, it seems that way for now), and you want to install
your new drive as your system disk (Drive C:).
Typically, you would connect the brand new drive to the EIDE
port (either as the primary port's slave or the secondary port's
master or slave --- whichever is available on your computer).
Most new disk drives have the jumper setting printed on the top
cover of the drive (the selection involves only master/slave).
The overall procedure goes like this: first, you connect the
new drive and assign a temporary drive letter to it. Then, copy
the contents of the current Drive C: to the new drive's volume.
Usually, the new drive has more capacity than the old one.
Therefore, you can copy the entire C: drive to the new drive
and still you will have much free space. After the files are
copied from the old drive to the new one, you will remove the
old drive and place the new one as Drive C:. It is quite
straightforward. Here, I assume your new drive will be
temporarily assigned as Drive D:.
Summarizing this, the sequence is as follows:
. connect the new drive as D:
. FDISK (initialize a partition)
. FORMAT D: (init volume for file access)
. XXCOPY C:\ D:\ /CLONE (copy all the files)
. connect the new drive as C:
. FDISK (set active partition)
Now, let me go over the sequence, step-by-step with more details.
If you have a printer, you may make a hard copy which will be
handy for a beginner.
In this article, the main drive is assumed to be C: and the
Windows directory is located at C:\Windows. If your settings
are different, make necessary adjustments in the commands shown
in this article.
How to create a DOS Box
XXCOPY is a console application which is most
conveniently launched from a DOS Box in Win9x.
If you don't have an icon handy for DOS Box on desktop,
you may create one by Right-click at an empty point in
the desktop and click New > Shortcut. Then, type in
the box labeld Command line [ command.com ] and
click [ Next ] and then click [ Finish ].
Now, you will find an icon labeld "MS-DOS Prompt".
Or, you may create a DOS Box directly by starting
at the taskbar, click [ Start ] and click [ Run...].
Then type in the box labeld Open [ command.com ] and
click [ OK ].
0. Clean up the system disk
Before you start the disk cloning operation, it is best if
you clean up the original disk. It is highly recommended
that you run the SCANDISK utility. Since some long-named
files/directories are not reachable in DOS, you should run
SCANDISK in the Win32 environment (the regular Windows 9X/NT/2K).
Perform any additional cleaning up on the drive to remove
garbage files which include the files generated by SCANDISK
for retrieved data (check the root directory for names like
FILE0000.CHK). This is an ideal time to throw away other
junk. Don't forget to empty the Recycle Bin at the end.
1. Making the system diskette
The next hard disk preparation steps (FDISK and FORMAT) may
be carried out either in a DOS box of Windows or in the
real-mode DOS. Since you need to boot the system from a
diskette at least once (to run FDISK), it is usually faster
if you perform the initial FDISK and FORMAT operations in
the real-mode (DOS) environment created by the system diskette.
If you have a Win9x boot diskette, you may skip this step.
But, the boot diskette which you create using this method
will take considerably less time to initialize the DOS
environment (without the access to the CD-ROM but you don't
need CD-ROM for this) than with the Win9x boot diskette.
In a DOS Box, run the following commands to prepare a system
diskette for the bootup, FDISK and FORMAT operations.
FORMAT A: /S
COPY C:\WINDOWS\COMMAND\FDISK.EXE A:\
COPY C:\WINDOWS\COMMAND\FORMAT.COM A:\
COPY C:\WINDOWS\COMMAND\SYS.COM A:\
Note: In Windows ME, you have to run the "FORMAT" command
without the /S switch which is no longer supported.
Therefore, you need to run the following commands by
hand from a DOS Box to achieve the same result.
COPY C:\WINDOWS\COMMAND\EBD\IO.SYS A:\
COPY C:\WINDOWS\COMMAND\EBD\COMMAND.COM A:\
COPY C:\WINDOWS\COMMAND\FDISK.EXE A:\
COPY C:\WINDOWS\COMMAND\FORMAT.COM A:\
COPY C:\WINDOWS\COMMAND\SYS.COM A:\
Since you have plenty of room in the diskette, you may
copy a few basic tools (we do not use any of them in this
procedure). If you don't know how to use them, skip this.
EDIT.COM (or your favorite text editor)
2. Attach the new disk as Drive D:
Once you have a system diskette which can boot up the
system, you can shut down the system now.
If you have not attached the new disk drive, now is
the time to connect it as a non-boot disk by leaving
the current system disk (Drive C:) as it is. We assume
your new drive is the 2nd drive (referred to as
Drive 2 by FDISK).
There is an well-written site which shows this step with
good illustrations at Adding a 2nd Hard Drive.
3. Initialize the new disk partition (FDISK)
Power up the system and boot up using the system diskette.
From the command prompt of DOS, run FDISK.EXE by typing:
After confirming that you go along with the "Large Disk Support",
Select choice 5 (Change current fixed disk drive), and enter
the correct "Disk Drive Number". After making the new drive
the current disk drive, select choice 1 (Create DOS partition
or Logical DOS Drive). You now specify the space you allocate
for the new partition (most people select 100%). Exit FDISK.
4. Initialize the new volume (FORMAT)
After the new drive's partition is intialized by FDISK,
reboot the system using the system diskette which you made in
Step 1. The next step is to format the new partition which
can be done either in Windows' DOS Box or in the real DOS. But,
here we choose to boot up the system using the newly created
diskette since it verifies that the diskette really works
before we remove the current bootable hard disk. Also, it
is a bit faster.
The diskette-reboot will lead you to a DOS prompt at A:\>.
Before formatting the disk, you should check if the drive
letter is right (you don't want to format the other drive).
The system should complain by saying:
Invalid media type reading drive D
Abort, Retry, Fail?
This is exactly what you want with the partition which was
just initialized by FDISK, but has not been formatted. If you
see any other message, you should run FDISK, select 5
(Change current fixed disk drive) in the main menu, and
examine the overview of the disk partitions. The listing
conveniently displays both the disk number (1, 2, etc.)
and the drive letter assigned to the various partitions.
Type ESC a few times to exit the FDISK utility.
Once you are sure of the drive letter, run the next command.
This time, it may take some time (depending on the capacity
of the drive) while the sectors are verified for read/write
operations. Before the FORMAT command finishes its job,
it will prompt you to enter the volume name. You may enter
any name (up to 11 characters). I urge you to name it
something rather than leaving it blank.
Once the volume is formatted, you may access the drive now.
Just type the following command in a DOS Box.
If you see lines like this, then it is good.
Volume in drive D is XXXXXXXXX
Volume Serial Number is 1234-5678
Directory of D:\
5. Reboot after format (back to Windows 9x)
Although it is possible to enter Windows from this
environment (provided that you installed HIMEM.SYS),
we do not recommend doing so at this point. Remove
the system diskette from the floppy drive and reboot
the system and enter the regular Windows environment.
If you were preparing the new partition inside a
DOS Box, rather than in real-mode DOS, you could
access the volume and proceed to the next step
(XXCOPY /CLONE), but you should still reboot now.
Because after a volume is formatted, it remains
in the so-called "MS-DOS compatibility mode" where
the disk I/O cache is disabled. Without a reboot
after a format, file access to the volume will be
extremely slow --- the XXCOPY action would take
literally hours rather than minutes without reboot!
6. Duplicate the volume (XXCOPY /CLONE)
Once you have prepared the new disk with FDISK and FORMAT,
you are ready to run the centerpiece of this procedure.
This step is the most important operation in the entire
procedure. You must be in the Win32 environment, that is
you must enter the Windows' GUI world (not booting into
the "Command Prompt Only" (real mode, DOS) environment.
Then, open up a DOS Box. When you have followed the standard
XXCOPY installation procedure, XXCOPY.EXE should be present at
the \Windows\command directory so that XXCOPY is the "path".
Run the following command from a DOS Box.
XXCOPY C:\ D:\ /CLONE
The /CLONE switch looks deceptively simple. But,
it is actually a combination of eight distinct
switches. Much of XXCOPY's flexibility comes from
combining a variety of switches. This particular
case is equivalent to the following command.
XXCOPY C:\ D:\ /ks/h/e/r/q/y/bi/zy/ze
/ks ; keeps source files' attributes exactly
/h ; copies hidden and system files
/e ; copies subdirectories (including empty ones)
/r ; overwrites read-only files if such files exist
/q ; suppresses display of skipped file in backup
/y ; overwrites existing files without prompt
/bi ; backs up incrementally (skips identical files)
/zy ; deletes extra files in destination if present
/ze ; disables XXCOPY's use of Envrionment variables
The XXCOPY operation takes anywhere from 10 minutes to
over several hours, depending on the amount of data you
transfer (typically 2-15 GB/hr)..
7. While XXCOPY /CLONE is in progress...
When XXCOPY is carrying out the clone operation, you don't
have to sit idle. You may actively use the computer as
usual, browsing the Web, operate a word processor, or use
spreadsheet --- whatever. Just consider the on-going
XXCOPY operation a background task. There may be a few
files which may not be copied the first time due to
file-access contention. That is expected and not a serious
problem at all.
Once the first round of XXCOPY /CLONE operation is over,
finish your foreground work, close all active programs
at this point. Then, run the exactly same command again.
XXCOPY C:\ D:\ /CLONE
The key here is that the /CLONE operation behaves as an
incremental backup (by the virtue of the /BI component).
It compares the source volume and the destination volume
and skips files which already exist in the destination
with the same size and time. The second /CLONE step
should take only a few minutes at most.
You may still observe a few failed copies. The most
notable one in the Win9x system is the virtual memory
swap file (WIN386.SWP). In the case of Win NT4 and
Win 2000, the equivalent file is named PAGEFILE.SYS.
It is safe to ignore these swap files.
You may run the /CLONE command as many times as you like:
XXCOPY C:\ D:\ /CLONE
8. After XXCOPY /CLONE is complete.
When the entire volume has been copied by XXCOPY, you are
ready to remove the old Drive C: and connect the new drive
as your new Drive C:. Shut down your Win9x system now,
and reconfigure your hard disks. You may need to remove
the jumper plug which made it a slave drive. You may also
need to adjust the BIOS setting (Primary/Secondary IDE,
Master/Slave drive parameters). All recent models of
motherboard come with a BIOS which has the AUTO sense mode
which is trouble-free. If you select a manual setting,
you may need to adjust the hard disk paramters.
9. Make the new partition "Active" (FDISK).
Since the new drive is still not bootable, but it has to
be connected as Drive C: since FDISK can activate only the
first disk drive's (Drive C) Primary DOS Partition. So,
we need the system diskette once more to boot the system.
Now, the remaining thing is to make the new drive bootable.
The Master Boot Record (MBR) must contain the partition table
where the Primary DOS partition is set "Active".
Select choice 2 in the first FDISK menu (Set active partition).
When you display Partition Information by choice 4, the main
partition should show Status 'A' (for Active partition).
Pressing the ESC key will terminate the FDISK utility.
10. Make the new drive bootable (FDISK).
The normal FDISK operation you have just performed modifies
the contents of the partition table in the first logical
sector of the drive (MBR). But, the operation does not
change the section of the MBR which contains the bootstrap
program (a very small machine-language program which will
receive control of the system at the very beginning of the
system bootup process). FDISK has a "well known" undocumented
feature which initializes the bootstrap program inside the MBR.
Run the following command line.
Unlike the regular interactive FDISK operation, with the
/MBR switch, it quietly carries out the MBR-initialization
operation. As a matter of fact, it does not say anything.
If you are a bit nervous, visit the following Microsoft site:
Q69013: FISK /MBR Rewrites the Master Boot Record.
Microsoft documents this feature in the article and yet it
calls this feature "undocumented" in the article itself!!!
So, I guess it remains undocumented...
11. Boot to the Windows (DONE)
Remove the system diskette from the floppy drive and
let the system boot from the new Drive C: to windows.
You may just leave the original system disk (now as D:)
for daily backup storage. If you set up a well written
backup batch file script (using XXCOPY of course), you
may use a much smaller disk drive for system drive
12. If the new disk has a difficulty in booting up by itself,
consider running the SYS command. If you follow all of the
steps described above, you need not run the SYS command.
However, if you skipped the format step, the boot sector
may not have proper boot code. Or, if your procedure
is slightly deviated from the above steps in any way, the
boot sector may not have been properly initialized. At any
event, it does not hurt to run this step. From the DOS
prompt using the system disktte, run the following command:
SYS A: C:
This procedure copies IO.SYS, MSDOS.SYS, and COMMAND.COM
from the diskette to the root directory of the C: drive
(which is not necessary) and also re-initializes the
boot sector of the C: drive. (The boot sector is usually
initialized when the volume is formatted.) Now, you can
try rebooting from the hard disk.
Q and A about Disk Cloning:
Q: Can I stay in DOS (real mode) to duplicate the disk using
A: We strongly recommend the use of XXCOPY.EXE (the 32-bit
version which must run under the Win32 environment), as
described in this page. When you stay in the DOS (real mode)
environment, you may not be able to access all the files and
directories in your disk drive. This is due to the fact that
the DOS environment cannot handle a pathname which exceeds
the 80 character limit. Although each long name comes with
its short name (8.3 format) alias, there could still be a
heavily nested, very long path which exceeds the 80-character
limit after converting all of the long directory names into
their short name alias (for the same reason, SCANDISK fails
on certain volume in 16-bit mode).
If all of the files in your drive have a full pathname less
than 80 characters, you can use XXCOPY16 with the /CLONE switch
to create an interim copy of the source disk which can be made
bootable. After you boot into the Win9x environment, you
should convert all of the shortnames in your system disk
into the corresponding longname using the following command
(assuming the D: drive is the original source drive)
XXCOPY D:\ C:\ /S /NL
This procedure lets you restore most of the long filenames.
However, there will be a small number of files and directories
which are made prior to this XXCOPY run (immediately after the
first Win9x initialization). That is, you need to perform
additional procedures by hand to make necessary adjustments.
In short, this procedure is troublesome at best and we don't
recommend it to anyone who asks this question in the first place.
Q: I thought you need to use the /S option when you format the
new hard disk in disk in order to make the drive bootable.
A: It is true that you should take advantage of the /S switch
when you make the boot diskette as
FORMAT A: /S
The bare FORMAT command formats the media (which tests the
sectors and initializes the FAT and the root directory).
With the /S switch, it performs additional file copy
operation. (COMMAND.COM, IO.SYS, MSDOS.SYS, and DRVSPACE.BIN).
Since the XXCOPY /CLONE procedure copies these system files
anyway (provided that the source volume contains these files),
it is redundant to run "FORMAT D:" with the /S switch when
you initialize the new hard disk (it does not hurt though).
Q: I did not find the "SYS" command in the sequence you showed.
Why can you skip this step?
A: The SYS command performs the equivalent of the "/S" switch
in the FORMAT command. For the same reason mentioned above,
you can skip the SYS command when you run XXCOPY /CLONE.
Some people believe that the SYS command initializes the
MBR (see below) to make the drive bootable. This is not
correct. The MBR is usually managed by FDISK. Not by
FORMAT or SYS utilities. (Also, see Step 12.)
Q: In which steps does the Master Boot Record (MBR) of the new
A: If you follow the step-by-step instructions described in
this page, you should notice that you use the FDISK utility
three times. The first time, you will initialize the primary
partition of the new drive. At that time, the drive is
tentatively assigned as a non-bootable drive (e.g., D:).
Unfortunately, FDISK does not allow you to make the primary
DOS partition of the new disk "Active". For some reason,
FDISK sets only the first drive's (C:) primary partition
"active". That is why in the above procedure, you need to
boot up the system using the boot diskette. In your second
invocation of FDISK, you make the primary DOS partition
"Active". Then, the the third time with the FDISK /MBR
switch, the bootstrap section of the MBR is initalized.
Q: Can you write (or read) the MBR using XXCOPY?
A: No. XXCOPY does *NOT* touch the MBR block which is the
very first logical sector of the volume. It contains both
the partition information and the system initialization
code (a very tightly written machine language program).
We strongly believe that a "well-behaving" program such
as XXCOPY must not touch the area of the disk which is
handled by specialized tools. In this case, FDISk is the
official utility whose only job is to manage the contents
of MBR. Microsoft's utilities FDISK and FORMAT have never
been combined to be just one simple utility for this very
reason. In the future we may make add a MBR backup
feature. But, it is a dangerous operation at best.
Of course, we all know how bad Microsoft's FDISK design is.
But, it gets the job done..
For more on cloning, see XXTB #20.
Click the download file (the line below) when you are ready.
© Copyright 2014 Pixelab All rights reserved.