Partition Table Tiny Editor (PTTE)


Copyright (C) 2010 Ton Daas
PTTE is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License,
or any later version.

PTTE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see www.gnu.org/licenses.

1. Introduction

PTTE is a utility to create or edit classic partition tables on disk. It is thereby a replacement for FDISK, as was included with every DOS version. It is however DOS version independent and supports also recent techniques. It can therefore be used on an ancient IBM PC-5150 from 1980 with Intel 8088, CGA video, HDA and 10 MB disk as well as on the most advanced multicore 64 bit processor with SATA, 2 TB LBA, AF and SSD. It will assist in aligning partitions the clasic CHS style, but also for optimal performance on 'Advanced Format' (AF and SSD) disks with 4K physical sectors. It recognizes GPT but does not allow nor support editing. However reinitializing the disk with MBR is still possible.

Because of its size (only 6 KB) and compatibility it is perfectly suited to use under PC-DOS 1.1 with T0-DOS (see my website). It makes it possible to edit partitions on the system disk(s) without the need of diskette, CD or USB stick, as if it were an extension of BIOS.

By means of a full-screen menu with overview of the disk content, partitions can be adjusted in full detail. Changes can be prepared without any change to the disk content. When satisfied with all changes prepared, a push on "Apply changes" will finally apply all these changes to disk. As the program works at sector level and shows recognizable content of volume boot sector, it can also help to repair or recreate damaged or lost partition tables.

Many beautifull partitioning programs exist and are perfectly suited to rearange your disk content, but require Windows or Linux. They are however useless until an operating system is installed. The installation process of e.g. Windows on an empty disk, however will use more space and create more partitions then desired for a multiboot system. It is therefore advisable to partition the disk before installing opererating systems. The OS will then be forced to only use the user designated space. PTTE is for that task perfectly suited.

I purposely left out format routines, as it would require a considerable larger progam with questionable functionality. There exist many different partition types with their own OS, which are also different in format version depending on the OS version. Each OS brand also requires different boot code in the primairy partition. It is therefor best to do the formatting during installation of that specific operating system. Logical volumes can more easily be formatted later by the installed system.

Starting PTTE

To be fully compatible with all DOS versions, there are 2 versions of the program available, PTTE1 and PTTE. PTTE1 reads or writes the backup file the DOS 1 way, while PTTE does it the DOS 2 way. The first handles the backup file by FCB, which is unaware of subdirectories, while the second uses a file handle, which is subdirectory aware. (under DOS 1 PTTE will produce an error when a backup file is specified). FCB support was dropped by Microsoft starting with MS-DOS version 7. IBM PC-DOS and FreeDOS support both methods in all their versions and work fine with either version. Apart from that, both programs are identical in operation.

Command syntax: PTTE[1] [filespec [/R|/I]] [/#]
were

MBR boot code

PTTE itself does not have this code. It will however use the current bootcode by default. When using it for a new install the bootcode should be provided by using 'filespec /I' on the command line. It is advisable to make a backup of your old bootcode, before replacing it. It makes it possible to re-install it when conflicts should occur.
Along with this package, a separate file named TBOOT.MBR (Source listing) is included. This bootcode may be used for new installations and is compatible with all known (DOS, Windows, Linux) operating systems.

You can also use the multiboot TBOOTMGR.MBR, which is included in the TBOOTMGR package. See my website for a full desciption of Tiny Boot Manager.

EBR boot code

Like most partition managers, PTTE leaves the boot code area in EBRs empty (filled with 0), as they normally are never booted. TBOOTMGR and T0DOS however have the possibility to also boot from a logical volume. This requires code in the primairy extended partition, which is inserted with their installation programs. When editing the partition tables however, this code can get lost, which may result in a failure to boot such volume. If you make use of this feature, re-inserting just this code can resolve it and can be accomplished with the installation programs TBOOTMGR or T0FORMAT /B.

The Menu

After starting PTTE, a screen will show the characteristics of the disk and its content. If started with the /I option then an empty disk is shown. The first row (MBR) in the list shows the total size and if LBA is supported. The next rows will show the current partitions and empty spaces. The list can stretch beond window boundaries, but with the navigation keys the complete list can be accessed.
If the disk is already partitioned in GPT, then all edit functions are disabled. The disk can then only be repartitioned in MBR with the /I command option.

Each row starts with the space type 'Pri' for primairy or 'Log' for logical space. If a partition occupies the space row, the table index is shown with status of the active flag. '1' to '4' for primairy, '1' to '16' for logical volumes and 'a' to 'p' for partition table logical extensions. They are numbered in the sequency they apear in the MBR partition table or EBR chain. The program allows handling maximal 16 logical volumes. Fields ID, first sector, size and last sector in LBA and CHS are show in hexadecimal notation. This makes 4K alignment easily recognizable as sector values should always end with '0' or '8'. Below the list, information is shown about the selected space like partition type for known ID's and relevant information from subject boot sector. It shows the boot signature of the first sector or '????' in red if an error occurred on reading it. If the signature is valid, information is displayed from the Bios Parameter Block (BPB). This makes it possible to find an already formatted volume to allow you rejoining it in the table.

Key use

Arrow keys 'Left', 'Right', 'Up', 'Down':
are used to navigate throug the list.
'Spacebar', 'BackSpace':
With these keys a subselection of the selected number is made. This will allow a number to be incremented or decremented by 16^n.
Insert key ('Ins' with(out) 'Caps', 'CapsLock' (with focus on index field):
If the row specifies enough unused space, a partition will be inserted. If in primairy space, an arbitrairy size of 1/4 disk will be assigned. If in logical space, all available space will be assigned.
Normally (without Caps/CapsLock) clasical alignment to cylinder/track will be used. For AF or SSD (Caps/CapsLock+Ins) 4 KB alignment is used. The new ID will be FAT corresponding with size and first sector.
Of primairy partitions, Index, ID, First, Last and Size can then be adjusted to your preference. A restriction is that only one primairy can be designated as extended partition. Logical partitions have more constrains to allow edit. Volume ID can still be changed but first sector and size can not be changed.
Tip! To still create logical partitions of desired space do the following:
After inserting a primairy partition and changing its type to extended, you should adjust its first sector and size to your desire for the first logical volume. Then you can insert the volume which will use all this space. If you want a second (third or more) logical, increase the size at front or end of the primairy extended to create the desired free logical space there. Then insert in it a logical extended and volume, etc.

Warning: Althoug legitimate and not against any rule to have logical partitions not in physical sequence, to be compatible with other partition managers (like FDISK, PART and GPARTED), you are advised to assign logical partitions with PTTE preferably also in physical sequence.
'Del' key:
(with focus on index field) This will remove the selected partition from the list. Extended partitions can only be removed if no entries.
'+', '-' keys:
These will allow to increment or decrement a (sub)selected value. Although some checks are performed on known types, it is your responsibility if all adjustments are valid. E.g. An ID of 1 can be assigned to a partition above 32MB LBA or with size >32 MB, but is useless as it can not be formatted.
'A' key (with focus on index field of primairy partition):
This will set or unset the active flag. Since only one partition may be active, this might clear this flag from an other partition. It is perfectly legal to have no active partition. My bootmanagers TBOOTMGR and T0DOS make use of this to show a boot section prompt instead.
'H' key (with focus on ID field of a partition):
If the type has a hidden equivalent the partition can be toggled hidden or unhidden. This option is especially usefull in a multiboot environment to prevent operating systems to assign conflicting drive letter assigments.
'I' key (with focus on index field of a volume):
This allows you to clear the bootsector of that volume, to prevent operating systems to misinterpret its content, but still to allow a drive letter assigned for a format program to reformat that volume.
'Apply changes' (F10) key:
With this key all prepared changes are applied to disk. The changes are marked far right in the list with a yellow '*'. It will all be changes to the only or single boot sector of that row.
'Esc' key:
This will terminate the program. When no changes were applied with 'Apply changes', it will leave the disk untouched.

DiskInfo

Syntax: DISKINFO [/#] [>filespec]
where # is disk nr. and filespec redirected output

A small DOS utility included with this package. It will only output to screen the disk details and partition list. Output can be redirected to printer or file for reference.

For further information, questions, suggestions, comments or bugs regarding this software, feel free to contact me at >ton@­daas.info<.