Dec 142017
Pfdisk compiled with Turbo C for making non-dos partitions. Includes full C source code.
File PFDISKTC.ZIP from The Programmer’s Corner in
Category HD Utilities
Pfdisk compiled with Turbo C for making non-dos partitions. Includes full C source code.
File Name File Size Zip Size Zip Type
MAKE_TCC.BAT 163 126 deflated
PFDISK.DOC 7019 2886 deflated
PFDISK.EXE 17542 10328 deflated
PFDISKAZ.C 18251 5811 deflated
SYSCODES.C 1433 732 deflated
SYSCODES.H 159 118 deflated
SYSDEP.H 698 271 deflated
S_MSDOS.C 3931 1093 deflated
TPCREAD.ME 199 165 deflated

Download File PFDISKTC.ZIP Here

Contents of the PFDISK.DOC file


pfdisk - partition fixed disk

pfdisk device

pfdisk partitions the fixed disk identified as device into (at
most) four parts, each of whichmay be independently loaded with
an operating system. The actual name of devicedepends on the
operating system in use. For ESIX (System V/386) the device
name iseither "/dev/rdsk/0s0" or "/dev/rdsk/1s0". For Minix,
it is "/dev/hd0" or "/dev/hd5". For MS-DOS it is a single digit
(zero or one).

pfdisk reads the hard disk partition table from blockzero of
deviceinto memory and allows the user to examine, modify, or
save the partition table. A regular file may be used instead of
a real devicefor testing purposes, though the devicegeometry
must bespecified manually, andsome systems will requrire a
file-name argument withthe "R"and "W"commands (DOS, ESIX).

The partition table on device is NOT modified unless the write
command(W) is used with no argument.

All pfdisk commands consist of a command word followed by
optional blank-separated command arguments. Note thatonly the
first letter ofa command word is significant (except for "wq"
and "q!"). All command letters are accepted in eitherupper or
lower case. Numeric arguments are specified using C syntax.
Extra argumentsare silently ignored.

The commands are:

?Prints a command summary (help).

1 sys_id first last sys_name
Set thepartition table entry for part one, using:
sys_idas itssystem ID code,first as the lowest num-
bered cylinder it uses,last as the highestnumbered
cylinder it uses, and sys_name(optional) as the system
name (in the menu name table).

2|3|4 sys-id first lastsys-name
Similarto 1 but sets partition two, three, or four,

Release1.3 Last change: Oct 19901


A number
Mark partition number as active(so it will be used for
booting). Ifnumberis zero, no partition will be

G cylinders heads sectors
Inform pfdisk what the geometryof the device is.

IPrint asummaryof the known IDcodes.

LList the partition table. See Output Format below.

QQuit without saving. If the memory copy of the parti-
tion table was modified, a warning will be issued and
the command ignored.

Q!Quit, even if the memory copy of the partition table was
not saved.

R file-name
Read boot sector from file-name (if given) otherwise
read from device.

W file-name
Write boot sector to file-name. (if given) otherwise
write to device.

WQSame as"write"followed by "quit".

#This line is a comment (to be ignored).

Output Format
Here isa sample of theoutput from theL command:

# Partition table on device: /dev/rdsk/0s0
geometry 1222 15 34 (cyls headssectors)
# ID First(cyl) Last(cyl) Name # start,length (sectors)
1 4 0 127 MS-LOSS # 34, 65246
2 129 128 255 Minix # 65280,65280
3 0 0 0 # 0, 0
4 99 256 1220 ESIX # 130560, 492150
# note: last(4): phys=(1023,14,34) logical=(1220,14,34)

This output format is carefullyconstructed so that it may be
saved in a file (by redirecting standard output) and later used
as input (by redirecting standard input). On aUNIX system, one
can save this output using the command:

Release1.3 Last change: Oct 19902


(echo L) | pfdisk device-name >save-file

save-file is a completerecord of the partition table. On a
UNIX system, one could use save-file tore-initialize the parti-
tion table using the command:

(cat save-file ; echo wq) | pfdisk device-name

Consistency of each partition table entry is checked while the
table is listed. Any inconsistencies discovered are reported in
a commentary note as shown above.

Physical vs. Logical
Each partition table entry has both "physical" and a "logical"
fields. The physical fields specify the lowest and highest
cylinder,head,sector combinations to beused inthat partition.
The logical start field has the total numberof sectors which
precedethis partition,and thelogical length fieldhas the
total number of sectors contained in this partition. These
fields should be self consistent unlessthe disk has more than
1024 cylinders.

The physical cylinder fields are only ten-bits wide so the con-
tents are limited to 1023. The logical sector fields are 32 bits
wide and alwaysshow the true logical beginning and length of
the partition.Generally, the physicalstart field is used only
to locate the secondaryboot sector, and the logical start and
length fields are used to actually delimit the partition used by
a particular system.

Partition Names
The Name field in the partitiontable is treated specially if
the bootmenu programis installed inthe primary boot sector.
(See the file bootmenu.doc formore information.) pfdisk can
recognize thename table used by bootmenu and willshow the
actual names present inthat name table. If any other boot pro-
gram is usedthen the Name fieldreflects the result of a
table-lookup ofthe system ID.

If you provide a name when setting any partition entry, the
boot-sector is markedas using a nametable, so that on subse-
quent uses of pfdisk you will see the partitionnames you have

Boot program replacement
You canreplacethe boot program in your boot sector without
affecting thepartition table by using pfdisk asfollows.
First, (as always) savea copy of the current boot sector (on a

Release1.3 Last change: Oct 19903


floppy)using the "W file" command. Then, use the "R file" com-
mand toread the new boot program. If the bootprogramread in
is less than446 bytes long, thepartition table will be

Unlike the DOS or UNIX fdisk programs, pfdisk has NO boot pro-
gram compiledinto its executable image. If you wish to use
pfdisk to partition a newly formatted hard disk, you must have a
boot program image available to read in using the "r file" com-
mand. Two bootprograms, "bootmenu.bin" and "bootauto.bin" are
distributed with pfdisk andshouldbe found with its source
files.See thefile bootmenu.doc for further information about
these boot programs.

Gordon W. Ross

Release1.3 Last change: Oct 19904

 December 14, 2017  Add comments

Leave a Reply