│   │   │   │ 
Recovery Console Commands at a glance:

attrib
batch
bootcfg
cd
chdir
chkdsk
cls
copy
del
delete
dir
disable
diskpart
enable
exit
expand
fixboot
fixmbr
format
help
listsvc
logon
map
md
more
mkdir
rd
ren
rename
rmdir
set
systemroot
type
 

 

Recovery Console in Windows XP (Part II)

Topics on this page:

Introduction

Repair boot files: bootcfg, fixboot, fixmbr

Disc management commands: chkdsk, diskpart

(in part III: format and map commands )

 

Introduction

In part I of this article you were shown how to go to the Recovery Console. In this part some of the available commands are shown, especially those useful for repairing system files, disc and the boot sector. I won't cover the simple commands dating from MS-DOS such as attrib, copy, cd, cls, del, dir, exit, md and ren.

The Microsoft KB article 314058 lists the commands with some explanation and I've quoted from it in some places where it differs from or helps to clarify the onscreen help information. If the KB is unavailable for any reason you'll find much the same here. In it you will find details of those command I've not covered here.

 

Repair boot files

They include bootcfg, fixboot and fixmbr and would be very useful if the boot sector, boot.ini or the master boot record is damaged or overwritten by another operating system. If your system cannot boot, check hardware (especially hard disc errors, RAM and mainboard) and also scan for virus in DOS or with a anti-virus CD.

If you have installed Linux on another partition and LILO or GRUB is corrupt you may see LI... during booting and nothing happens even if you press any key on the keyboard. In that case you need to boot with a Linux boot disc and repair LILO or GRUB. If you use the following commands for Windows you would not be able to boot into Linux afterwards.

You should also make a bootable floppy (KB 314079) when your Windows XP is stable and bootable. This floppy can boot all the way to the desktop and is not an MS-DOS startup floppy disc that you can make in Windows Explorer (the MS-DOS disc is taken from Windows ME boot floppy).

 

Bootcfg

This can detect your computer's boot configuration, modify the boot.ini (the boot list file which forms the basis of the multi-boot menu) and redirect the boot loader to another location (fig. 1).

bootcfg options

Fig. 1. Bootcfg options.

 

Fixboot

Fixboot repairs the boot sector (fig. 2). There are no switches. Normally it would be: fixboot c: unless the first system partition is not c or you wish to write the boot sector elsewhere (not recommended in normal circumstances). You should enable boot sector write protection in the BIOS if your mainboard has this feature.

Quote from KB:

fixboot drive name:

Use this command to write the new Windows boot sector code on the system partition. In the command syntax, drive name is the drive letter where the boot sector will be written. This command fixes damage in the Windows boot sector. This command overrides the default of writing to the system boot partition. FIXBOOT is supported only on x86-based computers.

 

fixboot options

Fig. 2. Fixboot syntax.

 

Fixmbr

Fixmbr repairs the master boot record (MBR). Microsoft does not recommend its use to repair boot sector viruses. Quote from KB article:

fixmbr device name

Use this command to repair the master boot record (MBR) of the boot partition. In the command syntax, device name is an optional device name that specifies the device that needs a new MBR. Use this command if a virus has damaged the MBR and Windows cannot start.

WARNING: This command can damage your partition tables if a virus is present or a hardware problem exists. Using this command can result in inaccessible partitions. Microsoft recommends that you run antivirus software before you use this command.

You can obtain the device name from the output of the map command. If you do not specify a device name, the MBR of the boot device is repaired, for example:

fixmbr \device\harddisk2

If FIXMBR detects an invalid or non-standard partition table signature, FIXMBR prompts you for permission before rewriting the MBR. FIXMBR is supported only on x86-based computers.

 

fixmbr syntax

Fig. 3. Fixmbr syntax.

 

Disc Management: chkdsk, diskpart, format

Chkdsk

This is similar to the chkdsk command in the command prompt and requires autochk.exe. It would be useful if you suspect hard disc error and cannot run chkdsk otherwise. There is no /F switch (as in chkdsk in cmd) but you can use the /R switch to recover data from bad sectors (fig. 4). (There is no scandisk in Windows XP.)

Fig. 4. Chkdsk options.

 

Diskpart

This replaces the well known fdisk in previous versions of Windows. Type diskpart and press ENTER. A list showing used and unused space follows (fig. 5, your list may be different). You can follow the instructions to create a partition (if there is unpartitioned space on the hard disc) or delete existing partitions. The command options are (quote from KB article):

diskpart /add /delete device_name drive_name partition_name size

Use this command to manage the partitions on your hard disk volumes. You can use the following options:

/add : Creates a new partition.
/delete : Deletes an existing partition.
device_name : The device name for creating a new partition.
drive_name : A drive-letter-based name, for example D:.
partition_name : The partition-based name for deleting an existing partition.
size : The size of the new partition in megabytes.

You can get the device name from the output of the MAP command, for example, \Device\HardDisk0. You can use the partition name in place of the drive name argument, for example, \Device\HardDisk0\Partition1. If you use no arguments, a user interface for managing your partitions is displayed.

WARNING: Using this command can damage the partition table if the disk has been upgraded to a dynamic disk configuration. Do not modify the structure of dynamic disks unless you are using the Disk Management tool.

 

Note that Windows XP limits FAT32 partition to 32GB by design; if you wish to partition a drive greater than this, either use NTFS, or use fdisk from a Windows ME boot floppy to do it. Your mainboard BIOS also needs to support large drives. For drives greater than 137GB you need Windows XP SP1/1a for 48bit logical block addressing (LBA) support.

Fig. 5. Diskpart list.

 

 

 

Go to TOP

Go to Part 3.

 

Reference

KB 314058 Description of the Windows XP Recovery Console

 

Copyright 2003-2004 by Kilian. All my articles including graphics are provided "as is" without warranties of any kind. I hereby disclaim all warranties with regard to the information provided. In no event shall I be liable for any damage of any kind whatsoever resulting from the information. The articles are provided in good faith and after some degree of verification but they may contain technical or typographical errors. Links to other web resources may be changed at any time and are beyond the control of the author. Articles may be added, removed, edited or improved at any time. No support is provided by the author.

This is not an official support page for any products mentioned. All the products mentioned are trademarks of their companies.

Created 27 Feb 2004; last updated 2 Jul 2004