Recent Changes - Search:

Recently Written

News

edit SideBar

Disk Partitioning, Erasing & Multiboot

1.  About

This document shows you how to partition a hard disk before you can install DOS on it, how to securely erase data from a hard disk, and how to install multiple OS’es on 1 PC.

2.  Partitioning

Before you can use a hard disk and install DOS (or anything else) on it, you need to partition it - create at least 1 partition, however it is strongly recommended to create at least 2 of them - so you can install multiple OS’es, backup your data while installing an OS and defrag/wipe/fix them independently. The traditional program for doing this is called FDISK. FDISK’s from MS-DOS 6.22 and below as well as from old closed/open DR-DOS are not very usable by now because of size limitations (cca 7.8 GiB , exactly 8′422′686′720 Bytes, 1024(cyl)*255(heads)*63(spt)*512(bps) - less than “ideal” value of 2^33 Bytes ) and lack of FAT32 support (only latest DR-FDISK reportedly has it). The original FDISK is known for its “not very intuitive” design - some of the later replacements do clone “1:1″ this design as well, some try to be better or nicer.

Important thing to note is, that partitions and volume letters are relevant for the OS only (DOS, Windows, Linux (but no letters)), BIOS doesn’t care about partitions. If you see something like “A,C,CDROM” “C,A,CDROM” “D,A,CDROM” in BIOS settings, then this is confusing and simply wrong, should be “FD0″ instead “A”, “HD0″ instead “C” and “HD1″ instead “D”. To make the confusion even bigger, some tools as well as the BIOS do start hard disk numbering from ZERO, however FDISK and clones do start at 1.

Another potential pitfall is, that DOS recognizes (AKA “mounts”) partitions at boot time only. This means, that whenever you change anything on the partitioning (add, delete, resize, convert a partition), you MUST reboot just after writing the changes, otherwise the result “is a mess” (you can even cause data loss if you try to write). After reboot the volume letters (bad old term: “drive letters”) will get adjusted (FreeDOS will list them), but you may have to run “FORMAT” on all new or changed partitions (otherwise “mess” again), if the partitioning tool didn’t do this work too (FDISK doesn’t, some more advanced replacements do).

We can distinguish 2 types of partitioning programs:

  • Simple: similar functionality to original FDISK, detect, create, and delete partitions, optionally create filesystems inside (no need to run “FORMAT” then), same or different design, optionally a nice GUI. Any partitioning activity results in complete data loss (but NOT secure irrecoverable deletion, see below) in affected partitions.
  • Advanced: allows to resize and move partitions without data loss in them, optionally also split, merge, and convert (especially in the “evil” direction: FAT32 → FAT16, NTFS → FAT32), also check/fix filesystem integrity or defrag them.

Simple like program are for example FreeDOS FDISK (sort of beta/buggy) and XFDISK (better, used in FreeDOS 1.0 distro), both free and open source:

A semi-advanced product is the Partition Resizer by John Lagonikas (Γιάννης Λαγωνίκας in Greek), AKA Zeleps . Latest version is v1.3.4 from 2000-Dec-31.

Project page: http://www.zeleps.com/

Supported:
  • Resizing FAT (16 and 32)
  • Moving partitions of any type

Not supported:

  • Resizing NTFS
  • Converting
  • Swapping / mixing / jumping partitions
  • Splitting / merging
  • Creating and deleting - use FDISK or other simple one ;-)

Advanced products are almost all commercial and not having a DOS version, like “Partition Magic” or “Paragon”. They install from “Windows” only, and some “DOS” files are actually intended to run in “real-mode” of WinME/98, and not as standalone products. An exception is the GParted, Gnome Partition Editor:

Project page : http://gparted.sourceforge.net/

GParted is an industrial-strength package for creating, destroying, resizing, moving, checking and copying partitions, and the filesystems on them. This is useful for creating space for new operating systems, reorganizing disk usage, copying data residing on hard disks and mirroring one partition with another (disk imaging).

It is actually a Linux distro (Live-CD) and has nothing to do with DOS, except you will need it in following situation:

3.  Making space for DOS besides preinstalled Windows

If you buy a new PC, it usually contains one huge (> 200 GiB) HD prepared with Windows 7 pre-installed on one NTFS partition over all the disk size. No space for DOS. What now ? The preferred solution is to erase (see below) the Windows, create new partitions, install DOS first, and, if you really need it, Windows (XP/Vista/7) then. DOS will survive this if you take care (tested with XP only), and will remain bootable. If you can’t or don’t want to delete the Windows, you have a problem. What now ? Resize the NTFS partition, create a FAT one and install DOS. Resizing an existing (and bootable “system”) NTFS partition is very complex task and the only free program to do this is GParted. Download the Live-CD ISO (50 MiB … yeah, Linux), write it to a CD, boot it, and do the job. Alternatively, there is a “combo” CD available here: johnson.tmfc.net/dos/dos-prewin.html with GParted and FreeDOS. Anyway, read the manual provided there how to use the GParted correctly. You can use the bootmanager suggested there or include FreeDOS into boot.ini file.

4.  The new “GUID” partitioning style

(no info yet)

5.  Erasing

5.1  DBAN

The DBAN product allows secure deletion of data from internal harddisks. It can wipe content of single partitions (leaving other partitions intact), or the complete area, making the disk really empty, as it used to be when new.

Project page: http://dban.sourceforge.net/

5.2  QB eraser

German only ?

6.  Multiboot

Frequently it is necessary to install multiple OS’es one one PC. Then the question comes up how to install them without conflicts and how to select which to boot. A good OS should try to tolerate other OS’es and not to create problems here, means to be installable on any partition, place as few files as possible on first primary partition (into C: ), allow to use alternative filenames (for example DCONFIG.SYS instead of CONFIG.SYS, use standard partition types (like FAT rather than NTFS ), etc. Having multiple OS’es besides each other allows for fair productive competition on the OS market and is useful/needed for porting as well.

A tiny problem is, that some OS’es are “very intrusive” - they thoroughly search for hard disks (or other storage media) and partitions on them, and unconditionally mount them all, including those “reserved” for other OS’es. Then they may also write on them in whatever way they consider as “useful” (create a recycle bin, “indexing”, deleting files they consider as “infected”, “fix” what they consider as “broken” (FATplus), …). So you may end up on the DOS partition with multiple recycle bins created (no standard, every OS has own preferences), and your recently compiled DOS binary deleted (false positive). A way to prevent this is to hide partitions in the partition tables (but not very convenient), or to tell the “other OS” what to mount and what not (easy on Linux, not on Windows ?). Some BIOS’es do have a “hide disk” feature (not partition), but it’s useless anyway, as it hides the disk from BIOS INT $13 only, not from OS’es bypassing the BIOS.

There are several solutions for multibooting:

6.1  LILO & GRUB

Linux-based, very generous/complicated. For Linux freaks only. Most Linux’es come with one of them and install it automatically - but later reconfiguring/removing of it can be a problem.

6.2  GRLDR / NTLDR / BOOT.INI / FREELDR.INI

Win XP / Vista / 7 comes with a simple bootloader allowing booting of other OS’es as well ( WOW !!!) - as long as you have a FAT partition for the non-XP OS’es available. The BOOT.INI file itself is always on first primary partition, which can be FAT or NTFS - in both cases multibooting works, but editing the file on NTFS from DOS is a problem. Both EDR-DOS and FreeDOS can be booted this way (if you really need also XP …), also triple-boot XP/EDR-DOS/FreeDOS is possible.

6.3  METAKERN

This is the DOS-based solution for FAT filesystems (maybe Windows on NTFS / Linux on Ext&Co can be booted as well with some additional hacks).

Advantages:
  • DOS-based
  • No need for a hidden/additional partition to store it
  • Very tiny (2…3 KiB)
  • No non-DOS systems needed to install/configure
  • Can also boot the floppy instead of included/installed OS’es (you can deactivate the annoying floppy booting attempt in BIOS settings then)
  • Free, open source, developed and compiled with NASM
Disadvantages:
  • Some manual work needed to set up, no one-click design …
  • Does not know EDR-DOS: boots it correctly, but in the menu you see it as “unknown operating system” )

See shot 4.2 in the Gallery.

How it works:

  • MBR loads PBR.
  • PBR loads METAKERN.SYS file (instead of OS kernel).
  • User selects an OS
  • METAKERN places one of the included bootsectors into memory and starts it, or loads bootsector from the floppy and uses this.
  • Now this bootsector does its job (loads the kernel or presents the user the next stage of OS choice).

7.  Recovery

TestDisk recovery product by cgsecurity , free and open source GNU GPL, can find “lost” partitions and recover damaged partition tables and boot sectors. Has versions for many OS’es, also DOS (compiled with DJGPP, “shared” with ME-based Windows). Project page: cgsecurity.org/wiki/TestDisk .

8.  External resources

9.  See also

Edit - History - Print - Recent Changes - Search
Page last modified on November 05, 2012, at 08:29 AM