728x90

1. Overview

In this tutorial, we’ll discuss the virtual memory and swap space concept in the operating system. We’ll also present the core differences between them.

 

2. Fundamentals of Virtual Memory

Modern operating systems are designed to execute multiple programs simultaneously and provide efficient and fast processing. Although, issues like lack of memory space, memory fragmentation can degrade the efficiency of an OS. Using virtual memory, we can solve the issues that cause the processing of the OS to be slow in terms of time and consumed memory.

It’s a memory management concept that creates the illusion that the computer has a huge amount of memory. Moreover, virtual memory allows the OS to extend its existing physical memory. It can be located on a hard disk.

In virtual memory, we map the program addresses into the main memory addresses. In some cases, if we don’t have enough main memory available, we map them into the disk memory addresses:

In addition to increasing the performance of the OS, virtual memory provides memory protection for the addresses that are translated to a physical address.

Any program that wants access to a certain area of memory executes a load function to specify a virtual address. Therefore, the computer will then translate this virtual address, transforming it into a physical address.

As soon as the physical address is available, the computer will look it up in the RAM. If the computer can’t find the physical address in RAM, it’ll search for it on the disk. Furthermore, the OS will also update the translation map. Finally, the computer reads the required case of memory and returns the data to the program.

In modern OS, the virtual memory concept is generally executed using demand paging and page replacement algorithms.

3. Introduction to Swap Space

Like virtual memory, swap space is a secondary memory. It’s used by the OS when there is no physical memory available for further execution of the processes.

If the OS faces a situation when it needs memory, but the RAM is full, it moves the inactive pages from RAM to swap memory. If these pages are needed in the future, the OS can move them again from swap space to RAM.

It offers a slower access time compared to RAM and located in the disk memory. Swap space is actually a part of the virtual memory.

There are several applications of swap space. It stores the applications which the OS doesn’t use frequently. Hence, if the OS has sufficient swap space, it always keeps the RAM free. Moreover, it helps in increasing the performance.

Another crucial use of swap space is that it can be used as a single contiguous memory by the OS. Hence, it also reduces I/O operations to read or write a file.

Swap space is available in Windows and Linux-based operating systems by default. The amount of swap space generally equals twice the RAM of the system. Moreover, the user has the option to increase or decrease it based on the requirements.

4. Difference Between Virtual Memory and Swap Space

In this section, let’s discuss the core difference between virtual memory and swap space in OS:

5. Conclusion

In this tutorial, we discussed the fundamentals of virtual memory and swap space in the OS. We also highlighted the core differences between them.

Comments are closed on this article!

 
728x90

This article may have been automatically translated. If you have any feedback regarding its quality, please let us know using the form at the bottom of this page.

Article Content

Symptoms

In this article, I make clear how the various terms used in Ubuntu Linux for its structure can be described logically. Even though these terms can overlap and sometimes mean two different things simultaneously. This article is not meant to make you an expert in Linux. Only to clarify some terms and definitions. It helps you better understand, install, and use this operating system.

Table of Contents:

  1. Filesystem
  2. Partitions
  3. Directories

Note:

I recommend using the Clean Install or Dual Boot Install methods. They are largely automated and do not require this amount of knowledge to complete successfully or to use.

If your computer did not ship with Ubuntu, then the Dell support for your computer may include reverting it to the Windows Operating system (OS). This information is provided for your knowledge but is used at your discretion.

Back to Top

Cause

Not Applicable.

Resolution

FileSystem

Linux users state that a filesystem is a programmatic scheme that is used to organize and find files on a partition. While the file system references all the files on your computer.

What this means is that the Filesystem is the structure that is used to see, find and use your files using Ubuntu. However, the File System is both all the separate files in that structure and those files format.

Note: Be that Ext2, Ext3, NTFS, or some other format.

 

File System  Operating System Description
FAT Legacy Legacy File System that was universally adopted. Came in 12 FAT12, 16 FAT16, and 32 FAT32.
NTFS Windows New Tech File System - replaced FAT on Windows computers. It is still required to read Windows partitions.
Ext2 Linux Second Extended filesystem - used by many Linux distributions' (distros).
Ext3 Linux Third Extended filesystem - default choice for Ubuntu distros. Journaling added.
Ext4 Linux Fourth Extended filesystem - used by many Linux distros. Extends storage limits.
JFS Linux Journaled File System - introduced by IBM, it is still supported but it is being replaced by Ext4.
XFS Linux/Irix 64-bit option that is mostly supported now as an option in Red Hat.
ReiserFS Linux/SUSE This was a file format that was in use across several distros but is largely replaced by Ext3 now.

There are several types of files in Ubuntu Linux:

Regular files

They contain data, for example, text files, executable files or programs, input in or output out from a program and such.

Directories

Are files/folders that are lists of other files.

Special files

This is the mechanism that is used for input and output. Most special files are in /dev.

→ Such as mounted Volume and partition in /dev

Links

This is a system to make a file or directory visible in several parts of the computer's file tree.

Domain sockets

This is a special file type, and it is similar to TCP/IP sockets in windows. It provides inter-process networking that the file system's access control protects.

Named pipes

These act more or less like sockets and are a way for processes to communicate with each other, without using network socket protocols. → We call it special pipe line.

File Structure

For Ubuntu Linux, your / Partition must be a primary partition. While every other partition - Be it Primary or Logical, mounts to that partition. Each partition has a file format that you set and a purpose within the OS. The directories and files are searchable and used within this structure. This is explained in more detail below.


Partitions

The First thing is to discard everything that you already know about windows partitions. Trying to match the two only confuses you. You are better to take them as two separate processes.

Windows Partition Description

Windows partitions come in two types: Primary and Logical. On older SATA IDE Hard Drives, you are limited to either four Primary partitions or a combination of some Primary and Logical partitions. Each receives a Drive letter, but you are only able to install the OS on a Primary partition.

Note: There are further things that can be done with windows partitions. Such as spanning or mounting and there are new types of Hard Drives that use larger sectors. Such as a GUID or GPT table rather than an MBR table to give larger Hard Drive sizes. However, they are not the subject of this article.

→ Windows also possible GUID or GPT table

Ubuntu Linux Partition Description

Ubuntu Linux partitions also come in Primary and Logical. You are limited to either four primary partitions or a combination of Primary and Logical partitions. However, that is where the similarities stop.

Your first partition is always your install partition on a primary partition. This partition can be called the root of the partition, or it is shown as a /. You make several partitions, depending on how you want to use and configure your Ubuntu install. Root is the most important one. While you can create these partitions and give them a size, a file format, and a purpose. They need to be mounted to the / of this partition to function.

Ubuntu Linux Partition Categories

Ubuntu Linux further separates these partitions into two categories:

Data partitions

These are partitions like the boot partition in that they hold directories and files or normal Linux system data. These are the files which start and run the computer.

Swap partitions

These are partitions that expand the computer's physical memory by using the partition as a cache.

Partition types that are used in Ubuntu Linux Installs

There are several common partitions that are used for Ubuntu, I have listed them and some info for each below. Experienced Linux users use a combination of some of these partitions as a scheme. This is when they know they are using the custom Ubuntu install for a specific set of uses. These particular partitions make it easier and more efficient. I list what combination of partitions are required for the most common generic install. However, if you are going to use this scheme you would be better to use the auto-install guides above.

Note: Originally having different partitions was to achieve higher data security if there is a disaster. If an accident occurred, it would only affect the data in the partition that got affected. While the data on the other partitions would most likely survive. This still holds true to some extent after journaled file systems for power failure or sudden loss of storage. You can still get bad blocks and logical errors. The only way past this is a RAID solution, which is not something we are going into here.

 

 

Partition Name  Description
/ The slash / alone stands for the root of the filesystem tree.
/bin This stands for binaries and contains the fundamental utilities that all users need.
/boot This contains all the files that are needed for the booting process.
/dev This stands for devices, which contain files for peripheral devices and pseudo devices.
/etc This contains configuration files for the computer and computer databases.
/home This holds all the home directories for the users.
/lib This is the system libraries and has files like the kernel modules and device drivers.
/lib64 This is the system libraries and has files like the kernel modules and device drivers for 64-bit computers.
/media This is the default mount point for removable devices like USB drives and media players.
/mnt This stands for a mount and contains filesystem mount points. Used for multiple hard drives, multiple partitions, network filesystems, and CD ROMs and such.
/opt Contains add-on software. Larger programs may install here rather than in /usr.
/proc This contains virtual filesystems describing the processes information as files.
/sbin This stands for System Binaries and contains the fundamental utilities that are needed to start, maintain, and recover the computer.
/root This is the home location for the computer's administrator root. This accounts home directory is usually the root of the first partition.
/srv This is server data, which is data for services that are provided by the computer.
/sys This contains a sysfs virtual filesystem which holds information that is related to the hardware operating system.
/tmp This is a place for temporary files. tmpfs that is mounted on it or scripts on startup usually clear this at boot.
/usr This holds the executables and shared resources that are not system critical.
/var This stands for variable and is a place for files that are in a changeable state. Such as size going up and down.
/swap The swap partition is where you extend the system memory by dedicating part of the hard drive to it.

Most Common Partition Scheme

 

Name  Recommended Partition Space
/home Remaining Free Space after other partitions created or second drive.
/usr 20 GB at least
/var 2 GB
/lib 5 GB
/boot 250 MB
/opt 500 MB to 5 GB
/etc 250 MB
/sbin 250 MB
/bin 250 MB
/dev 250 MB
/srv 100 MB
/tmp Match this to the size of the Swap partition.
/mnt 8 KB This is an empty partition that is used as a mount point for temporary files.
/media 8 KB This contains subdirectories for mount points of removable media, such as CDs and USB flash drives.
/swap Twice as large as the amount of RAM in the personal computer.

There are many other schemes and many reasons for not splitting off a directory as a partition. As there are many reasons for creating a specific partition to streamline a particular process. If you want to proceed with a custom install, then how you achieve this is going to be up to you. It all depends on the use that you plan to put the computer.

Note: Once the partitions are made, you should only add more. Changing the sizes or properties of existing partitions is possible but not recommended. The current default filesystem for these partitions is Ext4.

If you need aid from Dell Technical Support in setting these up, then I would have to advise contacting the Operating Systems manufacturer instead. This type of help is not going to be covered under our existing warranties. Only the operating systems (OS) developer can answer your questions on this subject. They are the acknowledged experts on their OS.

Directories

In simple terms, Directories in Ubuntu Linux are folders that contain files. There is a certain amount of overlap with the terms that are used for the partitions in the section above. The reason for this is that Linux split up the directories onto separate partitions. So that they could dedicate space to each of them and mostly to protect against data loss. This is so that if one partition was unresponsive or if it was lost it would not affect all the others. This is mostly a thing of the past thanks to Journaled file systems such as Ext3 and Ext4. Once the separate partition is mounted to /, it then shows as a directory thereof.

Journaled file systems such as Ext3 and Ext4 present.

The easiest way to think of the directories on an Ubuntu Linux computer is to think of them as branches on a tree. Where the Trunk of the tree is the root directory on your first partition. All the other directories mount to this Trunk as branches. Each branch has its purpose but may interact with others through the Trunk and have subdirectories branch off from those main branches.

Note: While this is not entirely accurate for Ubuntu. It works until you have a better understanding of the format and can determine for yourself when exceptions crop up.

Directory Name Content

/bin Contains the common programs, which are shared by the computer, the system administrator, and the users.
/boot This has the startup files and the kernel, vmlinuz. In some recent distributions, it also has grub data. GRUB is the Grand Unified Boot Loader.
/dev Contains references to all the CPU peripheral hardware. They are represented as files with special properties.
/etc This has the most important system configuration files; this directory is similar to the control panel in Windows.
/home This is the home directory for the common users.
/initrd This contains information for booting in some distributions. Do Not Remove.
/lib This holds the library files; it includes files for all kinds of programs that the user needs.
/lost+found Every partition has a lost + found in its upper directory. Files that were saved during failures reside here.
/misc For miscellaneous uses.
/mnt The standard mount point for external files systems, such as media players, digital cameras, and CD ROMs.
/net The standard mount point for entire remote file systems.
/opt Typically this has third-party software and any extra files required.
/proc This is a virtual files system containing information about system resources. You can get more information about the meaning of the files in proc by entering the command man proc in a terminal window. The file proc.txt discusses the virtual file system in detail.
/root This is the system administrator user's home directory. Remember that there is a difference between / the root directory and /root the home directory of the root user.
/sbin This contains programs for use by the system administrator.
/tmp This is a temporary space for use by the computer. It is regularly wiped, so remember not to keep anything you want to retain here.
/usr This has programs, libraries, and documentation for all the user-related programs.
/var This is the storage for all the variable files and the temporary files that the users create. Things like the log files, the mail queue, the print spooler area, space for the Internet cache. To keep an image of a CD/DVD before burning it.

You can find a guide on using these directories after you have finished the install on the link below.

Additional Information

Note:

Software support is by Canonical through the following methods:

Dell provides Technical Support:

Article Properties

Affected Product

Inspiron, Latitude, Vostro, XPS, Fixed Workstations

Last Published Date

23 Aug 2023

'LINUX > Partitions and directories' 카테고리의 다른 글

Disk partitioning - Wikipedia  (0) 2023.08.27
728x90

is a popular utility used for disk partitioning

Disk partitioning or disk slicing[1] is the creation of one or more regions on secondary storage, so that each region can be managed separately.[2] These regions are called partitions. It is typically the first step of preparing a newly installed disk, before any file system is created. The disk stores the information about the partitions' locations and sizes in an area known as the partition table that the operating system reads before any other part of the disk. Each partition then appears to the operating system as a distinct "logical" disk that uses part of the actual disk. System administrators use a program called a partition editor to create, resize, delete, and manipulate the partitions.[3]

Partitioning allows the use of different filesystems to be installed for different kinds of files. Separating user data from system data can prevent the system partition from becoming full and rendering the system unusable. Partitioning can also make backing up easier. A disadvantage is that it can be difficult to properly size partitions, resulting in having one partition with too much free space and another nearly totally allocated.

Pros

  1. allows the use of different file systems to be installed for different kinds of files.
  2. Separating user data from system data can prevent the system partition from becoming full and rendering the system unusable.
  3. can also make backing up easier.

Cons

  1. it can be difficult to properly size partitions, resulting in having one partition with too much free space and another nearly totally allocated.

(Free Disk space or totally allocated → non effective)

History

IBM in its 1983 release of PC DOS version 2.0 was an early if not first use of the term partition to describe dividing a block storage device such as an HDD into physical segments. The term's usage is now ubiquitous. Other terms used in the art have included logical disk,[4] minidisk,[5] portions,[6] pseudo-disk,[6] section,[6] slice[7] and virtual drive.[8]


  1. IBM 1983 release of PC DOS version 2.0 was an early, to describe (Not First)

One of the earliest such segmentation of a disk drive was IBM's 1966[9] usage in its CP-67 operating system of minidisk as a separate segment of a hard disk drive.[5]

Partitioning schemes


DOS, Windows, and OS/2

With DOS, Microsoft Windows, and OS/2, a common practice is to use one primary partition for the active file system that will contain the operating system, the page/swap file, all utilities, applications, and user data. On most Windows consumer computers, the drive letter C: is routinely assigned to this primary partition. Other partitions may exist on the HDD that may or may not be visible as drives, such as recovery partitions or partitions with diagnostic tools or data. (Windows drive letters do not correspond to partitions in a one-to-one fashion, so there may be more or fewer drive letters than partitions.)


Common practice → One primary partition and Other partitions (recovery or diagnostic tools or data)


Microsoft Windows 2000, XP, Vista, and Windows 7 include a 'Disk Management' program which allows for the creation, deletion and resizing of FAT and NTFS partitions. The Windows Disk Manager in Windows Vista and Windows 7 utilizes a 1 MB partition alignment scheme which is fundamentally incompatible with Windows 2000, XP, OS/2, DOS as well as many other operating systems.

Windows Vista and Windows 7 → a 1MB partition alignment scheme ↔ incompatible with Windows 2000, XP, OS/2, DOS

Unix-like systems

On Unix-based and Unix-like operating systems such as Linux, macOS, BSD, and Solaris, it is possible to use multiple partitions on a disk device. Each partition can be formatted with a file system or as a swap partition.

Multiple partitions allow directories such as /boot, /tmp, /usr, /var, or /home to be allocated their own filesystems. Such a scheme has a number of advantages:

  • If one file system gets corrupted, the data outside that filesystem/partition may stay intact, minimizing data loss. (distributed and dedicated file system operation)
  • Specific file systems can be mounted with different parameters, e.g., read-only, or with the execution of setuid files disabled.
  • A runaway program that uses up all available space on a non-system filesystem does not fill up critical filesystems. (Preventing file system critical issue)
  • Keeping user data such as documents separate from system files allows the system to be updated with lessened risk of disturbing the data. (Data integrity)

A common minimal configuration for Linux systems is to use three partitions: one holding the system files mounted on "/" (the root directory), one holding user configuration files and data mounted on /home (home directory), and a swap partition.

By default, macOS systems also use a single partition for the entire filesystem and use a swap file inside the file system (like Windows) rather than a swap partition.

In Solaris, partitions are sometimes known as slices. This is a conceptual reference to the slicing of a cake into several pieces.

The term "slice" is used in the FreeBSD operating system to refer to Master Boot Record partitions, to avoid confusion with FreeBSD's own disklabel-based partitioning scheme. However, GUID Partition Table partitions are referred to as "partition" worldwide.

→ FreeBSD oprating system used “slice” to refer to MBR partitions

Multi-boot systems

Main article: Multi-boot

A GRUB startup menu showing Ubuntu Linux (with three different boot modes) and Windows Vista options

A GRUB startup menu showing Ubuntu Linux (with three different boot modes) and Windows Vista options

Multi-boot systems are computers where the user can boot into more than one distinct operating system (OS) stored in separate storage devices or in separate partitions of the same storage device. In such systems a menu at startup gives a choice of which OS to boot/start (and only one OS at a time is loaded).

This is distinct from virtual operating systems, in which one operating system is run as a self-contained virtual "program" within another already-running operating system. (An example is a Windows OS "virtual machine" running from within a Linux OS.)

Multi-boot systems recognize computers from each other operating systems.

Virtual Operating System recognize a self-contained virtual “program”

GUID Partition Table

Main article: GUID Partition Table

The GUID Partition Table (**G**lobally Unique IDentifier) is a part of the Unified Extensible Firmware Interface (UEFI) standard for the layout of the partition table on a physical hard disk. Many operating systems now support this standard. However, Windows doesn't support this on BIOS based computers.

Partition recovery


When a partition is deleted, its entry is removed from a table and the data is no longer accessible. The data remains on the disk until it is overwritten. Specialized recovery utilities may be able to locate lost file systems and recreate a partition table which includes entries for these recovered file systems. Some disk utilities may overwrite a number of beginning sectors of a partition they delete. For example, if Windows Disk Management (Windows 2000/XP, etc.) is used to delete a partition, it will overwrite the first sector (relative sector 0) of the partition before removing it. It still may be possible to restore a FAT or NTFS partition if a backup boot sector is available.

  1. The data will be overwritten by time.

Overwritten First Sector |          Data              |

Compressed disks


HDDs can be compressed to create additional space. In DOS and early Microsoft Windows, programs such as Stacker (DR-DOS except 6.0), SuperStor (DR DOS 6.0), DoubleSpace (MS-DOS 6.0–6.2), or DriveSpace (MS-DOS 6.22, Windows 9x) were used. This compression was done by creating a very large file on the partition, then storing the disk's data in this file. At startup, device drivers opened this file and assigned it a separate letter. Frequently, to avoid confusion, the original partition and the compressed drive had their letters swapped, so that the compressed disk is C:, and the uncompressed area (often containing system files) is given a higher name. → In early, Compressed disk give another higher name separated disk.

Versions of Windows using the NT kernel, including the most recent version, Windows 10, contain intrinsic disk compression capability. The use of separate disk compression utilities has declined sharply.

Partition table

A partition table is a table maintained on a disk by the operating system that outlines and describes the partitions on that disk.[11] The terms partition table and partition map are similar terms and can be used interchangeably. The term is most commonly associated with the MBR partition table of a Master Boot Record (MBR) in PCs, but it may be used generically to refer to other formats that divide a disk drive into partitions, such as: GUID Partition Table (GPT), Apple partition map (APM),[12] or BSD disklabel.[13]

PC partition types


MBR

See also: Partition type

This section describes the master boot record (MBR) partitioning scheme, as used historically in DOS, Microsoft Windows and Linux (among others) on PC-compatible computer systems. As of the mid-2010s, most new computers use the GUID Partition Table (GPT) partitioning scheme instead. For examples of other partitioning schemes, see the general article on partition tables.

The total data storage space of a PC HDD on which MBR partitioning is implemented can contain at most four primary partitions, or alternatively three primary partitions and an extended partition. The Partition Table, located in the master boot record, contains 16-byte entries, each of which describes a partition.

In MBR, Partition Table → contains 16 byte entries → each of which describes a partition.

The partition type is identified by a 1-byte code found in its partition table entry. Some of these codes (such as 0x05 and 0x0F) may be used to indicate the presence of an extended partition. Most are used by an operating system's bootloader (that examines partition tables) to decide if a partition contains a file system that can be mounted / accessed for reading or writing data.

1 byte code → an operating system’s bootloader to decide

Primary partition

Further information: Partition type

A primary partition contains one file system. In DOS and all early versions of Microsoft Windows systems, Microsoft required what it called the system partition to be the first partition. All Windows operating systems from Windows 95 onwards can be located on (almost) any partition, but the boot files (io.sys, bootmgr, ntldr, etc.) must reside on a primary partition. However, other factors, such as a PC's BIOS (see Boot sequence on standard PC) may also impose specific requirements as to which partition must contain the primary OS.

DOS and all early version microsoft systems System partition → Only possible to be first partition

from Windoews 95 onwards don’t care where is located (almost), but Boot files → must reside a primary partition

The partition type code for a primary partition can either correspond to a file system contained within (e.g., 0x07 means either an NTFS or an OS/2 HPFS file system) or indicate that the partition has a special use (e.g., code 0x82 usually indicates a Linux swap partition). The FAT16 and FAT32 file systems have made use of a number of partition type codes due to the limits of various DOS and Windows OS versions. Though a Linux operating system may recognize a number of different file systems (ext4, ext3, ext2, ReiserFS, etc.), they have all consistently used the same partition type code: 0x83 (Linux native file system).

Extended partition

Further information: Extended boot record

An HDD may contain only one extended partition, but that extended partition can be subdivided into multiple logical partitions. DOS/Windows systems may then assign a unique drive letter to each logical partition. GUID partition table (GPT) only has the primary partition, doesn't have the extended partition and the logical partition.

  1. DOS/Windows → assign a unique drive letter
  2. GPT only possible Primary partition → No! extended or logical partition

Boot partitions

See also: System partition and boot partition

BIOS boot partition

BIOS boot partition (BIOS BP) is a share of the storage device used to keep software that boots the operating system, a bootloader. It may be an operating system kernel image or bootloader or a completely separate piece of software.

EFI system partition

EFI system partition is the same as BIOS BP, but is loaded by EFI firmware instead of BIOS.

EFI system partition → Boot Loader

See also[edit]

!https://s3-us-west-2.amazonaws.com/secure.notion-static.com/d7471184-719b-4e04-8ff9-26d6fdc9b33d/80px-Wikibooks-logo-en-noslogan.svg.png

The Wikibook Guide to Unix has a page on the topic of: Partitioning Disks

[edit]

Further reading[edit]

728x90

1.BIOS(Basic Input/Output System)

  1. When we power on, BIOS performs a Power-OSelf-Test (POST) for all of the different hardware components in the system to make sure everything is working properly.
  2. Also it checks for whether the computer is being started from an off position (cold boot) or from a restart (warm boot) is stored at this location.
  3. Retrieves information from CMOS (Complementary Metal-Oxide Semiconductor), a battery operated memory chip on the motherboard that stores time, date, and critical system information.
  4. Once BIOS sees everything is fine, it will begin searching for an operating system Boot Sector on a valid master boot sector on all available drives like hard disks, CD-ROM drive etc.
  5. Once BIOS finds a valid MBR, it will give the instructions to boot and executes the first 512-byte boot sector that is the first sector (“Sector 0″) of a partitioned data storage device such as hard disk or CD-ROM etc.
    BIOS find a valid MBR → boot and executes MBR

2.MBR(Master Boot Record)

  1. Normally we use multi-level boot loader. Here MBR means I am referencing to DOS MBR.
  2. Afer BIOS executes a valid DOS MBR, the DOS MBR will search for a valid primary partition marked as bootable on the hard disk.
    MBR → valid primary partition (Bootable)
  3. If MBR finds a valid bootable primary partition then it executes the first 512-bytes of that partition which is second level MBR.
    MBR → valid bootable primary partition → execute first 512 bytes (Boot Loader)
  4. In linux we have two types of the above mentioned second level MBR known as LILO and GRUB

3.LILO or GRUB

LILO - LInux LOader

  1. LILO is a linux boot loader which is too big to fit into single sector of 512-bytes.
  2. so it is divided into two parts an installer and a runtime module.
  3. The installer module places the runtime module on MBR. The runtime module has the info about all operating systems installed.
    (installer module → runtime module → MBR)
  4. When the runtime module is executed, it selects the operating system to load and transfers the control to kernel. (runtime module → select operating system to load → transfer control → kernel)
  5. LILO does not understand file systems and boot images to be loaded and treats them as raw disk offsets

GRUB - GRand Unified Bootloader

  1. GRUB MBR consists of 446 bytes of primary boot loader code and 64 bytes of the partition table.
  2. GRUB locates all the operating systems installed and gives a GUI to select the operating system need to be loaded.
  3. Once user selects the operating system, GRUB will pass control to the kernel of that operating system.see below what is the difference between LILO and GRUB

Select operating system → grub will pass control → the kernel that operating system

 

4.Kernel

  1. Once GRUB or LILO transfers the control to Kernel, the Kernels does the following tasks
  • initializes devices and loads initrd module
  • mounts root file system

5.init

  1. The kernel, once it is loaded, finds init in sbin(/sbin/init) and executes it.
  2. Hence the first process which is started in linux is init process.
  3. This init process reads /etc/inittab file and sets the path, starts swapping, checks the file systems, and so on.
  4. it runs all the boot scripts(/etc/rc.d/*, /etc/rc.boot/*)
  5. starts the system on specified run-level in the file /etc/inittab

6.Run Levels

  1. There are 7 run levels in which the linux OS runs and different run levels serves for different purpose. The descriptions are given below.
  • 0 – halt
  • 1 – Single user mode
  • 2 – Multi-user, without NFS (The same as 3, if you don’t have networking)
  • 3 – Full multi-user mode
  • 4 – unused
  • 5 – X11
  • 6 – Reboot
  1. We can set in which run-level we want to run our operating system by defining it on /etc/inittab file.

+ Recent posts