Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Disk Management in Operating System

  • Last Updated : 06 Oct, 2021

The range of services and add-ons provided by modern operating systems is constantly expanding, and four basic operating system management functions are implemented by all operating systems. These management functions are briefly described below and given the following overall context. The four main operating system management functions (each of which are dealt with in more detail in different places) are:

  • Process Management
  • Memory Management
  • File and Disk Management
  • I/O System Management

Most computer systems employ secondary storage devices (magnetic disks). It provides low-cost, non-volatile storage for programs and data (tape, optical media, flash drives, etc.). Programs and the user data they use are kept on separate storage devices called files. The operating system is responsible for allocating space for files on secondary storage media as needed. 

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

 

There is no guarantee that files will be stored in contiguous locations on physical disk drives, especially large files. It depends greatly on the amount of space available. When the disc is full, new files are more likely to be recorded in multiple locations. However, as far as the user is concerned, the example file provided by the operating system hides the fact that the file is fragmented into multiple parts.



The operating system needs to track the location of the disk for every part of every file on the disk. In some cases, this means tracking hundreds of thousands of files and file fragments on a single physical disk. Additionally, the operating system must be able to locate each file and perform read and write operations on it whenever it needs to. Therefore, the operating system is responsible for configuring the file system, ensuring the safety and reliability of reading and write operations to secondary storage, and maintains access times (the time required to write data to or read data from secondary storage). 

Disk management of the operating system includes:

  • Disk Format
  • Booting from disk
  • Bad block recovery

The low-level format or physical format:

 Divides the disk into sectors before storing data so that the disk controller can read and write Each sector can be:

The header retains information, data, and error correction code (ECC) sectors of data, typically 512 bytes of data, but optional disks use the operating system’s own data structures to preserve files using disks.

 It is conducted in two stages:

1. Divide the disc into multiple cylinder groups. Each is treated as a logical disk.

2. Logical format or “Create File System”. The OS stores the data structure of the first file system on the disk. Contains free space and allocated space.

For efficiency, most file systems group blocks into clusters. Disk I / O runs in blocks. File I / O runs in a cluster.

 Boot block:

  • When the computer is turned on or restarted, the program stored in the initial bootstrap ROM finds the location of the OS kernel from the disk, loads the kernel into memory, and runs the OS. start.
  •  To change the bootstrap code, you need to change the ROM and hardware chip. Only a small bootstrap loader program is stored in ROM  instead.
  •  The full bootstrap code is stored in the “boot block” of the disk.
  •  A disk with a boot partition is called a boot disk or system disk. 

 Bad Blocks:

  • Disks are error-prone because moving parts have small tolerances.
  •   Most disks are even stuffed from the factory with bad blocks and are handled in a variety of ways.
  •  The controller maintains a list of bad blocks.
  • The controller can instruct each bad sector to be logically replaced with one of the spare sectors. This scheme is known as sector sparing or transfer.
  •  A soft error triggers the data recovery process.
  • However, unrecoverable hard errors may result in data loss and require manual intervention.

 

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!