| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 | <chapter id="chapter-making-space" xreflabel="Chapter 3"><title>Preparing a new partition</title><?dbhtml filename="chapter03.html" dir="chapter03"?><sect1 id="ch-space-introduction"><title>Introduction</title><?dbhtml filename="introduction.html" dir="chapter03"?><para>In this chapter the partition which will host the LFS system isprepared. We will create the partition itself, make a file system on it,and mount it.</para></sect1><sect1 id="ch-space-creatingpart"><title>Creating a new partition</title><?dbhtml filename="creatingpart.html" dir="chapter03"?><para>In order to build our new Linux system, we will need some space:an empty disk partition. If you don't have a free partition, and no roomon any of your hard disks to make one, then you could build LFS on thesame partition as the one on which your current distribution is installed.This procedure is not recommended for your first LFS install, but if youare short on disk space, and you feel brave, take a look at the hint at<ulink url="&hints-root;lfs_next_to_existing_systems.txt"/>.</para><para>For a minimal system you will need a partition of around 1.2 GB.This is enough to store all the source tarballs and compile all the packages.But if you intend to use the LFS system as your primary Linux system, youwill probably want to install additional software, and will need more spacethan this, probably around 2 or 3 GB.</para><para>As we almost never have enough RAM in our box, it is a good idea touse a small disk partition as swap space -- this space is used by the kernelto store seldom-used data to make room in memory for more urgent stuff.The swap partition for your LFS system can be the same one as for your hostsystem, so you won't have to create another if your host system already usesa swap partition.</para><para>Start a disk partitioning program such as <command>cfdisk</command>or <command>fdisk</command> with an argument naming the hard disk uponwhich the new partition must be created -- for example<filename>/dev/hda</filename> for the primary IDE disk. Create a Linux nativepartition and a swap partition, if needed. Please refer to the man pages of<command>cfdisk</command> or <command>fdisk</command> if you don't yetknow how to use the programs.</para><para>Remember the designation of your new partition -- something like<filename>hda5</filename>. This book will refer to it as the LFS partition.If you (now) also have a swap partition, remember its designation too. Thesenames will later be needed for the <filename>/etc/fstab</filename> file.</para></sect1><sect1 id="ch-space-creatingfs"><title>Creating a file system on the new partition</title><?dbhtml filename="creatingfs.html" dir="chapter03"?><para>Now that we have a blank partition, we can create a file system on it.Most widely used in the Linux world is the second extended file system (ext2),but with the high-capacity hard disks of today the so-called journalingfile systems are becoming increasingly popular. Here we will create an ext2file system, but build instructions for other file systems can be found at<ulink url="&blfs-root;view/stable/postlfs/filesystems.html"/>.</para><para>To create an ext2 file system on the LFS partition run the following:</para><screen><userinput>mke2fs /dev/xxx</userinput></screen><para>Replace <filename>xxx</filename> with the name of the LFS partition(something like <filename>hda5</filename>).</para><para>If you created a (new) swap partition you need to initialize it as aswap partition too (also known as formatting, like you did above with<command>mke2fs</command>) by running:</para><screen><userinput>mkswap /dev/yyy</userinput></screen><para>Replace <filename>yyy</filename> with the name of the swappartition.</para></sect1><sect1 id="ch-space-mounting"><title>Mounting the new partition</title><?dbhtml filename="mounting.html" dir="chapter03"?><para>Now that we've created a file system, we want to be able to accessthe partition. For that, we need to mount it, and have to choose a mountpoint. In this book we assume that the file system is mounted under<filename>/mnt/lfs</filename>, but it doesn't matter what directoryyou choose.</para><para>Choose a mount point and assign it to the LFS environment variableby running:</para><screen><userinput>export LFS=/mnt/lfs</userinput></screen><para>Now create the mount point and mount the LFS file system by running:</para><screen><userinput>mkdir -p $LFSmount /dev/xxx $LFS</userinput></screen><para>Replace <filename>xxx</filename> with the designation of the LFSpartition.</para><para>If you have decided to use multiple partitions for LFS (say one for<filename>/</filename> and another for <filename>/usr</filename>), mountthem like this:</para><screen><userinput>mkdir -p $LFSmount /dev/xxx $LFSmkdir $LFS/usrmount /dev/yyy $LFS/usr</userinput></screen><para>Of course, replace <filename>xxx</filename> and <filename>yyy</filename>with the appropriate partition names.</para><para>You should also ensure that this new partition is not mounted withpermissions that are too restrictive (such as the nosuid, nodev or noatimeoptions). You can run the <command>mount</command> command without anyparameters to see with what options the LFS partition is mounted. Ifyou see nosuid, nodev or noatime, you will need to remount it.</para> <para>Now that we've made ourselves a place to work in, we're ready to downloadthe packages.</para></sect1></chapter>
 |