CSC414 “Introduction to UNIX/ LINUX”
Download
Report
Transcript CSC414 “Introduction to UNIX/ LINUX”
CSC414 “Introduction to
UNIX/ Linux”
Lecture 3
2015
Qassim University, College of Computer, 9th level
Schedule
1. Introduction to Unix/ Linux
2. Kernel Structure and Device Drivers.
3. System and Storage Structure.
4. Processes and Inter- Process Communication.
5. Shell Programming.
6. User Management and Disk Quota.
7. System Management.
8. Network Management.
9. Security.
10. Advanced System Administration.
2
2015
Qassim University, College of Computer, 9th level
Contents:
• Disks Types
• Storage Hardware Interfaces
• Storage management layers
• Overview
• Disk Partitioning.
• RAID: Redundant Arrays of Inexpensive Disks.
• Logical Volume Management.
• Linux filesystems: the ext family
• Boot Loader.
3
2015
Qassim University, College of Computer, 9th level
4
Disks Types:
Hard disks
A typical hard drive contains several rotating platters coated with
magnetic film. They are read and written by tiny skating heads
that are mounted on a metal arm that swings back and forth to
position them.
2015
Qassim University, College of Computer, 9th level
5
Cont.
Solid state disks
SSDs spread reads and writes across banks of flash memory
cells, which are individually rather slow in comparison to
modern hard disks. But because of parallelism, the SSD as a
whole meets or exceeds the bandwidth of a traditional disk.
The great strength of SSDs is that they continue to
perform well when data is read or written at random, an
access pattern that’s predominant in real-world use.
2015
Qassim University, College of Computer, 9th level
6
Storage Hardware Interfaces
• ATA (Advanced Technology Attachment), known in earlier revisions
as IDE, was developed as a simple, low-cost interface for PCs. It
was originally called Integrated Drive Electronics because it put the
hardware controller in the same box as the disk platters and used a
relatively high-level protocol for communication between the
computer and the disks.
2015
Qassim University, College of Computer, 9th level
7
Cont.
• Serial ATA, SATA.. In addition to supporting much higher transfer
rates (currently 3 Gb/s, with 6 Gb/s soon to arrive), SATA simplifies
connectivity with tidier cabling and a longer maximum cable length.
SATA has native support for hot-swapping and (optional) command
queuing.
2015
Qassim University, College of Computer, 9th level
8
Cont.
• Small Computer System Interface, SCSI, is one of the most widely
supported disk interfaces. It supports multiple disks on a bus and
various speeds and communication styles. In the past it was used for
disks, tape drives, scanners, and printers, but these days most
peripherals have abandoned SCSI in favor of USB.
2015
Qassim University, College of Computer, 9th level
9
Storage management layers:
A storage device is anything that looks like a disk.
It can be a hard disk, a flash drive, an SSD, an external RAID array
implemented in hardware.
The exact hardware doesn’t matter, as long as the device allows random
access, handles block I/O, and is represented by a device file.
• Partition.
• RAID array.
• Volume groups and logical volumes.
• Filesystem
2015
Qassim University, College of Computer, 9th level
10
Partition
• fixed-size subsection of a storage device.
• Each partition has its own device file and acts much like an
•
•
•
•
independent storage device.
For efficiency, the same driver that handles the underlying
device usually implements partitioning.
Most partitioning schemes consume a few blocks at the
start of the device to record the ranges of blocks that make
up each partition.
Reduce the risk of system failure in case a partition
becomes full.
Encapsulate your data. Since file system corruption is local
to a partition, you stand to lose only some of your data if an
accident occurs.
2015
Qassim University, College of Computer, 9th level
11
Partition Fields
• Device: This field displays the partition's device name.
• Start: This field shows the sector on your hard drive where the
partition begins.
• End: This field shows the sector on your hard drive where the partition
ends.
• Size: This field shows the partition's size (in MB).
• Type: This field shows the partition's type (for example, ext2, ext3, or
vfat).
• Mount Point: A mount point is the location within the directory
hierarchy at which a volume exists; the volume is "mounted" at this
location. This field indicates where the partition will be mounted.
2015
Qassim University, College of Computer, 9th level
12
Cont.
Unless you have a reason for doing otherwise, it is recommended that you
create the following partitions:
•/boot partition – contains kernel images and grub configuration and
commands
•/ partition
•/var partition
•/home partition
•Any other partition based on application (e.g /usr/local for squid)
•swap partition — swap partitions are used to support virtual memory. In other
words, data is written to a swap partition when there is not enough RAM to
store the data your system is processing. The size of your swap partition
should be equal to twice your computer's RAM.
2015
Qassim University, College of Computer, 9th level
Cont.
• IDE Disk Partitions
• /dev/hda (Primary Master Disk)
• /dev/hda1 (First Primary Partition)
• /dev/hda2 (Second Primary Partition)
• /dev/hdb (Primary Slave Partition)
• /dev/hdb1
• /dev/hdc (Secondary Master/Slave Partition)
• /dev/hdc1
• SCSI Disk Partitions
• /dev/sda1, /dev/sda2
• /dev/sdb1, /dev/sdb2
• /dev/sdc1, /dev/sdc2
13
2015
Qassim University, College of Computer, 9th level
14
RAID: Redundant Arrays of Inexpensive
Disks
• combines multiple storage devices into one virtualized device.
• Depending on how you set up the array, this configuration can
increase performance (by reading or writing disks in parallel).
• Increase reliability (by duplicating or parity-checking data across
multiple disks).
• RAID can be implemented by the operating system or by various
types of hardware.
• As the name suggests, RAID is typically conceived of as an
aggregation of bare drives, but modern implementations let you use
as a component of a RAID array anything that acts like a disk.
2015
Qassim University, College of Computer, 9th level
15
Logical Volume Management
• These systems aggregate physical devices to form pools of storage
called volume groups.
• The administrator can then subdivide this pool into logical volumes in
much the same way that disks of yore were divided into partitions.
• Since the LVM adds a layer of indirection between logical and
physical blocks, it can freeze the logical state of a volume simply by
making a copy of the mapping table.
2015
Qassim University, College of Computer, 9th level
16
Cont.
• Logical volumes are more flexible and powerful than disk partitions.
•
•
•
•
•
Here are some of the magical operations a volume manager lets you
carry out:
Move logical volumes among different physical devices
Grow and shrink logical volumes on the fly
Take copy-on-write “snapshots” of logical volumes
Replace on-line drives without interrupting service
Incorporate mirroring or striping in your logical volumes
2015
Qassim University, College of Computer, 9th level
17
Linux filesystems: the ext family.
• The “second extended filesystem,” ext2, was for a long time the
mainstream Linux standard
• Ext3 adds journaling capability to the existing ext2 code, a
conceptually simple modification that increases reliability
enormously. Even more interestingly, the ext3 extensions were
implemented without changing the fundamental structure of ext2. In
fact, you can still mount an ext3 filesystem as an ext2 filesystem—it
just won’t have journaling enabled.
• Ext4 is a comparatively incremental update that raises a few size
limits, increases the performance of certain operations.
• The on-disk format is compatible enough that ext2 and ext3
filesystems can be mounted as ext4 filesystems. Furthermore, ext4
filesystems can be mounted as if they were ext3 filesystems
provided that the extent system has not been used.
2015
Qassim University, College of Computer, 9th level
18
Boot Loader
• In order for the BIOS to load an OS it looks for instructions on the
first sector of a hard drive.
• On the first sector of the hard drive resides the master boot record
(MBR), and is where a boot loader is initialized.
• Depending on the boot loader, additional files may be stored and
read from a partition on the hard drive.
• After this step the boot loader begins to start the operating system,
and is not used again until the next boot.
2015
Qassim University, College of Computer, 9th level
Reading
• Chapter 8 form “Unix® and Linux® System Administration
Handbook, Fourth Edition”
19