0% found this document useful (0 votes)
7 views

Unit 5 Linux

Logical volume management (LVM) allows managing physical storage devices like hard drives as logical volumes through concepts like physical volumes, volume groups, and logical volumes. This provides benefits such as dynamic volume resizing, mirroring, improved disk utilization and easier management. File systems can be created on partitions or logical volumes using commands like mkfs.ext4. Mounting makes a file system accessible by associating it with a directory, while shell scripts automate tasks by executing stored commands sequentially.

Uploaded by

Paras Harshe
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Unit 5 Linux

Logical volume management (LVM) allows managing physical storage devices like hard drives as logical volumes through concepts like physical volumes, volume groups, and logical volumes. This provides benefits such as dynamic volume resizing, mirroring, improved disk utilization and easier management. File systems can be created on partitions or logical volumes using commands like mkfs.ext4. Mounting makes a file system accessible by associating it with a directory, while shell scripts automate tasks by executing stored commands sequentially.

Uploaded by

Paras Harshe
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Unit 5

Logical volume management (LMV), Creating file system, Mountiong file, Shell and shell
script -VBC

Logical volume management (LMV)


Logical Volume Management (LVM) is a flexible and advanced storage management
technology in Linux that allows for the management of physical storage devices (such as hard
drives or SSDs) as logical volumes. LVM provides features such as dynamic volume resizing,
snapshotting, and easy volume management, making it a powerful tool for managing storage
in Linux systems.
Key concepts in Logical Volume Management include:
1. Physical Volumes (PV): These are the physical storage devices, such as hard drives or
SSDs, that are used as building blocks for creating logical volumes.
2. Volume Groups (VG): Volume Groups are created by combining one or more physical
volumes. They act as a pool of storage from which logical volumes are created. Multiple
physical volumes can be added to a volume group, allowing for scalability and flexibility.
3. Logical Volumes (LV): Logical Volumes are created within volume groups and are the
equivalent of traditional partitions. They can be thought of as virtual partitions that can
be resized and managed independently of the underlying physical storage. Logical
Volumes are mounted and used as regular partitions for storing data.
4. LVM Snapshots: LVM allows for the creation of snapshots, which are point-in-time
copies of logical volumes. Snapshots can be used for backups, system recovery, or
creating consistent images of data.
The benefits of using LVM include:
- Dynamic volume resizing: Logical volumes can be resized online without the need to
unmount or disrupt the system. This allows for flexible allocation and reallocation of
storage space.
- Striping and mirroring: LVM supports striping (spreading data across multiple physical
volumes) and mirroring (creating redundant copies of data) to improve performance and
provide data redundancy.
- Easy volume management: LVM provides commands and utilities to create, resize, and
manage logical volumes, making it easier to manage storage in a dynamic environment.
- Improved data integrity: By using features like mirroring and snapshots, LVM helps to
improve data integrity and provides options for data protection and recovery.
- Efficient disk utilization: LVM allows for the pooling of physical storage devices,
reducing wasted disk space and enabling efficient use of available storage capacity.
Creating file system

To create a file system on a partition or logical volume, you can use the `mkfs` command
followed by the appropriate file system type. Here are some commonly used file systems and
their corresponding `mkfs` commands:

1. Ext4 File System: The Ext4 file system is widely used in Linux systems. To create an Ext4
file system, use the following command:

Ex. mkfs.ext4 /dev/sdXY

Replace `/dev/sdXY` with the appropriate partition or logical volume identifier, such as
`/dev/sda1`.

2. XFS File System: XFS is another popular file system known for its scalability and high-
performance. To create an XFS file system, use the following command:

Ex. mkfs.xfs /dev/sdXY

Replace `/dev/sdXY` with the appropriate partition or logical volume identifier.

3. Btrfs File System: Btrfs is a modern and feature-rich file system that supports advanced
features like snapshots and RAID. To create a Btrfs file system, use the following command:

Ex. mkfs.btrfs /dev/sdXY

Replace `/dev/sdXY` with the appropriate partition or logical volume identifier.

4. FAT32 File System: FAT32 is a file system commonly used for compatibility with other
operating systems and devices. To create a FAT32 file system, use the following command:

Ex. mkfs.fat -F32 /dev/sdXY

Replace `/dev/sdXY` with the appropriate partition or logical volume identifier.

5. NTFS File System: NTFS is a file system commonly used in Windows systems. To create
an NTFS file system, you can use the `mkntfs` command:

Ex. mkntfs /dev/sdXY

Replace `/dev/sdXY` with the appropriate partition or logical volume identifier.

Mountiong file

Mounting a file system in Linux involves making the contents of a partition or logical volume
accessible by associating it with a directory in the file system hierarchy. Here's how you can
mount a file system:

1. Create a directory where you want to access the files from the file system. For example,
create a directory called `/mnt/mydisk` using the command:
mkdir /mnt/mydisk

2. Identify the partition or logical volume you want to access. You can use the `lsblk` command
to list the available disks and partitions.

3. Mount the file system to the directory you created using the `mount` command. For example,
if the partition is `/dev/sda1`, use the following command:

mount /dev/sda1 /mnt/mydisk

4. After running the `mount` command, you can access the files in the file system through the
`/mnt/mydisk` directory.

To verify that the file system is successfully mounted, you can use the `df` command to display
the currently mounted file systems or the `mount` command without any arguments to list all
mounted file systems.

Shell and shell script


Shell: In Linux, the shell is like a translator between you and the operating system. It's a
command-line interface that allows you to interact with the system by entering commands.
When you type a command and press Enter, the shell interprets it and performs the requested
action. It lets you run programs, manage files, and control various aspects of your computer.

Shell Script: A shell script is a text file that contains a sequence of commands written in a
special scripting language. It's like a recipe that you create to automate tasks on your computer.
Instead of manually typing each command, you can write them in a script and execute the
script. The shell reads the commands from the script file and executes them one after another.

Shell scripts can be simple or complex, depending on what you want to achieve. You can
use them to perform tasks like copying files, installing software, managing user accounts, or
running a series of commands in a specific order. Shell scripts allow you to save time and effort
by automating repetitive tasks and performing them consistently.

To run a shell script, you need to make it executable by using the `chmod +x` command.
Once it's executable, you can execute the script by running it like a program. The shell reads
the script file, interprets the commands, and carries out the actions specified in the script.

Shell scripting is a powerful tool that empowers you to customize and automate your
Linux system according to your needs. It provides a way to simplify complex tasks, streamline
your workflow, and make your interaction with the system more efficient.

You might also like