\documentclass{ictlab} \RCS $Revision: 1.0 $ \usepackage{alltt,key} \ifx\pdftexversion\undefined \else \usepackage[pdfpagemode=None,pdfauthor={Nick Urbanik}]{hyperref} \fi \newcommand*{\labTitle}{Repartitioning your hard disk without deleting Windows with the Mighty \texttt{parted}} \begin{document} \section{Aim} \label{sec:aim} Often when you buy a computer, Windows~XP is installed in one partition, with most of that partition being empty. It's a shame to waste that space without installing Linux there. I am asking all of you to install Linux onto your computers at home; if you don't, you won't be able to get enough practice to do well in the laboratory workshops. Those who failed this subject all have one thing in common: they never installed Linux at home. This guide tells you how to repartition your hard disk without losing any of your Windows that you paid for as part of the price of buying the computer. This guide is a guide only, and does not replace the documentation, which you will find at \url{http://www.gnu.org/software/parted/}; you get a summary with \texttt{man parted}. \section{Background} \label{sec:background} There are a number of commercial programs for non-destructive disk partitioning, the most famous being Partition Magic\@. However, there is at least one well-tested alternative that we look at here, called \texttt{parted}. There is a section from \emph{The Official Red Hat Linux Customization Guide} at \url{http://ictlab.tyict.vtc.edu.hk/doc/rhl-cg-en-8.0/ch-disk-storage.html} which describes how to use \texttt{parted}. You can read the user manual for \texttt{parted} at \url{http://www.gnu.org/software/parted/}. \subsection{Warning} \label{sec:warning} Note that I have done this a number of times, always successfully. However, I make no guarantee that it will work for you. If your data is important, back it up first. Note that this will not resize any \NTFS partitions, since Microsoft keep the format of this filesystem highly secret; \texttt{parted} can resize \FAT16 and \FAT32 partitions, and can move the end boundary of \texttt{ext2} or \texttt{ext3} partitions. See the documentation. This document only describes reducing a \FAT partition. If you need to resize an \NTFS partition, you will need to buy some proprietary software, such as \textsf{Partition Magic}\@. \section{Procedure} \label{sec:procedure} \subsection{An overview of the procedure} \label{sec:overview} \begin{enumerate} \item Boot Windows, and run the disk defragmenter program to move all files to the beginning of your partition. \begin{explanation} This process is very slow, and the Microsoft tools provide no fast data movement option. \end{explanation} \item \label{ste:decide}Note how much space your Windows installation requires, and make a decision about how much space to allocate to Linux (as a rough guide, I have $280 \times 2^{20}$ bytes of disk space, and allocate $280 \times 2^{20}$ bytes to Linux, and $0 \times 2^{20}$ bytes to Windows \texttt{:-)} \item boot your computer using the first Red Hat 8.0 installation \CDROM as a rescue boot disk \item run \texttt{parted}; it will give you an interactive prompt. \item display your partition table by typing \texttt{\textbf{print}}. \item shrink the Windows partition to the size you decided on at step~\ref{ste:decide} with the \texttt{resize} command \item create a Linux partition and a swap partition with the \texttt{mkpart} command \item quit the \texttt{parted} program with the \texttt{quit} command \item reboot your machine from the \CDROM and do an installation into the two partitions you just created. \end{enumerate} \subsection{The Details} \label{sec:details} I will not go into details on running the defragmenter. Note that the \textsf{Parted} manual says, \begin{quotation} \textsf{Parted} will always warn you before doing something that is potentially dangerous, unless it's something that's obviosuly dangerous (i.e. \texttt{rm}, \texttt{mklabel}, \texttt{mkfs}). For example, if you attempt to shrink a partition ``too much'' (i.e. by more than the free space available), \textsf{Parted} will automatically resize to the minimum it can without losing data. \end{quotation} \end{document}