OCI‐ Lab 11 ‐ Management of Boot Volume - sayan028/Sayan-Chakraborty-OCI GitHub Wiki

Introduction to Boot Volume

In Oracle Cloud Infrastructure (OCI), a Boot Volume is a block storage volume that contains the operating system and other files required to start an instance. When we create a Compute Instance, OCI automatically creates and attaches a boot volume to it. The boot volume is used to boot the operating system of the instance. Boot volumes can be managed independently from the Compute Instance, which provides flexibility for backup, restoration, cloning, resizing, and migration.

A Boot Volume is a persistent block storage device that contains:

  • Operating System
  • System files
  • Boot files
  • Installed software
  • System configurations

Let's understand with a simple Table:

Component Description
OCI Compute Instance The virtual machine running in OCI
↓ The Compute Instance uses the Boot Volume to start the operating system
Boot Volume Persistent storage containing the files required by the instance
OS Operating system installed on the instance
System Files Files required for the operating system to function
Applications Software and applications installed on the instance
Configuration System and application configuration files

The boot volume remains available even when the Instance is stopped.

Linux File System

The Linux file system follows a hierarchical structure in which directories are arranged under a single top-level directory called /.

1. / — Root Directory

The / directory is the top-level directory of the Linux file-system hierarchy. It acts as the main starting point from which all other directories and files are organized.

The root user has the required privileges to modify protected content within this directory.


2. /root — Root User's Home Directory

The /root directory is the personal home directory of the root user.

Normal users generally do not have permission to access or modify the contents of this directory.


3. /home — User Home Directories

The /home directory is mainly used to store the personal directories of non-root users.

Normally, every user has a separate directory under /home. The contents of an individual user's directory can generally be accessed by the root user and the respective directory owner, depending on the configured permissions.


4. /bin — Binary Files

/bin stands for binary. On modern Linux systems, /bin is commonly linked to /usr/bin.

It contains executable commands that are required for normal system operation and for tasks such as system recovery and troubleshooting.

These commands are generally available to all users according to their permissions.


5. /sbin — System Binary Files

/sbin stands for system binaries. On modern Linux systems, /sbin commonly points to /usr/sbin.

It contains commands mainly intended for system administration, maintenance, and troubleshooting.

Many of these commands require root or elevated privileges to perform administrative operations.


6. /proc — Process Information

/proc represents process information.

Unlike normal directories, /proc is a virtual file system. Its contents are generated dynamically by the Linux kernel and are primarily maintained in memory.

It provides information related to:

  • Running processes
  • Process IDs
  • Kernel information
  • Hardware information
  • System resources

The information available in /proc is dynamic and can change while the system is running.


7. /boot — Boot-Related Files

The /boot directory contains important files required during the Linux system boot process.

Some important components stored here include:

Linux Kernel

The Linux kernel is the core component of the operating system. It communicates with hardware and manages system resources such as CPU, memory, and devices.

Initial RAM Filesystem

The Initial RAM Filesystem (initramfs) is a temporary compressed file system loaded into memory during the early boot process.

It provides the necessary files and drivers required to locate and mount the actual root file system.

Once the real root file system is available, the temporary environment is no longer required.

Bootloader Configuration

Bootloader configuration contains information used by the bootloader to locate the kernel and determine which boot options should be passed during startup.

GRUB and EFI-related configuration are examples associated with the boot process.


8. /dev — Device Files

The /dev directory contains device files that provide an interface between software and hardware devices.

Examples include:

  • Hard disks
  • Printers
  • Microphones
  • Speakers
  • Other hardware devices

Linux generally represents device communication using two major categories:

Block Devices

Block devices handle data in blocks and are commonly associated with storage devices such as hard disks.

They are represented using b.

Character Devices

Character devices handle data as a stream of characters. Examples include devices such as microphones and speakers.

They are represented using c.


9. /mnt — Mount Directory

The /mnt directory is commonly used as a temporary mount point.

A system administrator can manually mount a physical or virtual storage device under /mnt when temporary access to that storage is required.


10. /media — Removable Media

The /media directory is generally used by Linux to provide temporary mount points for removable storage devices.

For example, when a removable storage device is connected, the operating system may automatically mount it under /media.

When the device is removed, its mount point is normally released.


11. /etc — System Configuration

The /etc directory contains important system-wide configuration files.

These files are generally text-based and control various aspects of the operating system and installed services.

Some important examples are:

/etc/passwd

This file contains essential information about user accounts, including user-related information and the user's default login shell.

/etc/fstab

/etc/fstab stands for file system table.

It contains configuration information that tells Linux how storage devices and file systems should be mounted during system startup.

/etc/hosts

The /etc/hosts file provides a local mapping between IP addresses and hostnames.

It can therefore work as a simple local name-resolution mechanism without depending entirely on DNS.


12. /srv — Service Data

/srv stands for service.

This directory is intended to contain site-specific data that is being served by the system.

For example, a server may use different subdirectories under /srv for different services.

Common Examples

  • Web Server: /srv/www
    Can contain website-related files such as HTML, CSS, and PHP files.

  • FTP Server: /srv/ftp
    Can contain files made available through File Transfer Protocol.

  • Git Server: /srv/git
    Can be used for hosting Git repositories.

  • File Sharing: /srv/samba or /srv/nfs
    Can be used for network file-sharing services.


13. /sys — System Information

/sys stands for system.

It is a virtual file system that provides information about hardware devices, device drivers, and their relationships to the Linux kernel.

The kernel dynamically creates and updates information in this directory, particularly during system startup and while hardware changes occur.


14. /lib — Library Files

/lib stands for libraries.

This directory contains shared library files required by executable programs, particularly programs associated with /bin and /sbin.

Shared libraries allow multiple programs to use common code instead of storing duplicate copies of the same code.

Shared library files commonly use the .so extension, which means Shared Object.


15. /tmp — Temporary Files

/tmp is used for storing temporary files created by the operating system and running applications.

The contents of /tmp are generally not intended for permanent storage.

On many modern Linux systems, temporary data may be cleared when the system is rebooted. In some configurations, /tmp can be mounted as tmpfs, meaning that its contents are stored in memory.


16. /usr — System Resources

Historically, /usr was associated with user-related files. In modern Linux systems, it primarily contains Unix/System resources.

It stores programs, libraries, documentation, and other resources that are generally shared by the operating system and normal users.

Some important directories under /usr include:

/usr/bin

Contains executable programs. On many modern distributions, /bin points to this directory.

/usr/sbin

Contains system-administration commands. /sbin commonly points to this directory.

/usr/lib

Contains libraries used by system programs and applications. /lib commonly points to this location on modern systems.

/usr/local

/usr/local is commonly used for software that is installed locally by the system administrator rather than being managed directly by the operating system's package management system.

It can contain directories such as:

/usr/local/bin
/usr/local/sbin
/usr/local/lib

This separation helps keep locally installed software independent from standard system software and reduces the possibility of system updates overwriting locally installed applications.


17. /var — Variable Data

/var stands for variable.

It stores data that changes frequently while the Linux system is running.

Unlike directories containing mostly static system programs, /var contains operational information that is continuously created or modified by the operating system, services, and applications.

/var/log

Contains log files generated by:

  • Operating system
  • Kernel
  • Applications
  • System services

/var/spool

This directory contains data that is waiting in a queue to be processed by a particular service or application.

After the relevant task is completed, the queued data may be removed.

/var/tmp

Stores temporary files that are expected to remain available for a longer period than files normally stored under /tmp.

Unlike temporary data that may be stored in RAM through tmpfs, /var/tmp is generally stored on persistent disk storage and can therefore survive a reboot.


18. /opt — Optional Software

/opt stands for optional.

It is commonly used for installing third-party or additional software that does not naturally fit into the standard Linux directory structure.

One difference between /opt and /usr/local is the way software is organized.

/usr/local generally follows the normal Linux hierarchy, for example:

/usr/local/bin
/usr/local/lib
/usr/local/sbin

Whereas software installed under /opt can keep its related files together inside its own application directory.


19. /run — Runtime Data

The /run directory contains runtime information generated by the operating system, background applications, and system services.

This information is temporary and is normally stored in memory using tmpfs.

Examples of runtime information include:

  • Process-related information
  • Service state
  • Runtime identifiers
  • Temporary system information

Maintenance of File System

Note: every Linux directory is normally maintained manually.

For routine maintenance activities, particular directories such as /home, /tmp, and selected areas under /var are commonly considered.

1. /home

User-related files and data stored under /home can be managed according to the requirements of the system and individual users.


2. /tmp

Since /tmp contains temporary files, unnecessary or outdated temporary data can be cleaned when appropriate.


3. /var

Maintenance activities are commonly performed on specific areas under /var, particularly:

  • /var/log
  • /var/tmp

/var/log

Log files can grow continuously as the operating system and applications generate new entries.

Therefore, old or unnecessary logs may need to be reviewed, rotated, archived, or cleaned according to the system's log-management policy.

For example:

/var/log/secure

The contents of this file can be checked when reviewing security-related system activity.

For example, we can view the last 10 lines or last 100 lines when troubleshooting or checking recent activity.


Important Note

For file-system maintenance, avoid manually deleting or modifying system-critical directories and files unless you understand their purpose and the impact of the change.

The main focus should be on user data, temporary files, logs, and other files specifically identified for maintenance.