Partitioning Before and During Installation


Partitioning your hard drive for Linux can be done before or during installation.

If you plan to prepare your partitions before installing Linux, you will need to use commercial partitioning software. Some of the popular commercial software utilities you can use to create Linux partitions are Symantec's PartitionMagic or VCOM Products' Partition Commander. Alternatively, it might be possible to prepare partitions before installing Ubuntu by using the free FIPS.EXE command.

If you want to partition a hard drive 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).

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, or you will bork 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 like so:

# 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.

Tip

You can use the Ubuntu CD or the DVD to perform other tasks aside from installing Linux. The CD-ROM/DVD features a rescue mode and can also be used to partition and prepare a hard drive for Linux. See Chapter 3.


Note

It is possible to create a dual-boot configuration, which allows the choice of booting Ubuntu 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 Ubuntu, 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. See Chapter 17, "Backing Up, Restoring, and Recovery," for information on using GRUB, or browse to http://www.gnu.org/software/grub/manual/ to read the GRUB manual.


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. See Chapter 17 for information on backups with Linux.


Choosing a Partitioning Scheme

As with deployment and installation of Linux, partitioning your hard drive to accept Ubuntu 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.

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 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              /mnt/windows   4GB /dev/hda2              /              7.74GB /dev/hda3              swap           1GB 


Caution

Notebook users should be careful when partitioning. Many notebooks use a special partition equal to the size of install RAM in order 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 at http://swsusp.sourceforge.net/. Also be aware that when you are installing Ubuntu on an Apple machine you need to have a very small partition to enable the computer to boot at all. This partition is commonly known as the Apple Bootloader, and will be used to contain the yaboot progam that is used instead of GRUB.


Hosting Parts of the Linux File System on Separate Partitions

Your choice of specific partitioning scheme will depend on how Ubuntu 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. Ubuntu does not populate this directory, but it might be used by other software packages you install later. One gigabyte 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 Ubuntu 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 one gigabyte of storage for /var, especially if using Ubuntu as a print server (as spooled documents will reside under /var/spool).

Tip

As a general rule, it is a good idea to segregate user and system data. Although a Linux system can be quickly restored, user data has a much greater value and can be much more difficult to replace. Segregating data can make the job of backing up and restoring much easier. If you ever have a problem accessing your partition, we recommend that you get the excellent Knoppix distribution that boots and runs entirely from CD. This will enable you to access your partitions and make any necessary repairs. We never go anywhere or deal with any computer unless we have a CD with Knoppixyou never know when it will be useful!




Ubuntu Unleashed
Ubuntu Unleashed 2011 Edition: Covering 10.10 and 11.04 (6th Edition)
ISBN: 0672333449
EAN: 2147483647
Year: 2006
Pages: 318

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net