Bài giảng Nhập môn Hệ điều hành: Disk management - Nguyễn Xuân Vinh

48 92 0
Bài giảng Nhập môn Hệ điều hành: Disk management - Nguyễn Xuân Vinh

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Ngày nay thiết bị lưu trữ sử dụng nhiều loại ổ cứng với mục đích khác nhau. Chương này sẽ trình bày những nội dung liên quan đến việc quản lý ổ đĩa và các thiết bị lưu trữ trong hệ điều hành. Mời các bạn cùng tham khảo để nắm bắt các nội dung chi tiết.

GV: NGUYỄN XUÂN VINH NHẬP MÔN HỆ ĐIỀU HÀNH 1/15/16 /XX NHẬP MÔN HỆ ĐIỀU HÀNH INTRODUCTION TO OPERATING SYSTEMS [214242] DISK MANAGEMENT Nguyễn Xuân Vinh nguyenxuanvinh@hcmuaf.edu GV: NGUYỄN XN VINH NHẬP MƠN HỆ ĐIỀU HÀNH 1/15/16 /XX Giới thiệu • Ngày nay thiết bị lưu trữ sử dụng nhiều loại ổ cứng với mục  đích khác nhau – SSD – HDD (3.5 inches, 2.5 inches) • 5400 rpm • 7200 rpm /XX 1/15/16 NHẬP MÔN HỆ ĐIỀU HÀNH GV: NGUYỄN XUÂN VINH Giới thiệu 512G = 670 USD 1TB = 150 USD /XX 1/15/16 NHẬP MÔN HỆ ĐIỀU HÀNH GV: NGUYỄN XUÂN VINH SSD GV: NGUYỄN XUÂN VINH Giới thiệu • • • /XX 1/15/16 NHẬP MƠN HỆ ĐIỀU HÀNH • 1 sector = 512byte  1 block = 4K,8K,16K,32K = nhiều sector 1 track = 63 sector  15 tracks = 1 cylinder  GV: NGUYỄN XN VINH NHẬP MƠN HỆ ĐIỀU HÀNH 1/15/16 /XX Chuẩn giao tiếp Các chuẩn giao tiếp ổ đĩa cứng Giao tiếp (viết tắt) SCSI Tên tiếng Anh đầy đủ Small Computer System Interface Tốc độ truyền liệu Nhiều loại, xem thêm Ultra160 SCSI 160 MBps Ultra320 SCSI 320 MBps ATA Advanced Technology Attachment Max = 133 MBps SATA Serial ATA 150 150 MBps SATA II Serial ATA 300 300 MBps SATA Serial ATA 600 600 MBps SAS Serial Attached SCSI 12 Gbps GV: NGUYỄN XUÂN VINH Quản lý đĩa • /XX 1/15/16 NHẬP MƠN HỆ ĐIỀU HÀNH • • Tất cả các ổ đĩa đều là file trong thư mục /dev với ký hiệu – hd*: đĩa IDE (VD: hda, hdb, hdc, …) – sd*: đĩa SCSI (VD: sda, sdb, sdc, …) Tối đa 8 ổ IDE và 16 ổ SCSI Tối đa 16 partition cho ổ IDE và 15 partition cho ổ SCSI GV: NGUYỄN XUÂN VINH NHẬP MÔN HỆ ĐIỀU HÀNH 1/15/16 /XX Chia đĩa fdisk  /dev/sda: lệnh dùng để chia phân khu ổ đĩa Option: – m : menu – n : tạo 1 phân khu đĩa mới – p : hiện các phân khu đã chia – w: lưu lại  GV: NGUYỄN XUÂN VINH NHẬP MÔN HỆ ĐIỀU HÀNH Các mount point sẽ tự động mất khi khởi động lại máy /XX 1/15/16 Format đĩa mkfs –t ext4 /dev/sda1: Format partition sda1 với filesystem là ext4 mount /dev/sda1 /data: ánh xạ partition sda1 vào thư mục data df –T: kiểm tra lại định dạng file system và các mount point GV: NGUYỄN XN VINH NHẬP MƠN HỆ ĐIỀU HÀNH 1/15/16 /XX 10 /etc/fstab • Chứ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ự  động 34 /XX 1/15/16 NHẬP MÔN HỆ ĐIỀU HÀNH GV: NGUYỄN XUÂN VINH RAID Level-2 Bit-redundancy (Hemming Code ECC) GV: NGUYỄN XUÂN VINH NHẬP MÔN HỆ ĐIỀU HÀNH 1/15/16 /XX 35 RAID Level-2 • Reconstructing data – assume data striped across eight disks – correct data: 10011010 – parity: 0 – data read: 10011110 – if we can determine that disk 2 is in error – just use read data and parity to know which bit to flip GV: NGUYỄN XN VINH NHẬP MƠN HỆ ĐIỀU HÀNH RAID Level-2 • • Requires fewer disks than Level­1 to provide  redundancy Still needs quite a few more disks – • Big problem is performance – – • 1/15/16 /XX must read data plus ECC code from other disks for a write, have to modify data, ECC, and parity disks Another big problem is only one read at a time – 36 for 10 data disks need 4 check disks plus parity disk – while a read of a single block can be done in parallel multiple blocks from multiple files can’t be read because of the  bit­interleaved placement of data GV: NGUYỄN XUÂN VINH NHẬP MÔN HỆ ĐIỀU HÀNH 1/15/16 /XX 37 RAID Level-3: Bit-interleaved Parity • • • One big problem with Level­2 are the disks needed to detect  which disk had an error Modern disks can already determine if there is an error – using ECC codes with each sector So just need to include a parity disk – if a sector is bad, the disk itself tells us, and use the parity disk  to correct it GV: NGUYỄN XUÂN VINH NHẬP MÔN HỆ ĐIỀU HÀNH 1/15/16 /XX 38 RAID Level-4 • • Big problem with Level­2 and Level­3 is the bit interleavening – to access a single file block of data, must access all the disks – allows good parallelism for a single access but doesn’t allow  multiple I/O’s Level­4 interleaves file blocks – allows multiple small I/O’s to be done at once GV: NGUYỄN XN VINH RAID Level-4 • • 39 /XX 1/15/16 NHẬP MƠN HỆ ĐIỀU HÀNH • Still use a single disk for parity Now the parity is calculated over data from multiple blocks – Level­2,3 calculate it over a single block If an error detected, need to read other blocks on other disks to  reconstruct data GV: NGUYỄN XUÂN VINH Level-4 vs Level-2,3 a b c NHẬP MÔN HỆ ĐIỀU HÀNH 4 different disks Transfer Units d a0 b0 c0 d0 a b a2 a3 a1 b1 c1 d1 a2 b2 c2 d2 c0 c1 c2 c3 a3 b3 c3 d3 1/15/16 L3 c d L3 Parity a0 a1 b0 b1 L4 40 /XX L4 Parity b2 b3 d0 d1 d2 d3 GV: NGUYỄN XUÂN VINH NHẬP MƠN HỆ ĐIỀU HÀNH 1/15/16 /XX 41 RAID Level-4 • • Reads are simple to understand – want to read block A, read it from disk 0 – if there is an error, read in blocks B,C, D, and parity  block and calculate correct data What about writes? – it looks like a write still requires access to 4 data disks  to recalculate the parity data – not true, can use the following formula • new parity = (old data xor new data) xor old parity – a write requires 2 reads and 2 writes GV: NGUYỄN XUÂN VINH RAID Level-4 • • 42 /XX 1/15/16 NHẬP MƠN HỆ ĐIỀU HÀNH • Doing multiple small reads is now faster than before However, writes are still very slow – this is because of calculating and writing the parity blocks Also, only one write is allowed at a time – all writes must access the check disk so other writes have to  wait GV: NGUYỄN XUÂN VINH NHẬP MÔN HỆ ĐIỀU HÀNH 1/15/16 /XX 43 RAID Level-5 (Block-level Distributed Parity) Cần ổ đĩa liệu chia lưu ổ đĩa lưu backup ổ đĩa lại Tăng tốc độ độ an tồn GV: NGUYỄN XN VINH RAID Level-5 • 44 /XX 1/15/16 NHẬP MƠN HỆ ĐIỀU HÀNH • • Level­5 stripes file data and check data over all the disks – no longer a single check disk – no more write bottleneck Drastically improves the performance of multiple writes – they can now be done in parallel Slightly improves reads – one more disk to use for reading GV: NGUYỄN XUÂN VINH NHẬP MÔN HỆ ĐIỀU HÀNH 1/15/16 /XX 45 RAID Level-5 Level­4 check disk data disks Level­5 data and check disks S0 S0 S1 S1 S2 S2 S3 S3 S4 S4 S5 S5 GV: NGUYỄN XUÂN VINH RAID Level-5 • 46 /XX 1/15/16 NHẬP MƠN HỆ ĐIỀU HÀNH • • 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 GV: NGUYỄN XN VINH RAID Level-10 • • 47 /XX 1/15/16 NHẬP MƠN HỆ ĐIỀU HÀNH • • • Combine Level­0 and Level­1 Stripe a files data across multiple disks – gives great read/write performance Mirror each strip onto a second disk – gives the best redundancy The most high performance system The most expensive system 48 /XX 1/15/16 NHẬP MÔN HỆ ĐIỀU HÀNH GV: NGUYỄN XUÂN VINH HỎI ĐÁP ... 26 /XX 1/15/16 NHẬP MÔN HỆ ĐIỀU HÀNH RAID Level-0 Disk 0 Disk 1 block 4 27 /XX 1/15/16 NHẬP MÔN HỆ ĐIỀU HÀNH GV: NGUYỄN XUÂN VINH RAID Level-0 GV: NGUYỄN XUÂN VINH NHẬP MÔN HỆ ĐIỀU HÀNH 1/15/16... 7200 rpm /XX 1/15/16 NHẬP MÔN HỆ ĐIỀU HÀNH GV: NGUYỄN XUÂN VINH Giới thiệu 512G = 670 USD 1TB = 150 USD /XX 1/15/16 NHẬP MÔN HỆ ĐIỀU HÀNH GV: NGUYỄN XUÂN VINH SSD GV: NGUYỄN XUÂN VINH Giới thiệu •... 4     block 4 30 /XX 1/15/16 NHẬP MÔN HỆ ĐIỀU HÀNH RAID Level-1 (Mirror) Disk 0 Disk 1 block 4 31 /XX 1/15/16 NHẬP MÔN HỆ ĐIỀU HÀNH GV: NGUYỄN XUÂN VINH RAID Level-1 (Mirror)

Ngày đăng: 30/01/2020, 02:23

Từ khóa liên quan

Mục lục

  • Slide 1

  • Giới thiệu

  • Giới thiệu

  • SSD

  • Giới thiệu

  • Chuẩn giao tiếp

  • Quản lý đĩa

  • Chia đĩa

  • Format đĩa

  • /etc/fstab

  • Mass Storage

  • RAID

  • Hardware-based RAID

  • Software-based RAID

  • RAID levels comparision

  • Striping

  • Parity

  • Mirroring

  • Parity

  • EVEN PARITY BIT

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan