Disk
Management
Disk Management
Disk formatting
–Low-level formatting, or physical formatting
–Dividing a disk into sectors that the disk
controller can read and write.
• Boot Block
• Bad Block
Disk Formatting
• Low-level formatting, or physical
formatting
• Divide a disk into sectors that the
controller can read and write
–A new disk is a blank state –Fill each
sector with a special data structure:
header –data –trailer
Disk Formatting (con..)
• Header and Trailer contains information used by
disk controller
–A sector number and an error-correcting
code (ECC)
• When the controller writes a sector of data
–ECC is updated with a value calculated from
all the bytes in the data area
• When the sector is read, ECC is recalculated
and is compared with the stored value  verify
the data is correct
Disk Partition
• To use a disk to hold files, OS still needs
to record its own data structures on the
disk
• Partition the disk into one or more groups
of cylinders
–Each partition can be treated as a
separate disk
Disk Partition (con..)
• Logical formatting or “making a file
system”
–Store the initial file-system data
structure onto the disk…
• Maps of free and allocated space (FAT or
innode)
• An initial empty directory NCHU System &
Network Lab
Raw Disk
• Use a disk partition as a large sequential
array of logical blocks
–Without any file-system data
structures
• This array is called raw disk
–The I/Os to the array is called raw I/O
Example –swap space
Raw Disk (con..)
• Raw I/O bypasses all the file-system
services
–Such as the buffer cache, file locking,
pre-fetching, space allocation, file names,
and directories
Boot Block
• Bootstrap program initializes system. –
Initialize CPU registers, device controllers,
main memory –Start OS
• In PC, two-step approaches
–A tiny bootstrap program is stored in
ROM.
• Bring in a full bootstrap program from
disk, a bootstrap loader
Boot Block (con..)
–Full bootstrap program.
• Stored in boot block: at a fixed location on
the disk
• Load the OS and start the OS
• This disk is called boot disk or system disk
Bad Blocks
• IDE –MS-DOS format : performs logical
formatting
• Scan the disk to find bad blocks
• Write a special value into the
corresponding FAT entry for bad blocks
–MS-DOS chkdsk : if blocks go bad
during operations •Search and lock bad
blocks
Bad Blocks (Cont.)
• SCSI –Controller maintains a list of bad
blocks on the disk
–Low-level formatting will set aside
spare sectors
• OS don’t know –Sector sparing (or
forwarding):
•Controller replaces each bad sector
logically with one of the spare sectors
Bad Blocks (Cont.)
• Invalidate optimization by OS’s disk
scheduling
–Sol: Each cylinder has a few spare
sectors
• Another technique: sector slipping
–Ex. 17 defective, spare follows sector
202 •Spare  202  201  … 18  17
Booting from a Disk in
Windows 2000

Disk management

  • 1.
  • 2.
    Disk Management Disk formatting –Low-levelformatting, or physical formatting –Dividing a disk into sectors that the disk controller can read and write. • Boot Block • Bad Block
  • 3.
    Disk Formatting • Low-levelformatting, or physical formatting • Divide a disk into sectors that the controller can read and write –A new disk is a blank state –Fill each sector with a special data structure: header –data –trailer
  • 4.
    Disk Formatting (con..) •Header and Trailer contains information used by disk controller –A sector number and an error-correcting code (ECC) • When the controller writes a sector of data –ECC is updated with a value calculated from all the bytes in the data area • When the sector is read, ECC is recalculated and is compared with the stored value  verify the data is correct
  • 5.
    Disk Partition • Touse a disk to hold files, OS still needs to record its own data structures on the disk • Partition the disk into one or more groups of cylinders –Each partition can be treated as a separate disk
  • 6.
    Disk Partition (con..) •Logical formatting or “making a file system” –Store the initial file-system data structure onto the disk… • Maps of free and allocated space (FAT or innode) • An initial empty directory NCHU System & Network Lab
  • 7.
    Raw Disk • Usea disk partition as a large sequential array of logical blocks –Without any file-system data structures • This array is called raw disk –The I/Os to the array is called raw I/O Example –swap space
  • 8.
    Raw Disk (con..) •Raw I/O bypasses all the file-system services –Such as the buffer cache, file locking, pre-fetching, space allocation, file names, and directories
  • 9.
    Boot Block • Bootstrapprogram initializes system. – Initialize CPU registers, device controllers, main memory –Start OS • In PC, two-step approaches –A tiny bootstrap program is stored in ROM. • Bring in a full bootstrap program from disk, a bootstrap loader
  • 10.
    Boot Block (con..) –Fullbootstrap program. • Stored in boot block: at a fixed location on the disk • Load the OS and start the OS • This disk is called boot disk or system disk
  • 11.
    Bad Blocks • IDE–MS-DOS format : performs logical formatting • Scan the disk to find bad blocks • Write a special value into the corresponding FAT entry for bad blocks –MS-DOS chkdsk : if blocks go bad during operations •Search and lock bad blocks
  • 12.
    Bad Blocks (Cont.) •SCSI –Controller maintains a list of bad blocks on the disk –Low-level formatting will set aside spare sectors • OS don’t know –Sector sparing (or forwarding): •Controller replaces each bad sector logically with one of the spare sectors
  • 13.
    Bad Blocks (Cont.) •Invalidate optimization by OS’s disk scheduling –Sol: Each cylinder has a few spare sectors • Another technique: sector slipping –Ex. 17 defective, spare follows sector 202 •Spare  202  201  … 18  17
  • 15.
    Booting from aDisk in Windows 2000