Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Linux+ Certification Bible.pdf
Скачиваний:
46
Добавлен:
15.03.2015
Размер:
3.78 Mб
Скачать

Chapter 8 User Environment Settings 267

Adding a hard drive

After you have installed the drive, add a hard drive to mirror the creation of the swap partition. To physically install a hard drive, you must plan several items, including:

Determine the type of hard drive that you need — usually IDE (Integrated Drive Electronics) or SCSI (Small Computer System Interface)

Determine the current settings of devices in use. For IDE, this includes the channel (primary or secondary) and device on channel (master or slave). For SCSI, the ID’s used are 0-15 for wide SCSI or 0-7 for narrow devices.

Select an unused ID for the new hard drive

Plan the file system for the new hard drive

Install the new hard drive

Partition and format the file system for the new hard drive

Mount the newly created file system

By using this general guide for installing a hard drive, the configuration can proceed simply and easily. The use of IDE or SCSI can be seen with formatting disk tools that identify disks as hda or sda; “h” represents IDE, and “s” represents SCSI disks.

The selection of the settings for the drive, however, is a bit more complicated. You must first select a free device ID while avoiding any current devices attached to the system. Normally, IDE devices are simpler because they have only two devices attached to one cable. You have three options for addressing IDE devices: Master, slave, and cable select. When adding devices to an IDE cable, the existing device is most often a master device. You can only determine this, however, by actually verifying the ID in use.

Don’t be fooled by the system detection of the hard drive during system initialization. When a hard drive is installed as the only device, it is often automatically detected as the master device. However, if you attach a second device, a jumper must be installed to assign the drive as master or slave. If you don’t do this, the first drive or both of the drives will not be detected by the system.

To verify the device ID’s, you need to physically look at the device’s jumpers, which are similar to the one shown in Figure 8-1.

268 Part III Configuration

Master

Slave

Cable

 

 

Select

Figure 8-1: A Device Jumper

Most drives have a jumper map label attached to make the task of determining the ID a little easier. Figure 8-1 shows only three jumpers, but often more options are available to allow the disk to be configured for older systems that may not support the features of the drive. Master devices are usually bootable on the primary IDE channel. Some systems can boot from other devices, but for the sake of consistency, the master drive on the primary IDE controller is the boot device for IDE systems. However, it is best to verify the device mapping, such as hda or hdb, to ensure that the hardware ID matches the system identification.

See Chapter 5 for more information about verifying hard drive ID and Linux identification.

After you have determined the system and the current device’s ID, you can add the new hard drive. For this example, assume that the current drive is the master on the primary IDE controller and that the new drive is the slave on the primary IDE controller. Using correct ESD (electro-static discharge) protection methods — usually, you use a grounding strap — place the jumper over the correct set of pins to assign the drive to slave status. Insert the drive into the system and attach to the cable.

Verify that the cable is not “cable select” by inspecting the cable for breaks. A break usually consists of a small hole in the cable, and is used to automatically assign addresses to devices. If the system is using “cable select,” both devices should set to use cable select.

After you have configured the IDE device, what should you do about SCSI? SCSI devices, like IDE, also are configured with separate device ID’s. SCSI is most often used in servers, but can also be used on workstations. Basic wide SCSI configuration uses up to 16 IDs to identify SCSI devices; one of these devices is used for the SCSI controller. Most newer SCSI devices can be configured by setting the ID number on a special numbered switch. Some SCSI devices use jumpers to set the ID of the device, and they use a binary system to identify the number. The 4 jumpers

Chapter 8 User Environment Settings 269

are representatives of the place markers 0, 2, 4, 8 (and are labeled as such) in the binary math scheme; reading from left to right the numbers are as follows: 8, 4, 2, 0. Table 8-2 demonstrates how this works.

Table 8-2

SCSI ID’s

Binary Number

SCSI ID

Jumpers used

Linux ID

 

 

 

 

0000

0

: : : :

sda

 

 

 

 

0001

1

: : : |

sdb

 

 

 

 

0010

2

: : | :

sdc

 

 

 

 

0011

3

: : | |

sdd

 

 

 

 

0100

4

: | : :

sde

 

 

 

 

0101

5

: | : |

sdf

 

 

 

 

0110

6

: | | :

sdg

 

 

 

 

0111

7

: | | |

sdh

 

 

 

 

1000

8

| : : :

sdi

 

 

 

 

1001

9

| : : |

sdj

 

 

 

 

1010

10

| : | :

sdk

 

 

 

 

1011

11

| : | |

sdl

 

 

 

 

1100

12

| | : :

sdm

 

 

 

 

1101

13

| | : |

sdn

 

 

 

 

1110

14

| | | :

sdo

 

 

 

 

1111

15

| | | |

sdp

 

 

 

 

Narrow SCSI devices use only three jumpers, so only the information shown up to “7” in the table applies. Using this information to verify the SCSI IDs is often a fairly simple task; however, not all SCSI drives use an easy-to-set jumper pattern. Always verify IDE and SCSI jumpers with the drive manufacturer. Select an unused ID and add the SCSI drive to the system in the same manner as you would add an IDE device. (Note one exception to this: SCSI devices can have many more IDE devices on one controller.) After you have installed the hard drive into the system, it must be configured in order for Linux to use it. You can configure the hard drive by using a disk-partitioning tool, such as cfdisk.

See Chapter 5 for more information about using cfdisk.

270 Part III Configuration

Unlike the original Linux installation, in which filesystems are created automatically, you need to make a filesystem on your new hard drives manually. On some systems you can use a setup utility, but most often you will use manual configuration. The mkfs command is used to build a Linux file system on a device — usually a hard drive partition. The use of mkfs is performed with the switches shown in Table 8-3.

 

Table 8-3

 

Switches used with mkfs

 

 

Switch

Description

 

 

-V

Produce verbose output, including all file system-specific commands

 

that are executed.

 

 

-t fstype

Specifies the type of file system to be built. If it is not specified, the

 

default file system type (currently ext2) is used.

 

 

fs-options

File system-specific options to be passed to the real file system

 

builder. Although not guaranteed, most file system builders support

 

the following options.

 

 

fs -c

Check the device for bad blocks before building the file system.

 

 

fs -l filename

Read the bad blocks list from filename.

 

 

fs -v

Produce verbose output.

 

 

The standard command used to create a file system looks similar to this:

mkfs [-V] [-t fstype] [fs-options] filesys [blocks]

When this command completes, the mkfs program returns an exit code with 0 on success and 1 on failure. After this program is used, the file system is created and must be mounted, which you do by using the mount command, and can be automounted by using the fstab file. This allows the new hard drive to be used and completes the installation of the hard drive.

Video and monitor

3.10 Reconfigure boot loader (e.g., LILO)

When video cards and monitors are installed on the Linux system you usually are only required to reconfigure the X Window System by using Linux video configuration tools such as XF86config. However, you may experience situations in which you desire more complex configurations, including an update of the XF86 program or the Desktop Environment. You may want to perform these configurations in order to provide the best support of the newly installed video card.

Chapter 8 User Environment Settings 271

See Chapter 5 for more information about installing and upgrading software.

You can install any necessary modules by using the following information, according to the Linux HOW TO. You need to decide what to compile into the kernel such as which modules to include. You will make the actual choices during the compilation, during the second stage of the following sequence of instructions:

cd /usr/src/linux make menuconfig

make dep clean modules modules_install zImage

After you have completed these commands, you need to map out the module dependencies, which you can do by using the following command:

depmod -a

At this point, you need to add the newly created kernel to the boot menu of LILO, by adding the following lines to the lilo.conf file, which is normally located at

/etc/lilo.conf:

image=/usr/src/linux/arch/i386/boot/zImage

label=new

alias=n read-only vga=ask optional

A complex lilo.conf may look something like this:

boot=/dev/hda

map=/boot/map

install=/boot/boot.b

vga=normal

default=linux

keytable=/boot/us.klt

lba32 prompt timeout=50

message=/boot/message menu-scheme=wb:bw:wb:bw image=/boot/vmlinuz

label=linux

root=/dev/hda1

initrd=/boot/initrd.img append=” quiet” vga=788

read-only

272 Part III Configuration

image=/boot/vmlinuz label=linux-nonfb root=/dev/hda1 initrd=/boot/initrd.img read-only

image=/boot/vmlinuz

label=failsafe

root=/dev/hda1

initrd=/boot/initrd.img append=” failsafe” read-only

other=/dev/hdb1

label=windows

table=/dev/hdb map-drive=0x80

to=0x81 map-drive=0x81

to=0x80

other=/dev/fd0

label=floppy unsafe

Use care when editing this file or you risk losing access to one of your other operating systems that are defined in LILO. Next, using a text editor, create a new file called /etc/rc.d/init.d/modules.init, which is the most common name used in most Linux distributions, that will be used to configure modules into the kernel. Enter the following text in the new file:

#Modules initialisation.

#Start up the module auto-loading daemon. /sbin/kerneld

#Mount all currently unmounted auto-mounted partitions. /sbin/mount -a

Then, the following commands are used to enable the newly created file:

cd /etc/rc.d

chmod 755 init.d/* cd rc3.d

ln -s ../init.d/modules.init 05modules.init

You can now reboot the system and use the new kernel with the new modules. Some distributions require a different configuration, so be sure to verify the location of the files and the commands to use for your specific distribution. The preceding commands should work with most Red Hat and Debian-based distributions. You can use this method with other devices, such as Ethernet cards and modems. After you have installed any of these devices, you must configure them by using the tool for the device; netconfig or linuxconf work well for network devices.

Соседние файлы в предмете Операционные системы