Jump to content

Reformat NTFS C: drive as FAT32 in DOS


Recommended Posts

Folks,

I've been honing my DOS-based installation CD for some time now, with MSFN's help. I've been wanting to automatically convert my C: drive to NTFS during the install process, but in order to redo the same script, the C: drive would have to start out as a FAT32 volume, so I've left out the auto-convert until now.

Advantages of the DOS-based unattended install model:

  • XP installs out of DOS very well
  • All you need is a 1.44MB boot floppy image (not some large, slow WinPE CD) and CD burning apps support floppy images on bootable CDs.
  • DOS batch commands are common and more familiar to most beginners.
  • DOS allows you to create boot disks with many great DOS utilities and menu systems - other environments are harder to customize.

Back to the topic: If you want to do an unattended XP install on your c: drive out of DOS, it has to be formatted as a volume that DOS can see, namely FAT32. But if you do an autoconvert to NTFS during an install cycle, you don't have that. How can you switch back easily, and still retain your install files and file backups on D:? And do it with tiny, DOS-based, free apps that fit on your floppy image?

This approach is a combination of the standard FDISK and the free AEFDisk utility. Be sure to get the later version of FDISK which can handle big hard disks on Microsoft's Support Page in many languages (or do a google search). All you'll need is the FDISK.EXE program, the AEFDISK.exe app, and the batch file below, on a Win98 boot disk.

First, I am assuming that you have manually converted your C: drive to NTFS or done it automatically during unattended setup (using the following code in your WINNT.SIF file):

[Unattended]
   UnattendMode=FullUnattended
   Repartition=No
   FileSystem=ConvertNTFS      <--- this is the key line you must include

If you want to blow away the C: drive and redo your install out of DOS again, it wouldn't work, because the NTFS volume could not be used. But let's assume you have backed up your files and your install folders onto a D: FAT32 partition (it really does make things easier), and we can be rid of the NTFS volume.

Here's the script to do it (just paste this into a text file and call it formatc.bat or whatever:

@echo off
CLS
ECHO.
ECHO   Deleting primary partition and reformatting as FAT32 ...
ECHO.
ECHO   This mode will keep all files on the D: drive intact.
ECHO.
AEFDisk.exe /DELACTIVE
ECHO.
ECHO   Repartitioning free space, formatting as FAT32 (PC will reboot) ...
AEFDisk.exe /freesize
FDISK 1 /PRI:%FREESIZE% /ACTOK /Q
AEFDisk.exe /formatfat:1:Hard_Disk
AEFDisk.exe /reboot

I'll walk you through what the script does:

Step 1: you call AEFDisk with the /DELACTIVE switch to delete only the active partition (your NTFS C: drive - the extended partition [D: drive] is left alone).

Step 2: You call AEFDisk again with the /FREESIZE switch to save the size of the now unallocated free space (the "hole" left by deleting your C: drive) to a variable (FREESIZE).

Step 3: FDISK is called to re-create a primary partition of size %FREESIZE% (a good explanation of FDISK can be found here: http://fdisk.radified.com/fdisk_partition.htm ). This command skips extended testing of the partition and doesn't reboot when finished

Step 4: call AEFDisk one more time to do a quick format of the new C: drive and assign it a name Hard_Disk (spaces are not allowed in the command, to my knowledge). AEFDisk then reboots the PC so that the new partition can be used by DOS.

This script will work with any primary partition, but it's best suited for drives with both a primary and extended/logical partition. I've not tested it on every drive configuration, so you should test this on your own rigs to be sure.

UPDATE: One thing you should watch - if you are working with Dell PCs, they typically have a 31MB diagnostic partition which is partition 1, so if you have such a thing, you just need to change the format command to AEFDisk.exe /formatfat:2:Hard_Disk since the primary partition will be #2 instead of #1.

Happy formatting,

JP

Link to comment
Share on other sites


  • 3 weeks later...

I am trying to use AEFDISK to format the Disk with NTFS, But I cant seem to do it.

I tried modifying your batch (see below) but it doesnt appear to format NTFS partitions properly. After partition creation, I start XP install which soon requires a refomat.

I have been using System Commander for disk re-sizing and usch for years, but I need something that can be integrated into a totally unattended Install.

ANY IDEAS PLEASE HELP?

@echo off

CLS

Echo AEFdisk

Echo

ECHO.

ECHO Deleting primary partition ...

ECHO.

ECHO This mode will keep all files on the D: drive intact.

ECHO.

AEFDisk.exe /DELACTIVE

ECHO.

ECHO Repartitioning free space, formatting (PC will reboot) ...

Echo.

AEFDisk /freesize

aefdisk 1 /pri:%freesize%:7

Aefdisk 1 /mbr

AEFDISK 1 /sort

echo.

aefdisk 1 /show

pause

AEFDisk.exe /reboot

Link to comment
Share on other sites

The fdisk included in winXP... Is that the best version to use it with???

it would be very handy, because my unattended install via networkshare is hanging up constantly, and after that i need to reformat the drive otherwise the setup won't start...

Link to comment
Share on other sites

Hi folks,

Actually, one of the limitations I ran into with the FDISK I referred to above is that it cannot create a partition above 64GB. So I've learned to use AEFDISK to create my partitions instead of FDISK.

The code is like this (this example will create a 120000MB C: and 40000MB D:, format them both FAT32, and auto-reboot to use the new drives):

AEFDISK 1 /pri:120000:0C /ext:40000 /log:40000:0B

AEFDisk.exe /formatfat:1:Hard_Disk

AEFDisk.exe /formatfat:5:D_Drive /reboot

The code after the size is the drive type. The 0C (zero, not O) is used instead of 0B for FAT32 large volumes (crossing the 1024 cylinder boundary, according to AEFDISK). 0B will work fine for smaller drives.

If you're looking to format as NTFS or whatever, the readme for AEFDISK has a complete list of drive types. Just use the first two letters from the code. Since I start everything in DOS, I have to use FAT32 at first, but my WINNT.SIF auto-converts to NTFS during (actually, before) the install, so that might work for you fine if nothing else does.

JP

Link to comment
Share on other sites

  • 9 months later...

I have a problem:

After the first phase of the setup, where the installer copies the files to the c: partition went fine, then asked me to remove any floppies and restart the comp. I restart it, setup comes in, and after the "press f6 to xxx" part, it stops the installation with the following error:

(I translated it from hungarian so maybe it's not 100% correct)

The following file cannot be found: \$WIN_NT.~BT\VGA852.FON

(ERROR CODE: 14.)

The setup cannot continue with the installation, press any key to reboot.

I get this right away, so I think it can't even find the first file. (<- proven not to be true)

Could someone help me quick please? I'm sitting there with a knoppix livecd and no xp install cd.

EDIT:

I went further... I copied the .fon file manually, then it needed another file, a keyboard dll. (kbdhu.dll) I copied that too, and found out that I have to put an entry into the txtsetup.sif file too. Now I can actually begin the setup, but it cannot find a _lot_ of files, but at least I can skip them, but the installed xp doesn't work this way. I have no clue why the hell it cannot find these files, I give up.

/me goes and looks for his xp cd.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...