磁盘管理
n Lowlevel formatting, or physical formatting — Dividing a disk into sectors that the disk controller can read and write.
低级格式化或物理格式化——将磁盘分成磁盘控制器可以读写的扇区。
n To use a disk to hold files, the operating system still needs to record its own data structures on the disk.
要使用磁盘保存文件,操作系统仍然需要在磁盘上记录自己的数据结构。
l Partition the disk into one or more groups of cylinders.
将圆盘分成一组或多组圆柱体。
l Logical formatting or “making a file system”.
逻辑格式化或“制作文件系统”。
n Boot block initializes system.
引导块初始化系统。
l The bootstrap is stored in ROM.
引导存储在只读存储器中。
l Bootstrap loader program.
引导加载程序。
n Methods such as sector sparing used to handle bad blocks.
用于处理坏块的方法,如扇区备用。
Booting from a Disk in Windows 2000
在Windows 2000中从磁盘启动
n The Windows 2000 system places it boot code in the
视窗2000系统将其引导代码放在
first sector on the hard disk (Master boot record, MBR).
硬盘上的第一个扇区(主引导记录)。
n Windows 2000 allows a hard disk to be divided into one
视窗2000允许将一个硬盘分成两部分
or more partitions;one partition, identified as the boot
或更多分区;一个分区,标识为引导
partition, contains the OS ad device drivers.
分区,包含操作系统和设备驱动程序。
n Once the system identifies the boot partition, it reads
一旦系统识别出引导分区,它就会读取
the first sector from that partition (which is called the
该分区的第一个扇区(称为
boot sector) and continues with the remainder of the
引导扇区),并继续剩余的
boot process.
启动过程。
Booting from a Disk in Windows 2000
在Windows 2000中从磁盘启动
12.6 SwapSpace Management
交换空间管理
n Swapspace — Virtual memory uses disk space as an extension of main memory.
交换空间——虚拟内存使用磁盘空间作为主内存的扩展。
n Swapspace can be carved out of the normal file system or, more commonly, it can be in a separate disk partition.
交换空间可以从普通文件系统中分割出来,或者更常见的是,它可以位于单独的磁盘分区中。
n Swapspace management
交换空间管理
l 4.3BSD allocates swap space when process starts;holds
4.3流程启动时,BSD分配交换空间;拥有
text segment (the program) and data segment.
文本段(程序)和数据段。
l Kernel uses swap maps to track swapspace use.
内核使用交换图来跟踪交换空间的使用。
l Solaris 2 allocates swap space only when a page is forced out of physical memory, not when the virtual
Solaris 2仅在页面被强制从物理内存中取出时才分配交换空间,而不是在虚拟内存中
memory page is first created.
首先创建内存页面。
Swapping on Linux Systems
在Linux系统上交换
n Linux allows one or more swap areas to be established.
Linux允许建立一个或多个交换区。
n A swap area may be either a swap file on a regular file system or a rawswapspace partition.
交换区可以是常规文件系统上的交换文件,也可以是原始交换空间分区。
n Each swap area consists of a series of 4KB page slots,
每个交换区由一系列4KB的页槽组成,
which are used to hold swapped pages.
用于保存交换的页面。
n Each swap area is associated with a swap map.
每个交换区都与一个交换地图相关联。
l Counter = 0, the corresponding page slot is available.
计数器= 0,对应的页槽可用。
l Counter >0, the page slot is occupied by a swapped page.The value of the counter indicates the number of
计数器> 0,页面槽被交换的页面占用。计数器的值指示
mappings to the swapped page.Counter =3, the swapped paged is storing a region of memory shared by three processes.
交换页面的映射。计数器=3,交换的分页存储了三个进程共享的内存区域。
Data Structures for Swapping on Linux Systems
用于在Linux系统上交换的数据结构
The value of the counter indicates the
计数器的值指示
number of mappings to the swapped page
交换页面的映射数
12.7 RAID Structure
磁盘阵列结构
n RAID (Redundant Arrays of Independent Disks) multiple disk drives provides reliability via redundancy.
独立磁盘冗余阵列多个磁盘驱动器通过冗余提供可靠性。
n RAID is arranged into seven different levels.
磁盘阵列分为七个不同的级别。
n With multiple disks, we can improve the transfer rate by
借助多个磁盘,我们可以通过以下方式提高传输速率
striping data across the disks.
跨磁盘分条数据。
n Data striping consists of splitting the bits of each byte across multiple disks bit level striping
数据分条包括在多个磁盘的位级分条中分割每个字节的位
n Blocklevel striping consists of splitting the blocks of each file across multiple disks.
块级条带化包括将每个文件的块分割到多个磁盘上。
RAID (cont)
磁盘阵列(续)
n Several improvements in diskuse techniques involve the use of multiple disks working cooperatively.
磁盘使用技术的几项改进包括使用多个磁盘协同工作。
n Disk striping uses a group of disks as one storage unit.
磁盘条带化将一组磁盘作为一个存储单元。
n RAID schemes improve performance and improve the
磁盘阵列方案提高了性能,改善了
reliability of the storage system by storing redundant
通过存储冗余来提高存储系统的可靠性
data.
数据。
l Mirroring or shadowing keeps duplicate of each disk.
镜像或阴影保留每个磁盘的副本。
l Block interleaved parity uses much less redundancy.
块交错奇偶校验使用更少的冗余。
RAID (cont)
磁盘阵列(续)
n RAID level 0: RAID level 0 refers to disk arrays with
0级磁盘阵列:0级磁盘阵列是指具有以下特征的磁盘阵列
striping at the level of blocks but without any redundancy.
块级条带化,但没有任何冗余。
n RAID level 1: RAID level 1 refers to disk mirroring.
1级磁盘阵列:1级磁盘阵列是指磁盘镜像。
RAID (cont)
磁盘阵列(续)
n RAID level 2: RAID level 2 also known as memorystyle
磁盘阵列2级:磁盘阵列2级也称为内存模式
errorcorrectingcode (ECC) organization.The parity bits are used.The disks labeled P store the errorcorrection
纠错编码组织。使用奇偶校验位。标有P的磁盘存储错误更正
bits.
比特。
RAID (cont)
磁盘阵列(续)
n RAID level 3: RAID level 3 refers to bitinterleaved parity
RAID级别3: RAID级别3指的是位交错奇偶校验
organization improves on level 2 by taking into account the fact that, unlike memory systems, disk controllers
考虑到与内存系统不同,磁盘控制器
can detect whether a sector has been read correctly, so
可以检测扇区是否被正确读取,因此
a single parity bit can be used for error correction and for detection.
单个奇偶校验位可以用于纠错和检测。
RAID (cont)
磁盘阵列(续)
n RAID level 4: RAID level 0 refers to blockinterleaved
RAID级别4: RAID级别0指的是块交错
parity organization, uses blocklevel striping, as in RAID
奇偶校验组织,使用块级条带化,如在磁盘阵列中
0, and also keeps a parity block on a separate disk for corresponding blocks from N other disks.
0,并且还在单独的磁盘上为来自N个其他磁盘的相应块保留一个奇偶校验块。
RAID (cont)
磁盘阵列(续)
n RAID level 5: RAID level 5 refers to blockinterleaved
磁盘阵列5级:磁盘阵列5级是指块交错
distributed parity, differs from level 4 by spreading data
分布式奇偶校验不同于第4级,它扩展了数据
and parity among all N+1 disks, rather than storing data
和奇偶校验,而不是存储数据
in N disks and parity in one disk.
在N个磁盘中,奇偶校验在一个磁盘中。
l For each block, one of the disks stores the parity, and
对于每个数据块,其中一个磁盘存储奇偶校验,并且
the others store data.
其他人存储数据。
l With an array of five disks, the parity for the nth block is stored in disk (n mod 5)+1;the nth blocks of the
对于五个磁盘的阵列,第n个数据块的奇偶校验存储在磁盘(n mod 5)+1中;的第n个块
other four disks store actual data for the block.
其他四个磁盘存储块的实际数据。
l A parity block cannot store parity for the blocks in the same disk.
奇偶校验块不能在同一个磁盘中存储数据块的奇偶校验。
RAID (cont)
磁盘阵列(续)
n RAID level 6, P+Q redundancy scheme, is much like RAID
RAID 6级,P+Q冗余方案,非常类似于RAID
5 but stores extra redundant information to guard
5,但存储额外的冗余信息来保护
against multiple disk failures.
防止多个磁盘故障。
l Instead of parity, errorcorrecting codes such as ReedSolomon codes are used.2 bits of redundant
使用诸如ReedSolomon码之类的纠错码来代替奇偶校验码。2位冗余
data are stored for every 4 bits of data compared
每比较4位数据就存储一次数据
with 1 parity bit in level 5 and the system can
在第5级中具有1个奇偶校验位,并且系统可以
tolerate two disk failures.
容忍两个磁盘故障。
RAID Levels
磁盘阵列级别
RAID (cont)
磁盘阵列(续)
n RAID 0 provides the performance,
RAID 0提供了最佳性能,
n RAID 1 provides the reliability.
RAID 1提供了可靠性。
n RAID 0 +1 : A set of disks are striped, and then the stripe
RAID 0 +1:一组磁盘被条带化,然后条带化
is mirrored to another, equivalent strip
镜像到另一个等效的条带
n RAID 1+0: Disks are mirrored in pairs and then the resulting mirrored pairs are striped.
RAID 1+0:磁盘成对镜像,然后镜像对被分条。
n RAID 1+0 has some theoretical advantages over RAID
RAID 1+0在理论上比RAID有一些优势
0+1.
0+1.
n For example, if a single disk fails in RAID 0+1, an entire strip is inaccessible, leaving only the other strip available.With a failure in RAID 1+0, a single disk is
例如,如果RAID 0+1中的一个磁盘出现故障,整个条带都不可访问,只剩下另一个条带可用。当RAID 1+0出现故障时,单个磁盘
unavailable, but the disk that mirrors it is still available,
不可用,但镜像它的磁盘仍然可用,
as are all the rest of the disks.
其他磁盘也是如此。
RAID (0 + 1) and (1 + 0)
RAID (0 + 1)和(1 + 0)
12.8 StableStorage Implementation
12.8稳定存储实施
n Writeahead log scheme requires stable storage.
提前写日志方案需要稳定的存储。
n To implement stable storage:
为了实现稳定存储:
l Replicate information on more than one nonvolatile
在多个非易失性存储器上复制信息
storage media with independent failure modes.
具有独立故障模式的存储介质。
l Update information in a controlled manner to ensure
以受控的方式更新信息,以确保
that we can recover the stable data after any failure
我们可以在任何失败后恢复稳定的数据
during data transfer or recovery.
在数据传输或恢复期间。
12.9 Tertiary Storage Structure