Online Book Reader

Home Category

Running Linux, 5th Edition - Matthias Kalle Dalheimer [34]

By Root 1228 0
start.

Another reason to use multiple filesystems is to divvy up storage among multiple hard drives. If you have, say, 300 MB free on one hard drive, and 2 GB free on another, you might want to create a 300-MB root filesystem on the first drive and a 2-GB /usr filesystem on the other. It is possible to have a single filesystem span multiple drives by using a tool called Logical Volume Manager (LVM), but setting this up requires considerable knowledge, unless your distribution's installation program automates it for you.

In summary, Linux requires at least one partition, for the root filesystem. If you wish to create multiple filesystems, you need a separate partition for each additional filesystem. Some distributions of Linux automatically create partitions and filesystems for you, so you may not need to worry about these issues at all.

Another issue to consider when planning your partitions is swap space. Swap space is a portion of the disk used by an operating system to temporarily store parts of programs that were loaded by the user but aren't currently in use. You are not required to use swap space with Linux, but if you have less than 256 MB of physical RAM, it is strongly suggested that you do.

You have two options. The first is to use a swap file that exists on one of your Linux filesystems. You will create the swap file for use as virtual RAM after you install the software. The second option is to create a swap partition, an individual partition to be used only as swap space. Most people use a swap partition instead of a swap file.

A single swap file or partition may be up to 2 GB.[*] If you wish to use more than 2 GB of swap (hardly ever necessary), you can create multiple swap partitions or files—up to 32 in all.

Setting up a swap partition is covered in "Creating Swap Space," later in this chapter, and setting up a swap file is discussed in "Managing Swap Space" in Chapter 10. For instance, if you want to run fdisk on the first SCSI disk in your system, use the command:

# fdisk /dev/sda

/dev/hda (the first IDE drive) is the default if you don't specify one.

If you are creating Linux partitions on more than one drive, run fdisk once for each drive:

# fdisk /dev/hda

Command (m for help):

Here fdisk is waiting for a command; you can type m to get a list of options :

Command (m for help): m

Command action

a toggle a bootable flag

b edit bsd disklabel

c toggle the dos compatibility flag

d delete a partition

l list known partition types

m print this menu

n add a new partition

o create a new empty DOS partition table

p print the partition table

q quit without saving changes

s create a new empty Sun disklabel

t change a partition's system id

u change display/entry units

v verify the partition table

w write table to disk and exit

x extra functionality (experts only)

Command (m for help):

The n command is used to create a new partition. Most other options you won't need to worry about. To quit fdisk without saving any changes, use the q command. To quit fdisk and write the changes to the partition table to disk, use the w command. This is worth repeating: so long as you quit with q without writing, you can mess around as much as you want with fdisk without risking harm to your data. Only when you type w can you cause potential disaster to your data if you do something wrong.

The first thing you should do is display your current partition table and write the information down for later reference. Use the p command to see the information. It is a good idea to copy the information to your notebook after each change you have made to the partition table. If, for some reason, your partition table is damaged, you will not access any data on your hard disk any longer, even though the data itself is still there. But by using your notes, you might be able to restore the partition table and get your data back in many cases by running fdisk again and deleting and re-creating the partitions with the parameters you previously wrote down. Don't forget to save the restored partition table when

Return Main Page Previous Page Next Page

®Online Book Reader