Setting up a Hard Disk

There are several reasons why you might want to set up a hard disk, a virus has hopelessly corrupted the system files, some program you've installed has screwed everything up or someone else has been using the disk and has it configured in bizarre and incomprehensible ways. It may even be that the disk is new and has never been used or you want to install a new operating system.

Whatever the reason, the procedures are the same. Once the drive is properly installed,, you have to configure it to accept an operating system. Once it has been configured you can then install the various programs you want to use.

We'll assume a Windows installation although Linux is a better choice in almost every case.

What follows is the hard way. To do it the easy way, Click Here

First you will need to create "Boot Floppy". This will be used to set up the hard disk. Best bet is to find a machine that already has the stuff you need and copy everything to the floppy. The floppy will also have to have the "system files" for the operating system (Windows). These files must be for the same version of the operating system you intend to install on your hard disk.

Bring up Windows on another PC. Open "My Computer" and right-click on the floppy drive icon. Select "format". If the floppy is already formatted it will only need the option, "Copy system files only" checked. Once that little process completes you will have a bootable floppy.

Now go into the Windows directory (or "folder" as they like to call it) and hold down the Ctrl key and left-drag HIMEM.SYS and EM386.EXE to the floppy icon (Obviously you will need to have Windows Explorer open to see both the floppy icon and the Windows files. Now move into the Windows\Command folder and, while holding down the Ctrl key, left-drag the following files to the floppy icon:

FDISK.EXE
FORMAT.COM
MSCDEX.EXE (Since the CD drive isn't recognized in DOS)
EDIT.COM (You may need to change some files)
SYS.COM

You will probably need a CD driver to access it from DOS. Find a PC running Windows 98 and go to the Windows\System folder. Hold down the Ctrl key and left-drag OAKCDROM.SYS to the boot floppy.

This should be enough to set up your hard disk.

Take the floppy, insert it into the machine having the hard disk you want to set up and boot the machine. If the hard disk isn't partitioned or is not partitioned the way you want, run the FDISK program to fix it. If it's a new hard disk and/or very large (6Gb or larger) you should split the disk into several partitions. Each partition acts as an entirely separate hard disk. This means that you can format one without affecting the other(s). The advantage is that, if one gets messed up (usually the boot partition, drive C: since that's where the operating system lives), you can just reformat it without disturbing files and data that is stored on the other partition(s). A Windows98 installation should do fine within a 4Gb partition. Anything much larger is wasted. With FDISK you can configure the how many partitions the hard disk will have and what their sizes will be.

Windows will require that the first partition of the first hard disk is the boot partition (drive C:). This is called the "primary partition". To be able to actually boot from this partition is also has to be set "Active". FDISK will allow you do all of these things. The next partition will be the "extended partition" and it will have all the disk space remaining after you've defined the primary partition. Within the extended partition will be "logical drives". They're called logical because they aren't "real" hard disks but rather pieces of the actual (physical) drive. Each of the logical drives will have a drive letter. The first logical drive will usually be D:, the second E: and so on. The naming scheme can be altered if there are additional physical drives. The way Windows does it is that the first physical disk is C the second is D the third is E and so on. If you have a hard disk and a CD drive, the disk naming will be:
C the first hard disk
D the first CD drive
E the first logical drive on the first hard disk

The more physical disks you have (ZIP, DVD, Writeable CD, etc.) the further down the list the logical drive naming goes.

After the partitioning is set up the way you want it, you will have to format each partition. The first partition, (drive C:) will have to have to have the system files for the operating system you are installing. To get those copied to drive C: you give the /s option to the format command:

format /s c:

This will give you a warning that you can ignore. The C partition will be formatted and the operating system files will be copied to the drive. Once that's finished you can boot using the hard disk. Each logical drive will also have to be formatted but you won't need to use the /s option. After all the partitions are formatted you will have a bootable hard disk with useable partitions.


I've put together a bootdisk for Windows95 and Windows98 where all this stuff is pretty much automated. All the files you need are here and some others besides. To download them:

You may also need a way to unzip the archives These were made in Windows using Winzip version 8 so PKunzip may not work. If not you'll have to find a Windows PC, unzip the files there and then copy those files to a boot floppy. Each zip file will easily fit on one 1.4Mb floppy. The systems files are in the archives themselves so just unzipping them should produce a bootable floppy with all the files you need and the autoexec.bat. What this means is that you unzip the archives to an empty directory. Copy the files to a floppy. Insert the floppy into the PC with the hard disk you want to configure and boot that PC. If all goes well, the batch file will do everything for you. If not, well poopy you'll just have email me

The whole process is accomplished using a batch file. The source for the file is:


@echo off
:top


rem this next line will check to see if this batch has already been run


if exist c:\dos\newdisk.dat goto end


rem next we set up stuff and make some check to see if the disk is ready to
rem use


rem if the file "nul" doesn't exist it's because there is no C:\ and that means
rem that the drive is not partitioned. The "nul" file is a systems file that
rem always exists in every directory. If it's not there it means that the
rem directory does not exist


if not exist c:\nul goto format


rem since we got past the test above, we can see if the drive is formatted.


if not exist c:\command.com goto sys


if not exist c:\dos mkdir c:\dos
if not exist c:\tmp mkdir c:\tmp
copy a:\*.* c:\dos


rem We should back up the init files in case they have anything useful ...


if exist c:\autoexec.bat copy c:\autoexec.bat c:\dos\autoexec.sav
if exist c:\config.sys copy c:\config.sys c:\dos\config.sav


rem Here we're going to create the CONFIG.SYS file for the next boot


echo device=c:\dos\himem.sys > c:\config.sys
echo dos high,umb >> c:\config.sys
echo device=c:\dos\emm386.exe /noems >> c:\config.sys
echo lastdrive=z >> c:\config.sys
echo shell=command.com /e:1024 /p >> c:\config.sys
echo devicehigh=c:\dos\oakcdrom.sys /d:mscd001 >> c:\config.sys


rem Here we're going to create the AUOTEXEC.BAT file for the next boot


copy autoexec.bat c:\dos\newdisk.dat


echo @echo off > c:\autoexec.bat
echo lh c:\dos\doskey >> c:\autoexec.bat
echo lh c:\dos\mscdex.exe /d:mscd001 /l:s >> c:\autoexec.bat
echo set prompt=$p$g >> c:\autoexec.bat
echo set path=c:\;c:\dos >> c:\autoexec.bat
echo set glob=c:\dos\glob.exe >> c:\autoexec.bat
echo set tmp=c:\tmp >> c:\autoexec.bat


echo.
echo I'll need to reboot now. The CD drive is drive S: so to install windows
echo type,
echo.
echo s:\setup
echo.
echo after rebooting.
echo.
echo Watch the messages as the system boots. If there are errors or something
echo doesn't load correctly. Let me know ...
echo.
echo To reboot now,
pause
reboot
goto end
:format
echo.
echo The hard disk isn't formatted.
choice /t:n,5 Do you want me to format it
if errorlevel 2 goto help
if errorlevel 1 goto do_it
goto end
:help
echo.
echo The hard disk is apparently not formatted. You should run the FDISK
echo and use option 4 to view the hard disk settings. If the disk shows
echo something like:
echo.
echo.
echo . Display Partition Information
echo.
echo . Current fixed disk drive: 1
echo.
echo . Partition Status Type Volume Label Mbytes System Usage
echo . C: 1 A PRI DOS 8182 FAT32 100%
echo.
echo.
echo This means that the disk is partitioned but may not be formatted.
echo.
echo If the column labeled "Status" does not show an "A" then the disk is not
echo bootable. Hit ESC and select option 2 to set the active partition.
echo.
echo There should be a Partition C and it should be primary and of type
echo "PRI DOS" The rest of the stuff doesn't matter right now.
echo.
choice /t:n,5 Do you want to run FDISK now ...
if errorlevel 2 goto end
if errorlevel 1 goto fdisk
goto end
:fdisk
echo.
echo Running FDISK
pause
fdisk
echo.
echo I need to reboot now. Leave the floppy in the drive and
pause
reboot
goto end
:do_it
choice /t:n,5 Do you want to format the hard disk now ...
if errorlevel 2 goto end
if errorlevel 1 goto go
goto end
:go
echo.
echo Formatting drive now
pause
format c: /s
goto top
:sys
choice /t:n,5 Do you want to copy the system files to the disk now ...
if errorlevel 2 goto end
if errorlevel 1 sys a: c:
goto top

:end


This should work. If not I leave it you to fix the buggy parts. This file is the AUTOEXEC.BAT file on the floppy. If you boot with the floppy it will run through the stuff in this batch file and you should end up with a newly configured hard disk that's ready to receive the Windows installation.

Top of the Page

These introductory articles were written by W.H. Conner, the Webmaster.
Please do not re-distribute without consent or proper attribution


All of the pages at this site are created and maintained by W.H. Conner, the Webmaster.