• Aucun résultat trouvé

Manually Specifying Your Partition Layout

Manually specifying the layout of the partitions on your system can be useful, but it is also time-consuming and requires some understanding of the Linux filesystem. Manually partitioning your system enables you to put specific directories from the Linux filesystem on their own partitions, which can improve performance, minimize the size of backups for your system (because backups are usually done on a per-filesystem or per-directory basis), and simplify future upgrades and system reconfiguration.

Note

By default, the Ubuntu installer automatically creates a reasonable partitioning scheme for you, which means that it creates one large partition for user and system files and another, smaller, partition to use as swap space to support virtual memory on your Ubuntu system. This section describes an alternative to the quasi-graphi-cal Ubuntu installer’s automatic partitioning scheme. If you’re reading this book chapter-to-chapter, you can skip over this section if you’ve already installed your system.

If you are installing Ubuntu for the first time or are relatively unfamiliar with Linux, I’d suggest letting the Ubuntu installer automatically partition your disk for you. automatic partitioning will get you up and running much more quickly, and doesn’t require that you understand the content and use of various directories on your Linux system. as you become more familiar with Ubuntu and Linux, you can always subsequently back up your user account to another machine, and then reinstall Ubuntu using manual partitioning. n

The following are common directories in the Linux filesystem that are often put into their own partitions:

/ L

L : The top level of the Linux filesystem. A partition must always be available through the / directory in order for a Linux system to boot.

/boot L

L : The directory that holds the Linux kernel and other associated system files used during the boot process

/home L

L : The directory where user files and accounts are located /opt

L

L : A directory where optional programs and related files are typically installed /tmp

L

L : A directory used to hold temporary files created by user and system processes /usr

L

L : A directory that holds applications, system files, and libraries used by the stan-dard Linux system. On Ubuntu systems, the /usr directory requires up to 1.25 GB of disk space, depending on the packages that you have selected for installation.

/usr/local L

L : A directory that holds applications, system files, and libraries used by a particular Linux system, but that may not be present on all Linux systems

Most Linux systems that do not use a single partition to hold the entire filesystem create separate partitions for /, /boot, and /home. For more information about these directories and the struc-ture of the Linux filesystem in general, see Chapter 4.

Linux partitions can be grouped into two general types: swap partitions, which are used inter-nally by the system to support virtual memory; and data partitions, in which files and other directories are located. A Linux system must have at least one area to swap to in order to func-tion correctly — this is usually a dedicated partifunc-tion, although you can also swap to a file in the filesystem if you are desperate. (See Chapter 4 for more information about partitions and virtual memory.) In this section, you will create a few basic data partitions and a single swap partition to illustrate manual partitioning — how you actually decide to partition your system is up to you.

Manually partitioning your disk involves steps like the following:

1. In the screen shown in Figure 3-8, select the Manual option. The screen shown in Figure 3-21 displays.

2. Use the arrow key to select the pool of available space on the disk drive that you want to partition, and press Return to continue. The screen shown in Figure 3-22 displays.

Figure 3-21

The screen for manually partitioning disks

Figure 3-22

Beginning to define a new partition

3. Select the “Create a new partition” entry, and press Return to continue. The screen shown in Figure 3-23 displays.

Figure 3-23

Specifying the size of your new partition

4. Enter the size that you want your new partition to have. The amount of unallocated disk space is displayed as a default value. You can specify the size of your new partition as an absolute value, such as 100 MB; specify it as a percentage of the available space, such as 10 percent; or use the max keyword to create a partition of the maximum size available based on existing free space. After entering this value, press Return to continue. The screen shown in Figure 3-24 displays.

5. Select the type of partition that you want to create. Disks can contain up to four physi-cal partitions — any partitions beyond that number must be logiphysi-cal partitions. Logiphysi-cal partitions can contain other partitions, whereas physical partitions are just that — physi-cal portions of your disk drive that cannot be further subdivided. Unless you plan to create more than four partitions, use the arrow keys to ensure that the physical entry is selected, and press Return to continue. The screen shown in Figure 3-25 displays.

Figure 3-24

Specifying the type of your new partition

Figure 3-25

Specifying the location of your new partition

6. Unless you have a specific reason to position the new partition on a special portion of your disk, accept the default value Beginning and press Return to continue. The screen shown in Figure 3-26 displays.

Figure 3-26

Specifying the type and mountpoint of your new partition

7. The highlighted entry on this screen enables you to specify the type of filesystem used on the partition that you are creating, which is essentially how the data is organized and managed on the partition that you are creating. Linux systems support many dif-ferent types of filesystems, each of which has certain characteristics that are explained in more detail in Chapter 4. In this example, we’ll be creating a partition to be mounted at /boot, which is a data partition, and the Linux ext4 filesystem is the default (and most popular) format for data partitions. Unless you have a specific reason to do so, you should not change the default value.

However, if you want to specify another type of filesystem, press Return. The screen shown in Figure 3-27 displays, showing the list of available filesystem types. After selecting the type of filesystem that you want to use, press Return to continue. The screen shown in Figure 3-26 re-displays.

8. The mountpoint for a partition is the directory through which the contents of that par-tition are made available to your system. (See Chapter 4 for more information about Linux directories and mountpoints.) A list of common partitions and associated mount-points was given at the beginning of this section. The only mandatory filesystem and associated mountpoint on a Linux system is /, the root directory of the Linux filesys-tem, which is shown as the default value on the screen shown in Figure 3-26. Use the arrow keys to select the “Mount Point” menu item, and press Return to continue. The screen shown in Figure 3-28 displays.

Figure 3-27

Specifying the partition type

Figure 3-28

Specifying the mountpoint for your new partition

In this example, you’ll mount your new partition at /boot, which is the directory that holds the Linux kernel and associated system files. Use the arrow keys to select the entry for /boot, and press Return to continue. The screen shown in Figure 3-26 re-displays.

9. Use the arrow keys to scroll down and select the “Done setting up the partition” option.

A screen like the one shown in Figure 3-21 re-displays, showing the new partition that you have just defined and the remaining free space for the drive. Figure 3-29 shows the updated version of this screen.

Figure 3-29

Manual disk partitioning with one partition defined

10. Repeat Steps 2 through 9 to create additional partitions. As discussed in the previous section, filesystems that are often created on their own partitions are /boot (used in this example), /, /home, and a swap partition. Creating any other filesystem partitions follows exactly the same process as described previously. To create a swap partition, follow the same process as when creating other partitions, but select the swap area entry from the screen shown in Figure 3-27. The size of a swap partition should be approxi-mately the same size as the amount of memory in your computer system.

Caution

If you plan to create more than four partitions, the fourth partition that you create must be an extended parti-tion, in which the other partitions that you want to use can then be created. n

Tip

To help guarantee that you do not encounter installation problems, you may want to ensure that the partition that you mount at / is at least 3 GB in size. Following this rule should guarantee that your Ubuntu system will install correctly unless you have defined other partitions such as /usr with insufficient space to hold the files that are installed under that directory when it is used as a mountpoint. n

11. Once you have allocated all of the available free space on your system to partitions, your screen should look something like the one shown in Figure 3-30. This screen displays a summary of the partitions that you have defined for use on your system. Remember that there must be one partition mounted at / and one swap partition. To accept the values shown on this screen, use the arrow keys to select the “Finish partitioning and write changes to disk” option, and press Return to display the screen shown in Figure 3-31.

Figure 3-30

The partition summary screen

Figure 3-31

The final partition confirmation screen

12. Because disk partitioning cannot be undone, the screen shown in Figure 3-31 requests final confirmation of your manual partitioning selections. To accept these values and continue with the installation process, use the Tab key to select “Yes,” and press Return to continue.

You can now return to Step 11 of the Ubuntu Server installation process in the previous section.

And congratulations — you’re now at least a Linux wizard in training!