Выбрать главу

If you want to partition a hard drive already using an existing Linux system, you can attach the hard drive to a spare IDE channel, and then use the Linux fdisk or GNU parted partitioning utilities. Both utilities offer a way to interactively partition and prepare storage media. Linux recognizes IDE hard drives using a device name such as /dev/hda (for the master device on IDE channel 0), /dev/hdb (for the slave device on IDE channel 0), /dev/hdc (for the master device on IDE channel 1), and /dev/hdd (for the slave device on IDE channel 1). With more modern computers that use the SATA inter face, Linux will refer to drives as /dev/sda (for the master device on channel 0), /dev/sdb (for the slave device on channel 0), and so on.

If a new hard drive is properly attached to your PC and you then boot Linux, you can see whether the kernel recognizes the device by viewing the output of the dmesg command. You can then use fdisk with the device name to begin partitioning like so:

# fdisk /dev/hdb

Note that you will need root permission, and in this example, the new drive is attached as a slave on IDE channel 0. Do not change partitioning on your root device; otherwise, you will wreck your system! The fdisk command is interactive, and you can press M to get help when using the utility. You can use parted in much the same way if you specify the i, or interactive option on the command line, as follows:

# parted -i /dev/hdb

To get help when using parted interactively, press ? or type help followed by a command keyword. The parted command has other helpful features, such as the capability to copy a file system directly from one partition to another.

Finally, you can prepare partitions ahead of installation by booting your system using a live Linux distribution (such as the LNX Bootable Business Card, available at http://www.lnx-bbc.org/) and then using a native Linux utility such as fdisk to partition your drive. For details on using the fdisk partitioning utility and alternative software tools to partition your hard drive, see the section "Creating the Partition Table" in Chapter 35, "Managing the File System."

NOTE

It is possible to create a dual-boot configuration, which allows the choice of booting Fedora and another operating system, such as Windows XP To configure your system for dual booting, you must first install Windows and then install Linux. Note that many Windows system-restore CD-ROMs wipe out all data on your hard drive, including Linux. During installation of Fedora, you install the GRUB Linux bootloader in the primary drive's Master Boot Record, or MBR. When properly configured, GRUB allows your system to reboot to Windows or Linux. Browse to http://www.gnu.org/software/grub/manual/ to read the GRUB manual online.

Choosing a Partitioning Scheme

As with deployment and installation of Linux, partitioning your hard drive to accept Fedora requires some forethought, especially if the target computer is going to be used other than as a home PC on which to learn Linux. If Linux is to be the only resident operating system, you can have the installer automatically create and use a partition scheme according to the type of installation you select during the install. If you plan to have a dual-boot system in which you can boot Linux or another operating system, you have to manually partition your hard drive before and possibly during the install.

CAUTION

Before you begin partitioning your drive, get your safety nets in order. First, back up all critical data! Any changes to your system's hard drive or operating system put your existing data at risk. To prevent the loss of time and resources that inevitably follow data loss, do full backups before you make any changes to your system. Create a bootdisk during the install (you will be asked before the install finishes) so that you will be able to at least boot Linux if something goes wrong.

The simplest and most basic partitioning scheme for a Linux system requires a Linux native root partition and a swap partition. On a single-drive system with 12GB storage and 512MB of RAM, the scheme might look like this:

Hard Drive Partition Mount Point Size

/dev/hda1            /           10.74GB

/dev/hda2            swap        1GB

On a system running Windows, the scheme might look like this:

Hard Drive Partition Mount Point    Size

/dev/hda1            /media/c_drive 4GB

/dev/hda2            /              7.74GB

/dev/hda3            swap           1GB

CAUTION

Notebook users should be careful when partitioning. Some notebooks use a special partition equal to the size of installed RAM to perform suspend-to-disk or other hibernation operations. Always examine your computer's initial partitioning scheme if configuring a dual-boot system, and leave the special partition alone! One way around this problem is to use a software suspend approach as outlined athtpp://www.suspend2.net/.

Hosting Parts of the Linux File System on Separate Partitions

Your choice of specific partitioning scheme will depend on how Fedora will be used. On a system being designed for expansion, greater capacity, or the capability to host additional software or users, you can use separate partitions to host various parts of the Linux file system. Some candidates for these separate partitions include

► /home — Users will store hundreds and hundreds of megabytes of data under their directories. This is important data, perhaps even more so than the system itself. Using a separate partition (on a different volume) to store this user data helps make the data easier to find and it segregates user and system data. You must decide ahead of time how much storage to allocate to users. For a single workstation, you should reserve several gigabytes of storage.

► /opt — As the home directory for additional software packages, this directory can have its own partition or remote file system. Fedora does not populate this directory, but it might be used by other software packages you install later. Just 1GB of storage should be adequate, depending on applications to be installed.

► /tmp — This directory can be used as temporary storage by users, especially if disk quotas are enforced; as such, it could be placed on its own partition. This directory can be as small as 100MB.

► /usr — This directory holds nearly all the software on a Fedora system and can become quite large if additional software is added, especially on a workstation configuration. Using a separate partition can make sense. A full install requires at least 6GB for this directory or more if additional software is added.

► /var — Placing this directory (or perhaps some of its subdirectories) on a separate partition can be a good idea, especially because security logs, mail, and print spooling take place under this tree. You should reserve at least 1GB of storage for /var, especially if using Fedora as a print server (as spooled documents reside under /var/spool).