Linux+ LX0-101 Chapter 3: Configuring Hardware

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

What are the mappings from Linux parallel devices to MSoft ones?

/dev/lp0 => LPT1 /dev/lp1 => LPT2

What is the format of a Linux parallel device?

/dev/lpx, x ranges from 0 to 1

What are the mappings from Linux serial devices to MSoft ones?

/dev/ttyS0 => com1 /dev/ttyS1 => com2 /dev/ttyS2 => com3 /dev/ttyS3 => com4

What is the format of a Linux serial device name?

/dev/ttySx, where x is an integer from 0 to 3, e.g., /dev/ttyS0, /dev/ttyS1

Where do you find which DMA addresses are in use on a Linux system?

/proc/dma

Where will you find IRQ information?

/proc/interrupts

Where will you find the I/O addresses in use by a Linux sustem?

/proc/ioports

FYI: What is the exam weight of this chapter?

101.1 Determine and configure hardware settings => 2 102.1 Design hard disk layout => 2 104.1 Create partitions and filesystems => 2 104.2 Maintain the integrity of filesystems => 2 104.3 Control mounting and unmounting of filesystems => 3 *Total Weight: 11* *Percent of Exam = 11 / 60 = 18%*

Name a common, small, non-journaling file system. Why would it be used?

Ext2fs (or ext2). Ext2fs can be a good choice for a small /boot partition, if you choose to use one, and for small (sub-gigabyte) removable disks. On such small partitions, the size of the journal used by more advanced filesystems can be a real problem, so the non-journaling ext2fs is a better choice.

True or false: *dumpe2fs* should be done on an *unmounted* file system?

False. It can be run on a mounted device.

How fast does FireWire and USB transfer data?

Firewire => 400 Mbps USB 1.1 => 12 Mbps USB 2.0 => 480 Mbps USB 3.0 => 3.2 to 4.8 Gbps

Name some types of storage devices

Floppy drives Hard disk drives Solid state drives Optical drives (CDs and DVDs) Flash memory drives

List the default and hardwired IRQs with target devices

IRQ, Device 0, System Timer HARDWIRED CAN'T CHANGE 1, Keyboard HARDWIRED CAN'T CHANGE 2 Cascade to IRQ 8-15 3, Second or Fourth serial device 4, First or Third serial device 5, Second parallel device or sound card 6, First floppy drive controller 7, First parallel device 8, Real time clock HARDWIRED CAN'T CHANGE

Define *lsmod*

It lists information about the kernel modules (drivers) in the system. stdout fields are *Module, Size, Used by*. "Used by" lists the dependent modules.

Why use *lsusb*?

It lists information about the usb devices in your system. *-t* option shows USB bus tree format.

Why use *rmmod*? Why not use it?

It uses the module name to remove a kernel module (driver). However, it will not remove the module's dependencies (if not in use). Using *modprobe -r <module name>* is preferred since it will remove the module and then its dependencies (if not in use).

What is the mapping of serial and parallel devices, IRQs, and IO Ports?

LINUX Device , MSFT Device, IRQ, IO Port Address /dev/ttyS0, COM1, 4, 0x03f8 /dev/ttyS1, COM2, 3, 0x02f8 /dev/ttyS2, COM3, 4, 0x03e8 /dev/ttyS3, COM4, 3, 0x02e8 /dev/lp0, LPT1, 7, 0x0378-0x037f /dev/lp1, LPT2, 5, 0x0278-0x027f

Define hotplug devices

Modern external devices, such as Ethernet, USB, and IEEE-1394 devices, are hotplug; you can attach and detach them even when the computer is running. These devices rely on specialized Linux software to detect the changes to the system as they're attached and detached. HAL, dBus, SysFS, and uDev are examples of software to support hotplug devices.

Name two filesystem types that are not suitable for Linux

NTFS is Windows NT/200x /XP's native filesystem, and it lacks features required in the Linux root filesystem. HFS is a Mac OS filesystem, and it also lacks features Linux needs in its root filesystem.

Once a partition has been created, what is the next logical step to take?

Once a partition is created, you must prepare it for use. This process is often called "making a filesystem" or "formatting a partition."

Describe the *swap* partition

One to two times the system RAM size. Serves as an adjunct to system RAM; is slow but enables the computer to run more or larger programs by saving runtime-needed data to disk.

What is the maximum number of devices that can share the same SATA bus?

One. Each SATA device has its own dedicated channel and controller.

Linux uses letters to differentiate __________ HDDs and numbers to differentiate _________ . Give examples of each case.

Physical, partitions *SATA* hard disks are usually handled by Linux's *SCSI* subsystem and so are referred to as /dev/sdx ; however, some drivers handle these disks as if they were *PATA* disks and so refer to them as /dev/hdx In both cases the "x" would be a letter like "/dev/sda" or "/dev/hda". Partitions have numbers appended to the HDD to indicate the partition number, e.g., "/dev/sda1".

Describe Primary, Extended, and Logical Partitions. What partitioning system are these a part of?

Primary are normal bootable partitions, extended are place holders that hold logical partitions. These definitions apply to the Master Boot Record (MBR) partitioning system.

Define *mke2fs*

Used to create an ext2, ext3, or ext4 filesystem.

Define *lspci*

lspci is a utility for displaying information about PCI buses in the system and devices connected to them. has -v -vv -vvv options for levels of verbosity. *-t* option shows bus tree.

Define sysfs

sysfs is a RAM-based filesystem mounted at /sys. It provides a means to export kernel data structures to the user space.

Define udev

udev is a process that maintains a virtual filesystem, mounted at /dev, which creates dynamic device files as drivers are loaded and unloaded. udev uses sysfs to get the information it needs about the hardware The directory /etc/udev.d holds all the rules to be applied when adding or removing a device.

How would you find out which of your users is consuming the most disk space in /home?

"du -s /home/*" => Chances are you're not concerned with the details of which subdirectories within each home directory are using the space, so you'll pass the -s option to the program. *The wildcard character (asterisk) stands for all the files and directories in /home, thus producing summaries for all these subdirectories. THE OUTPUT WON'T INCLUDE THE SUBDIRECTORIES UNLESS THE WILDCARD IS USED*

Describe a */boot* partition (mount point)

*/boot* 100-500MiB Holds critical boot files. Creating it as a separate partition lets you circumvent limitations of older BIOSs and boot loaders, which often can't boot a kernel from a point above a value between 504MiB and 2TiB.

Describe a */home* partition (mount point)

*/home* 200MiB-3TiB (or more). Holds users' data files. Isolating it on a separate partition preserves user data during a system upgrade.

Describe */media*

*/media* Not a Separate Partition Holds subdirectories that may be used as mount points for removable media, much like */mnt* or its subdirectories.

Describe */mnt*

*/mnt* Not a Separate Partition; rather, it or its subdirectories are used as mount points for removable media like floppies or CD-ROMs.

Describe a */opt* partition (mount point)

*/opt* 100MiB-5GiB Holds Linux program and data files that are associated with third-party packages, especially commercial ones.

Describe a */tmp* partition (mount point)

*/tmp* 100MiB-20GiB Holds temporary files created by ordinary users.

Describe a */usr* partition (mount point)

*/usr* 500MiB-25GiB Holds most Linux program and data files; this is sometimes the largest partition, although /home is larger on systems with many users or if users store large data files. Changes implemented in 2012 are making it harder to create a separate /usr partition in many distributions.

Describe a */usr/local* partition (mount point)

*/usr/local* 100MiB-3GiB Holds Linux program and data files that are unique to this installation, particularly those that you compile yourself.

Describe a */var* partition (mount point)

*/var* 100MiB-3TiB (or more) Holds miscellaneous files associated with the day-to-day functioning of a computer. These files are often transient in nature. Most often split off as a separate partition when the system functions as a server that uses the /var directory for server-related files like mail queues.

What are some disk partition type codes commonly used in Linux?

*5* => Generic extended partition *82* => Linux/Solaris swap *83* => Linux generic fs *85* => Linux extended

Describe some common mounting options

*defaults* Causes the default options for this filesystem to be used. It's used primarily in the */etc/fstab* file to ensure that the file includes an options column. *user or nouser* Allows or disallows ordinary users to mount the filesystem. The default is nouser, but user is often appropriate for removable media. Used in /etc/fstab. When included in this file, user allows users to type mount /mountpoint (where /mountpoint is the assigned mount point) to mount a disk. Only the user who mounted the filesystem may unmount it. *users* Similar to user, except that any user may unmount a filesystem once it's been mounted. *owner* Similar to user, except that the user must own the device file. Some distributions, such as Red Hat, assign ownership of some device files (such as /dev/fd0 for the floppy disk) to the console user, so this can be a helpful option.

What does *depmod* do and why is it important

*depmod* creates a list of module dependencies by reading each module under /lib/modules/version and determining what symbols it exports and what symbols it needs. By default, this list is written to modules.dep, Other module utilities like *modprobe* can then use this dependency information when loading or removing kernel modules.

Define *df*

*df [options] [files]* report file system disk space usage *Include All Filesystems* The -a or --all option includes pseudo-filesystems with a size of 0 in the output. These filesystems may include /proc, /sys, /proc/bus/usb, and others. *Use Scaled Units* The -h or --human-readable option causes *df* to scale and label its units; for instance, instead of reporting a partition as having 5859784 blocks, it reports the size as 5.6G (for 5.6GiB). The -H and --si options have a similar effect, but they use power-of-10 (1,000; 1,000,000; and so on) units rather than power-of-2 (1,024; 1,048,576; and so on) units. The -k (--kilobytes) and -m (--megabytes) options force output in their respective units. *Summarize Inodes* By default, *df* summarizes available and used disk space. You can instead receive a report on available and used inodes by passing the -i or --inodes option.

What commands or steps would you take to partition a disk?

*fdisk /dev/sdx* => begin process of creating partition table for disk sdx *type "p"* => view disk partition table to be sure it is the correct drive "type "n"* => create new partition, select partition—whether it should be a primary, extended, or logical partition; the partition's starting cylinder; the partition's ending cylinder or size; and so on. *type w* => write partition table to MBR and quit *fdisk* *type "q"* => quit fdisk w/o saving partition table.

Name two linux partitioning tools.

*fdisk*, short for fixed disk and GNU *parted* (gparted)

What tool can be used to check filesystem integrity and correct found errors?

*fsck* => a front end to other tools, such as *e2fsck* (aka *fsck.ext2*, *fsck.ext3*, and *fsck.ext4*) or XFS's *xfs_check* and *xfs_repair*. *fsck [-sACVRTNP] [-t fstype] [--] [fsck-options] filesystems* The final parameter is usually the name of the filesystem or filesystems being checked, such as /dev/sda6. Normally, you run *fsck* with only the filesystem device name, as in *fsck /dev/sda6* You can add options as needed, however. *RUN FSCK ON UNMOUNTED OR READ-ONLY FILESYSTEMS ONLY* *Check All Files* The -A option causes fsck to check all the filesystems marked to be checked in /etc/fstab. This option is normally used in system startup scripts. *Indicate Progress* The -C option displays a text-mode progress indicator of the check process. Most filesystem check programs don't support this feature, but *e2fsck* does. *Show Verbose Output* The -V option produces verbose output of the check process. *No Action* The -N option tells fsck to display what it would normally do without actually doing it.

What is the difference between *insmod* and *modprobe*?

*insmod* inserts a module that must be named by full file path, *modprobe* uses the module name and automatically first installs dependencies, making it the preferred method. Note: need to run *depmod* first for the auto dependencies of *modprobe* to work correctly. *-n* dry run and *-r [module name]* remove are *modprobe* options.

Which command makes a file system, which option formats it into a specific type of file system.

*mkfs devicePartition* => default file system will be created, ext2fs *mkfs -t [fs type] devicePartition* formats to a specific type of file system, like ext4 example: *mkfs -t ext4 /dev/sda2* *-c*: the -c option is supported by several filesystems. This option causes the tool to perform a badblock check—every sector in the partition is checked to be sure it can reliably hold data. If it can't, the sector is marked as bad and isn't used.

Which commands make and activate a swap file partition?

*mkswap [partition]* creates it *swapon [partition]* activates

What command and syntax is used to mount a file system?

*mount [-alrsvw] [-t fstype] [-o options] [device] [mountpoint]* *Mount All Filesystems* The -a parameter causes mount to mount all the filesystems listed in the */etc/fstab* file *Mount Read-Only* The -r parameter causes Linux to mount the filesystem read-only, even if it's normally a read/write filesystem. *Show Verbose Output* As with many commands, -v produces verbose output *Mount Read/Write* The -w parameter causes Linux to attempt to mount the filesystem for both read and write operations. This is the default for most filesystems, The -o rw option has the same effect.

How would you list the partition info of an MBR disk?

*sudo fdisk -l /dev/sdx* assuming a SATA drive with letter x. Output is like: Disk /dev/sda: 240.1 GB, 240057409536 bytes 255 heads, 63 sectors/track, 29185 cylinders, total 468862128 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x00032e8a Device Boot Start End Blocks Id System /dev/sda1 * 2048 435931135 217964544 83 Linux /dev/sda2 435933182 468860927 16463873 5 Extended Partition 2 does not start on physical sector boundary. /dev/sda5 435933184 468860927 16463872 82 Linux swap / Solaris

What should you use to edit file system parameters reported by *dumpe2fs* ? Should the device be unmounted?

*tune2fs [options] [device]* Yes, the device should be unmounted to avoid corruption. *Adjust the Maximum Mount Count* Ext2fs, ext3fs, and ext4fs require a periodic disk check with fsck. This check is designed to prevent errors from creeping onto the disk undetected. You can adjust the maximum number of times the disk may be mounted without a check with the *-c* mounts option, where mounts is the number of mounts. You can trick the system into thinking the filesystem has been mounted a certain number of times with the *-C* mounts option; this sets the mount counter to mounts. Adjust the Time Between Checks Periodic disk checks are required based on time as well as the number of mounts. You can set the time between checks with the *-i* interval option, where interval is the maximum time between checks. Normally, interval is a number with the character d, w, or m appended, to specify days, weeks, or months, respectively.

What command and syntax is used to unmount a file system?

*umount [-afnrv] [-t fstype] [device | mountpoint]* Most of these parameters have meanings similar to their meanings in mount, but some differences deserve mention: *Unmount All* Rather than unmount partitions listed in /etc/fstab, the -a option causes the system to attempt to unmount all the partitions listed in /etc/mtab, the file that holds information about mounted filesystems. *Force Unmount* You can use the -f option to tell Linux to force an unmount operation that might otherwise fail. This feature is sometimes helpful when unmounting NFS mounts shared by servers that have become unreachable. *Fall Back to Read-Only* The -r option tells umount that if it can't unmount a filesystem, it should attempt to remount it in read-only mode. *Unmount Partitions of a Specific Filesystem Type* The -t fstype option tells the system to unmount only partitions of the specified type. You can list multiple filesystem types by separating them with commas. The Device and Mount Point You need to specify only the device or only the mountpoint, not both.

What tools does Linux use to deal with usb devices?

*usbmgr* and *hotplug* are programs that run in the background to detect changes on the USB bus. When it detects changes, it loads or unloads the kernel modules that are required to handle the devices. Hotplug is now common. uses files stored in /etc/hotplug to control the configuration of specific USB devices. In particular, /etc/hotplug/usb.usermap contains a database of USB device IDs and pointers to scripts in /etc/hotplug/usb that are run when devices are plugged in or unplugged.

List 3 xfs tools and their use

*xfs_info [device|mount point]* Gives info like *dumpe2fs* but requires the filesystem be mounted. *xfs_metadump* (Use only unmounted) copies metadata from a filesystem *xpf_admin* modifies unmounted parameters of a filesystem

What does a journal file system do? What are the benefits?

A journal file system maintains a journal, which is a data structure that describes pending operations. Prior to writing data to the disk's main data structures, Linux describes what it's about to do in the journal. When the operations are complete, their entries are removed from the journal. Thus, at any given moment the journal should contain a list of disk structures that might be undergoing modification. The result is that, in the event of a crash or power failure, the system can examine the journal and check only those data structures described in it. If inconsistencies are found, the system can roll back or complete the changes, returning the disk to a consistent state without checking every data structure in the file system. This greatly speeds the disk-check process after power failures and system crashes.

What is *ReiserFS*?

A journaling filesystem for Linux that's particularly good at handling large numbers of small files (say, smaller than about 32KB). Use reiserfs as the type code for this filesystem.

Define coldplug devices

Coldplug devices are designed to be physically connected and disconnected only when the computer is turned off. Attempting to attach or detach such devices when the computer is running can damage the device or the computer. Traditionally, components that are internal to the computer, such as the CPU, memory, PCI cards, and hard disks, have been coldplug devices.

Define *debugfs*

Combines the filesystem modifying ability of dumpe2fs and tune2fs

Define HAL

DEPRECATED: now merged into udev. The hald process is the daemon that maintains a database of the devices connected to the system in real time. The daemon connects to the D-Bus system message bus to provide an API that applications can use to discover, monitor, and invoke operations on devices.

How are primary and logical partitions numbered?

Primary partitions are 1-4. Logical partitions are numbered 5 and up, and they reside in an extended partition with a number between 1 and 4. Gaps can appear in the numbering of MBR primary partitions; however, such gaps cannot exist in the numbering of logical partitions. That is, you can have a disk with partitions numbered 1, 3, 5, 6, and 7 but not 1, 3, 5, and 7—if partition 7 exists, there must be a 5 and a 6.

What is *XFS*?

Silicon Graphics (SGI) created its Extents File System (XFS) for its IRIX OS and later donated the code to Linux. XFS has gained a reputation for robustness, *speed*, and flexibility on IRIX, but some of the XFS features that make it so flexible on IRIX aren't supported well under Linux. Use xfs as the type code for this filesystem.

Define *du* and contrast with *df*

Summarize disk usage of each FILE, recursively for directories. The *df* command is helpful for finding out which *partitions* are in danger of becoming overloaded, but once you've obtained this information, you may need to fine-tune the diagnosis and track down the *directories and files* that are chewing up disk space. The tool for this task is *du* Important Options * -a, --all* write counts for all files, not just directories *-c, --total* produce a grand total *-h, --human-readable* print sizes in human readable format (e.g., 1K 234M 2G) *--si* like -h, but use powers of 1000 not 1024 *-s* Summarize If you don't want a line of output for each subdirectory in the tree, pass the -s or --summarize option, which limits the report to those files and directories you specify on the command line. This option is equivalent to --max=depth=0.

Which partition is not mounted?

Swap

What is the role of motherboard firmware in Linux? What's it called?

This firmware initializes the motherboard's hardware and controls the boot process. In the past, the vast majority of x86- and x86-64-based computers have used a type of firmware known as the Basic Input/Output System (BIOS). Beginning in 2011, though, a new type of firmware, known as the Extensible Firmware Interface (EFI) or the Unified EFI (UEFI), has become all but standard on new computers. Some older computers also use EFI. When you turn on a computer, the fi rmware performs a power-on self-test (POST), initializes hardware to a known operational state, loads the boot loader from the boot device (typically the fi rst hard disk), and passes control to the boot loader, which in turn loads the OS.

Where is the mapping from partition to mount point kept? What is the format of the file data fields?

The */etc/fstab* file controls how Linux provides access to disk partitions and removable media devices. The fstab file fields are: *device mount point filesystem options dump fsck* *Backup Operation* The next-to-last field contains a 1 if the dump utility should backup a partition or a 0 if it shouldn't. If you never use the dump backup program, this option is essentially meaningless. (The dump program was once a common backup tool, but it is much less popular today.) *Filesystem Check Order* At boot time, Linux uses the *fsck* program to check filesystem integrity. The final column specifies the order in which this check occurs. A 0 means that *fsck* should not check a filesystem. Higher numbers represent the check order. The root partition should have a value of 1, and all others that should be checked should have a value of 2. Some filesystems, such as ReiserFS, shouldn't be automatically checked and so should have values of 0.

How to configure system so it determines what filesystem type a mount should have?

The *auto* parameter in the filesystem type column of */etc/fstab* will cause Linux to auto-detects the filesystem type when mounting the media. Useful when you don't know the filesystem type; USB flash drives, for instance, could use FAT, ext2fs, HFS, HFS+, NTFS, or even other filesystems

Define D-Bus

The Desktop Bus (D-Bus) is an application daemon that uses sysfs to implement a message bus daemon. It is used for broadcasting system events such as "new hardware device added" or "printer queue changed" and is normally launched by an init script called messagebus.

What is *Ext4fs*?

The Fourth Extended File System (ext4fs or ext4) is the next-generation version of this filesystem family. It adds the ability to work with very large disks (those over 16TiB, the limit for ext2fs and ext3fs) or very large files (those over 2TiB), as well as extensions intended to improve performance. Its filesystem type code is ext4.

What is *Ext3fs*?

The Third Extended File System (ext3fs or ext3) is basically ext2fs with a journal added. The result is a filesystem that's as reliable as ext2fs but that recovers from power outages and system crashes much more quickly. The ext3 filesystem type code is ext3.

Name five directories should never be on separate partitions.

The following directories host critical system configuration files or files without which a Linux system can't function. For instance, /etc contains /etc/fstab, the file that specifies what partitions correspond to what directories, and /bin contains the mount utility that's used to mount partitions on directories. /etc /bin /sbin /lib /dev

Define PCI

The more recent Peripheral Component Interconnect (PCI) CPU data bus makes sharing interrupts a bit easier, so PCI devices frequently end up sharing an IRQ. The ISA bus has become rare on computers made since 2001 or so.

Define ISA

The original Industry Standard Architecture (ISA) CPU data bus design makes sharing an interrupt between two devices tricky. Ideally, every ISA device should have its own IRQ.

Define CHS hard disk parameters

The parameters that compose the drive geometry include the following: • Heads Refers to the number of read/write heads in the drive • Cylinders Refers to the concentric parallel tracks on all sides of all platters in the hard disk drive. Imagine a hollow cylinder that penetrates down through all of the platters in a hard drive. Depending on how wide the cylinder is, you can fit a certain number of progressively wider cylinders, beginning in the center of the platters and working your way outward to the edge, within the drive platters. • Sectors Per Track Refers to the number of wedges the platters have been divided into. In addition to creating imaginary cylinders in the drive, you can also slice each platter up into imaginary pie-shaped wedges.

Which devices on a SCSI chain need termination enabled?

Those devices at either end of the chain.

What command would you use to interactively debug a ext2/ext3/ext4 file system? Should the device be unmounted?

You can interactively modify a filesystem's features using *debugfs*. This program provides the abilities of dumpe2fs, tune2fs, and many of Linux's normal file-manipulation tools all rolled into one. *Don't use it on a mounted filesystem* Display Filesystem Superblock Information Display Inode Information on a file or directory Undelete a File by typing undelete inode name Extract a File You can extract a file from the filesystem can be handy if a filesystem is badly damaged and you want to extract a critical file without mounting the filesystem. Manipulate Files Most of the commands described in Chapter 4 work within debugfs.

How would you set the IRQ, I/O Port, or IRQ of a PCI device?

You can use the *setpci* utility to directly query and adjust PCI devices' configurations. Common options are *-v* "verbose" and *-f* "force".

Why use *dumpe2fs [options] [device]* ?

dump ext2/ext3/ext4 filesystem information. The most important option is probably *-h*, which causes the utility to omit information about group descriptors.


संबंधित स्टडी सेट्स

Psychology Final - Quiz 3 - Connor

View Set

PRAXIS Music Content and Instruction

View Set

Production and Operations Management quizzes

View Set

Watson's Go To Birmingham Chapter 9 and 10

View Set

RAD REVIEW: PC3: Physical Assistance and Monitoring (96)

View Set