Last Friday I used tomsrtbt to delete an unused partition and grow 
another partition using the newly freed space.  Since many people 
on this list have expressed an interest in using tomsrtbt to copy 
partitions, I thought I would share my experience with a different 
kind of partition problem.

Background:  A year ago I split an active Windows 95 partition in 
two using the freeware utility 'fips'.  One half continued to run 
Windows 95; the other was reformatted and repartitioned to run 
Linux.  After a year it became apparent that 1) the Windows 95 
partition was running out of space and 2) the linux partition was not 
being used.

The problem:  How to combine the two partitions back into a single 
Windows 95 partition, without disturbing the existing Windows 95 
data?

The solution:  

I carefully read the fips documentation to get an idea of how fips 
splits partitions.  I concluded that apart from obvious changes to 
the partition table, fips merely changes the total sector count in the 
Dos Boot Record (DBR) to match that of the new partition table 
entry and leaves the FAT (file allocation table) alone.  Apparently 
DOS simply ignores FAT entries which point to clusters beyond 
the end of its data area.

I then consulted Scott Mueller's excellent *Upgrading and Repairing 
PCs* in order to determine the layout of the partition table and dos 
boot record data structures.  As a concession to my paranoia, I 
verified that the existing FAT was the right size for the entire disk 
drive  and conversely was larger than necessary for the existing 
partition.

As further insurance against disaster, I used netcat to make a 
complete byte for byte copy of the disk drive onto a machine with a 
large disk drive.  I described my method for doing this is in an 
earlier posting.

Using tomshexd, the hexdump utility supplied with tomsrtbt, 
hexadecimal dumps of the partition table and dos boot record were 
printed as well as saved to diskette.

I then deleted all the partitions (yes, including the active Win95 
partition!) using fdisk and created a single partition spanning the 
entire drive.  The Partition Id was changed to '6' (DOS 16-bit >= 32 
M) and the boot flag enabled for the new partition.

Scott's book in hand, I used tomshexd to look at the new partition 
table.  The total number of sectors contained by the new partition 
were determined and then written down.

Using the vi supplied on tomsrtbt, I then edited the hex dump of the 
dos boot record, replacing the total sector count with the count 
listed in the new partition table.  The -o option of tomshexd was 
used to create a binary image of the boot record which was written 
out to disk using dd.

The computer was booted up in Windows. I checked the capacity 
of the drive:  the new disk space was there!  A scandisk was done 
and no errors were found.  New Windows software was installed 
without incident and the computer has worked without a problem 
since then.

I was struck once again by the ease with which tomsrtbt handled a 
project which otherwise would have required expensive proprietary 
tools.  Having successfully merged partitions, I am curious to hear 
other ways that people have used tomsrtbt to manipulate partitions. 
 
Does anybody have any experiences in this area they'd care to 
share?

Reply via email to