% Linux Installation and Getting Started    -*- TeX -*-
% repartition.tex
% Copyright (c) 1992-1994 by Matt Welsh <mdw@sunsite.unc.edu>
%
% This file is freely redistributable, but you must preserve this copyright 
% notice on all copies, and it must be distributed only as part of "Linux 
% Installation and Getting Started". This file's use is covered by the 
% copyright for the entire document, in the file "copyright.tex".

\subsection{Repartitioning your drives}
\namedlabel{sec-install-linux-prep-repartition}{Repartitioning your drives}
\namedlabel{sec-install-prep-repartition}{Repartitioning your drives}

\index{installation!repartitioning|(}
\index{repartitioning|(}

In this section, we'll describe how to resize your current partitions
(if any) to make space for Linux. If you are installing Linux on a 
``clean'' hard drive, you can skip this section and proceed to
Section~\ref{sec-install-installing-top}, below.

The usual way to resize an existing partition is to delete it (thus destroying 
all of the data on that partition) and recreate it. Before repartitioning
your drives, {\em backup your system}. After resizing the partitions, you
can reinstall your original software from the backup.
However, there are several programs available
for MS-DOS which are able to resize partitions nondestructively. One of
these is known as ``{\tt FIPS}'', and can be found on many Linux FTP
sites. 
\index{repartitioning!FIPS@{\tt FIPS}}
\index{FIPS@{\tt FIPS}}

Also, keep in mind that because you'll be shrinking your original 
partitions, you may not have space to reinstall everything. In this case,
you need to delete enough unwanted software to allow the rest to fit on
the smaller partitions.

The program used to repartition is known as {\tt fdisk}. Each operating
system has its own analogue of this program; for example, under 
MS-DOS, it 
is invoked with the {\tt FDISK} command. You should consult your documentation
for whatever operating systems you are currently running for information
on repartitioning. Here, we'll discuss how to resize
partitions for MS-DOS using {\tt FDISK}, but this information should be easily
extrapolated to other operating systems.
\index{fdisk@{\tt fdisk}}
\index{repartitioning!fdisk@{\tt fdisk}}
\index{partitions!fdisk@{\tt fdisk}}

{\em Please\/} consult the documentation for your current operating systems 
before repartitioning your drive. This section is meant to be a general 
overview of the process; there are many subtleties that we do not cover here. 
You can lose all of the software on your system if you do not 
repartition the drive correctly.

A warning: Do not modify or create partitions for any other operating systems
(including Linux) using {\tt FDISK} under MS-DOS. You should
only modify partitions for a particular operating system with the version of
{\tt fdisk} included with that operating system; for example, you will create
Linux partitions using a version of {\tt fdisk} for Linux. Later, in
Section~\ref{sec-install-linux-fdisk}, we describe how to create
Linux partitions, but for now we are concerned with resizing your current
ones.

Let's say that you have a single hard drive on your system, currently 
devoted entirely to MS-DOS. Hence, your drive consists of a single 
MS-DOS partition, commonly known as ``{\tt C:}''. Because this repartitioning
method will destroy the data on that partition, you need to create a bootable
MS-DOS ``system disk'' which contains everything necessary to run {\tt FDISK} 
and restore the software from backup after the repartitioning is complete.
\index{fdisk@{\tt fdisk}!under MS-DOS}
\index{MS-DOS!repartitioning}
\index{repartitioning!fdisk@{\tt fdisk}!under MS-DOS}

In many cases, you can use the MS-DOS installation disks for this purpose.
However, if you need to create your own system disk, format a floppy with the
command
\begin{tscreen}
FORMAT /s A:
\end{tscreen}
Copy onto this floppy all of the necessary MS-DOS utilities (usually most
of the software in the directory {\tt \verb+\+DOS} on your drive), 
as well as the programs {\tt FORMAT.COM} and {\tt FDISK.EXE}. You should now
be able to boot this floppy, and run the command
\begin{tscreen}
FDISK C:
\end{tscreen}
to start up {\tt FDISK}.

Use of {\tt FDISK} should be self-explanatory, but consult the MS-DOS
documentation for details. When you start {\tt FDISK}, use the menu
option to display the partition table, and {\em write down\/} the
information displayed there. It is important to keep a record of your
original setup in case you want to back out of the Linux installation.

To delete an existing partition, choose the {\tt FDISK} menu option 
``{\tt Delete an MS-DOS Partition or Logical DOS Drive}''.
Specify the type of partition that you wish to delete (primary, extended, or
logical) and the number of the partition. Verify all of the warnings. Poof!

To create a new (smaller) partition for MS-DOS, just choose the {\tt FDISK}
option ``{\tt Create an MS-DOS Partition or Logical DOS Drive}''. Specify
the type of partition (primary, extended, or logical), and the size of the
partition to create (specified in megabytes). {\tt FDISK} should
create the partition and you're ready to roll. 

After you're done using {\tt FDISK}, you should exit the program and reformat
any new partitions. For example, if you resized the first DOS partition on
your drive ({\tt C:}) you should run the command
\begin{tscreen}
FORMAT /s C:
\end{tscreen}
You may now reinstall your original software from backup.


\index{installation!repartitioning|)}
\index{repartitioning|)}
