Disk Management in Operating System
Last Updated :
03 Jul, 2024
Disk management is one of the critical operations carried out by the operating system. It deals with organizing the data stored on the secondary storage devices which includes the hard disk drives and the solid-state drives. It also carries out the function of optimizing the data and making sure that the data is safe by implementing various disk management techniques. We will learn more about disk management and its related techniques found in operating system.
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:
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.
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.
For example, the sizes can be 256,512, and 1,024 bytes. If disk is formatted with larger sector size, fewer sectors can fit on each track.
As a result fewer headers and trailers are written on each track and more space is obtainable for user data. - Some operating systems can handle a sector size of 512 bytes.
Operating system keeps its own data structures on disk before it use disk to store the files. It performs this with following two steps:
1. It partitions the disk into one or more groups of cylinders. Each partition is treated by OS as a separate disk.
2. Logical formatting: That means creation of file system.
In order to increase the efficiency, file system groups blocks in chunks called as clusters.
Some operating systems give special programs the ability to use a disk partition as a large sequential array of logical blocks, without any file-system data structures. This array is sometimes called the raw disk, and I/O to this array is called as raw I/O.
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.
- The bootstrap program is required for a computer to initiate the booting after it is powered up or rebooted.
- It initializes all components of the system, from CPU registers to device controllers and the contents of main memory, and then starts the operating system.
- The bootstrap program then locates the OS kernel on disk, loads that kernel into memory, and jumps to an initial address to start the operating-system execution.
- The Read Only Memory (ROM) does not require initialization and is at a fixed location that the processor can begin executing when powered up or reset. Therefore bootstrap is stored in ROM.
- Because of read only feature of ROM; it cannot be infected by a computer virus. The difficulty is that modification of this bootstrap code requires changing the ROM hardware chips.
- Therefore, most systems store a small bootstrap loader program in the boot ROM which invokes and bring full bootstrap program from disk into main memory.
- The modified version of full bootstrap program can be simply written onto the disk.
- The fixed storage location of full bootstrap program is in the "boot blocks".
- A disk that has 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.
- Failure of the disk can be:
1. Complete, means there is no way other than replacing the disk. Back up of content must be taken on new disk.
2. One or more sectors become faulty.
3. After manufacturing, the bad blocks exist. Depending on the disk and controller in use, these blocks are handled in a different ways.
Disk management in operating systems involves organizing and maintaining the data on a storage device, such as a hard disk drive or solid-state drive. The main goal of disk management is to efficiently utilize the available storage space and ensure data integrity and security.
Some common disk management techniques used in operating systems include:
- Partitioning: This involves dividing a single physical disk into multiple logical partitions. Each partition can be treated as a separate storage device, allowing for better organization and management of data.
- Formatting: This involves preparing a disk for use by creating a file system on it. This process typically erases all existing data on the disk.
- File system management: This involves managing the file systems used by the operating system to store and access data on the disk. Different file systems have different features and performance characteristics.
- Disk space allocation: This involves allocating space on the disk for storing files and directories. Some common methods of allocation include contiguous allocation, linked allocation, and indexed allocation.
- Disk defragmentation: Over time, as files are created and deleted, the data on a disk can become fragmented, meaning that it is scattered across the disk. Disk defragmentation involves rearranging the data on the disk to improve performance.
Advantages of disk management include:
- Improved organization and management of data.
- Efficient use of available storage space.
- Improved data integrity and security.
- Improved performance through techniques such as defragmentation.
Disadvantages of disk management include:
- Increased system overhead due to disk management tasks.
- Increased complexity in managing multiple partitions and file systems.
- Increased risk of data loss due to errors during disk management tasks.
- Overall, disk management is an essential aspect of operating system management and can greatly improve system performance and data integrity when implemented properly.
Conclusion
Disk management is a pivotal part of the operating system which includes managing and optimizing the storage resources. It paves a way for us to organize the way our data is stored on the system. Disk management also facilitates data integrity, which is very important in today's time. All the techniques supported by the disk management helps us in enhancing the overall performance of the operating system.
Similar Reads
Device Management in Operating System
The process of implementation, operation, and maintenance of a device by an operating system is called device management. When we use computers we will have various devices connected to our system like mouse, keyboard, scanner, printer, and pen drives. So all these are the devices and the operating
9 min read
Memory Management in Operating System
The term memory can be defined as a collection of data in a specific format. It is used to store instructions and process data. The memory comprises a large array or group of words or bytes, each with its own location. The primary purpose of a computer system is to execute programs. These programs,
10 min read
Free Space Management in Operating System
Free space management is a critical aspect of operating systems as it involves managing the available storage space on the hard disk or other secondary storage devices. The operating system uses various techniques to manage free space and optimize the use of storage devices. Here are some of the com
7 min read
Tertiary Device Management in Operating System
As we know about tertiary devices, let us now dive deeper into OS support which is required to manage tertiary devices. The operating system provides support to tertiary storage devices as removable media. It involves the transfer of data between different systems. In order to manage the tertiary de
2 min read
Resource Management in Operating System
Resource Management in Operating System is the process to manage all  the resources efficiently like CPU, memory, input/output devices, and other hardware resources among the various programs and processes running in the computer. Resource management is an important thing because resources of a comp
3 min read
Swap-Space Management in Operating system
Swapping is a memory management technique used in multi-programming to increase the number of processes sharing the CPU. It is a technique of removing a process from the main memory and storing it into secondary memory, and then bringing it back into the main memory for continued execution. This act
6 min read
What is Mainframe Operating System?
Operating System is a fully integrated set of specialized programs that handle all the operations of the computer. The operating system is the most important type of system software in a computer system. Examples of Operating Systems are Windows, Linux, Mac OS, etc. Let's understand the Mainframe Op
4 min read
Different Operating Systems
An operating system is an interface between the user and the hardware. It is a program that helps to utilize system hardware so it is also known as a resource manager. There are different types of operating systems based on different system architectures. , each with its own features and uses. Windo
15+ min read
Inode in Operating System
In Unix-based operating systems, each file is identified by an Inode, which stands for Index Node. Inodes are special data structures created when the file system is initialized. The total number of inodes determines the maximum number of files and directories that the file system can hold.An inode
5 min read
MS-DOS Operating System
IBM was looking for an operating system for their new line of personal computers. Bill Gates's mother Marry M Gates served on the national board of United Way alongside the CEO of IBM. IBM got in touch with Bill Gates through his mother when he convinced IBM that his company Microsoft could deliver
7 min read