Nhập môn hệ điều hành - Disk management
Notice that for Level-4 a write to sector 0 on disk 2 and sector 1 on disk 3 both require a write to disk five for check information
In Level-5, a write to sector 0 on disk 2 and sector 1 on disk 3 require writes to different disks for check information (disks 5 and 4, respectively)
Best of all worlds
read and write performance close to that of RAID Level-1
requires as much disk space as Levels-3,4
48 trang |
Chia sẻ: nguyenlam99 | Lượt xem: 894 | Lượt tải: 0
Bạn đang xem trước 20 trang tài liệu Nhập môn hệ điều hành - Disk management, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
DISK MANAGEMENTNguyễn Xuân Vinhnguyenxuanvinh@hcmuaf.edu.vnNHẬP MÔN HỆ ĐIỀU HÀNHINTRODUCTION TO OPERATING SYSTEMS[214242]Giới thiệuNgày nay thiết bị lưu trữ sử dụng nhiều loại ổ cứng với mục đích khác nhauSSDHDD (3.5 inches, 2.5 inches)5400 rpm7200 rpmGiới thiệu512G = 670 USD1TB = 150 USDSSDGiới thiệu1 sector = 512byte 1 block = 4K,8K,16K,32K = nhiều sector1 track = 63 sector 15 tracks = 1 cylinder Chuẩn giao tiếpCác chuẩn giao tiếp của ổ đĩa cứngGiao tiếp(viết tắt)Tên tiếng Anh đầy đủTốc độtruyền dữ liệuSCSISmall ComputerSystem InterfaceNhiều loại, xem thêmUltra160 SCSI160 MBpsUltra320 SCSI320 MBpsATAAdvancedTechnology AttachmentMax = 133 MBpsSATASerial ATA 150150 MBpsSATA IISerial ATA 300300 MBpsSATA 3Serial ATA 600600 MBpsSASSerial Attached SCSI12 GbpsQuản lý đĩaTất cả các ổ đĩa đều là file trong thư mục /dev với ký hiệuhd*: đĩa IDE (VD: hda, hdb, hdc, )sd*: đĩa SCSI (VD: sda, sdb, sdc, )Tối đa 8 ổ IDE và 16 ổ SCSITối đa 16 partition cho ổ IDE và 15 partition cho ổ SCSIChia đĩafdisk /dev/sda: lệnh dùng để chia phân khu ổ đĩaOption:m : menun : tạo 1 phân khu đĩa mớip : hiện các phân khu đã chiaw: lưu lại Format đĩamkfs –t ext4 /dev/sda1: Format partition sda1 với filesystem là ext4mount /dev/sda1 /data: ánh xạ partition sda1 vào thư mục datadf –T: kiểm tra lại định dạng file system và các mount pointCác mount point sẽ tự động mất khi khởi động lại máy/etc/fstabChứa danh sách các mount point khi khởi động: hệ thống sẽ thực thi file này để xem danh sách các moun point và mout tự độngMass StorageMany systems today need to store many terabytes of dataDon’t want to use single, large disktoo expensivefailures could be catastrophicWould prefer to use many smaller disksRAIDRedundant Array of Inexpensive DisksBasic idea is to connect multiple disks together to providelarge storage capacityfaster access to reading dataredundant dataMany different levels of RAID systemsdiffering levels of redundancy, error checking, capacity, and costRAID implementationsHardware-based RAIDSoftware-based RAIDHardware-based RAIDOn a desktop system, a hardware RAID controller may be an expansion card connected to a bus (e.g. PCI or PCIe), a component integrated into the motherboard; there are controllers for supporting most types of drive technology, such as IDE/ATA, SATA, SCSI, SSA, Fibre Channel, and sometimes even a combination. The controller and drives may be in a stand-alone enclosure, rather than inside a computer, and the enclosure may be directly attached to a computer, or connected via a SANHot swapSoftware-based RAIDRAID 0: Block-level striping without parity or mirroringRAID 1: Mirroring without parity or stripingRAID 2: Bit-level striping with dedicated Hamming-code parityRAID 3: Byte-level striping with dedicated parityRAID 4: Block-level striping with dedicated parityRAID 5: Block-level striping with distributed parityRAID 6: Block-level striping with double distributed parityRAID 10: Mirroring without parity, and block-level stripingRAID levels comparisionLevel# DriveSpaceEfficiencyFault ToleranceReadPerformanceWritePerformanceFigureRAID 0210 (none)nXnXRAID 121/nn - 1nX****1XRAID 231 – 1/n – log2(n-1)*VariableVariableStripingTake file data and map it to different disksAllows for reading data in parallelfile datablock 1block 0block 2block 3Disk 0Disk 1Disk 2Disk 3ParityWay to do error checking and correctionAdd up all the bits that are 1if even number, set parity bit to 0if odd number, set parity bit to 1To actually implement this, do an exclusive OR of all the bits being consideredConsider the following 2 bytes byte parity 10110011 1 01101010 0If a single bit is bad, it is possible to correct itMirroringKeep to copies of data on two separate disksGives good error recoveryif some data is lost, get it from the other sourceExpensiverequires twice as many disksWrite performance can be slowhave to write data to two different spotsRead performance is enhancedcan read data from file in parallel7 bits of data(count of 1 bits)8 bits including parityevenodd0000000 (0)00000000 (0)10000000 (1)1010001 (3)11010001 (4)01010001 (3)1101001 (4)01101001 (4)11101001 (5)1111111 (7)11111111 (8)01111111 (7)Là bit cho biết tổng số bit 1 là chẵn hay lẻDùng để phát hiện lỗi khi truyền dữ liệu và không thể sửa lỗiParityA wants to transmit: 1001 A computes parity bit value: 1^0^0^1 = 0 A adds parity bit and sends: 10010 B receives: 10010 B computes parity: 1^0^0^1 = 0 B reports correct transmission after observing expected even result.EVEN PARITY BITA wants to transmit: 1001 A computes parity bit value: 1^0^0^1 = 0 A adds parity bit and sends: 10010 *** TRANSMISSION ERROR *** B receives: 11010 B computes overall parity: 1^1^0^1 = 1B reports incorrect transmission after observing unexpected odd result.EVEN PARITY BITA wants to transmit: 1001 A computes parity bit value: 1^0^0^1 = 1 A adds parity bit and sends: 10011 B receives: 10011 B computes overall parity: 1^0^0^1 = 1 B reports correct transmission after observing expected odd result.ODD PARITY BITA wants to transmit: 1001 A computes parity bit value: 1^0^0^1 = 1 A adds parity bit and sends: 10011 TRANSMISSION ERROR ***B receives: 11011 B computes overall parity: 1^1^0^1 = 0 B reports correct transmission after observing expected odd result.ODD PARITY BITỔ đĩa 101101101Ổ đĩa 211010100Ổ đĩa 310111001XOR=Ổ đĩa 101101101Ổ đĩa 31011100111010100XOR=DỮ LIỆU BỊ MẤTCách lưu dữ liệuRAID Level-0Often called stripingBreak a file into blocks of dataStripe the blocks across disks in the systemSimple to implementdisk = file block % number of diskssector = file block / number of disksprovides no redundancy or error detectionimportant to consider because lots of disks means low Mean Time To Failure (MTTF)RAID Level-0file datablock 1block 0block 2block 3block 4Disk 0Disk 10 block 01 block 22 block 4345sectors0 block 11 block 32345sectorsRAID Level-0RAID Level-0Ưu điểm: tăng tốc độ đọc ghi lên n lần Nhược điểm: khẳ năng mất dữ liệu tăng lên n lầnRAID Level-1 (Mirror)A complete file is stored on a single diskA second disk contains an exact copy of the fileProvides complete redundancy of dataRead performance can be improvedfile data can be read in parallelWrite performance suffersmust write the data out twiceMost expensive RAID implementationrequires twice as much storage spacefile datablock 1block 0block 2block 3block 4Disk 0Disk 10 block 01 block 12 block 23 block 34 block 45sectors0 block 01 block 12 block 23 block 34 block 45sectorsRAID Level-1 (Mirror)RAID Level-1 (Mirror)RAID Level-2Stripes data across disks similar to Level-0difference is data is bit interleaved instead of block interleavedUses ECC to monitor correctness of information on diskMultiple disks record the ECC information to determine which disk is in faultA parity disk is then used to reconstruct corrupted or lost datafile datablock 1block 0block 2block 3block 4Data DiskData DiskECC DiskParity DiskECC DiskRAID Level-2RAID Level-2Bit-redundancy (Hemming Code ECC)RAID Level-2Reconstructing dataassume data striped across eight diskscorrect data: 10011010parity: 0data read: 10011110if we can determine that disk 2 is in errorjust use read data and parity to know which bit to flipRAID Level-2Requires fewer disks than Level-1 to provide redundancyStill needs quite a few more disksfor 10 data disks need 4 check disks plus parity diskBig problem is performancemust read data plus ECC code from other disksfor a write, have to modify data, ECC, and parity disksAnother big problem is only one read at a timewhile a read of a single block can be done in parallelmultiple blocks from multiple files can’t be read because of the bit-interleaved placement of dataRAID Level-3: Bit-interleaved ParityOne big problem with Level-2 are the disks needed to detect which disk had an errorModern disks can already determine if there is an errorusing ECC codes with each sectorSo just need to include a parity diskif a sector is bad, the disk itself tells us, and use the parity disk to correct itRAID Level-4Big problem with Level-2 and Level-3 is the bit interleaveningto access a single file block of data, must access all the disksallows good parallelism for a single access but doesn’t allow multiple I/O’sLevel-4 interleaves file blocksallows multiple small I/O’s to be done at onceRAID Level-4Still use a single disk for parityNow the parity is calculated over data from multiple blocksLevel-2,3 calculate it over a single blockIf an error detected, need to read other blocks on other disks to reconstruct dataTransfer UnitsL3L3 ParityL4abcd0123a0b0c0d0a1b1c1d1a2b2c2d2a3b3c3d3abcda0a1a2a3L4 Parity0123b0b1b2b3c0c1c2c3d0d1d2d34 different disksLevel-4 vs. Level-2,3Reads are simple to understandwant to read block A, read it from disk 0if there is an error, read in blocks B,C, D, and parity block and calculate correct dataWhat about writes?it looks like a write still requires access to 4 data disks to recalculate the parity datanot true, can use the following formulanew parity = (old data xor new data) xor old paritya write requires 2 reads and 2 writesRAID Level-4RAID Level-4Doing multiple small reads is now faster than beforeHowever, writes are still very slowthis is because of calculating and writing the parity blocksAlso, only one write is allowed at a timeall writes must access the check disk so other writes have to waitRAID Level-5 (Block-level Distributed Parity)Cần ít nhất 3 ổ đĩa.1 dữ liệu sẽ chia lưu trên 2 ổ đĩa và lưu backup trên ổ đĩa còn lạiTăng tốc độ và độ an toànRAID Level-5Level-5 stripes file data and check data over all the disksno longer a single check diskno more write bottleneckDrastically improves the performance of multiple writesthey can now be done in parallelSlightly improves readsone more disk to use for readingRAID Level-5Level-4Level-512345data diskscheckdiskdata and check disks12345S0S1S2S3S4S5S0S1S2S3S4S5RAID Level-5Notice that for Level-4 a write to sector 0 on disk 2 and sector 1 on disk 3 both require a write to disk five for check informationIn Level-5, a write to sector 0 on disk 2 and sector 1 on disk 3 require writes to different disks for check information (disks 5 and 4, respectively) Best of all worldsread and write performance close to that of RAID Level-1requires as much disk space as Levels-3,4RAID Level-10Combine Level-0 and Level-1Stripe a files data across multiple disksgives great read/write performanceMirror each strip onto a second diskgives the best redundancyThe most high performance systemThe most expensive systemHỎI ĐÁP
Các file đính kèm theo tài liệu này:
- ch03_diskmanagement_raid_2551.pptx