Unit 5 Linux
Unit 5 Linux
Logical volume management (LMV), Creating file system, Mountiong file, Shell and shell
script -VBC
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:
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:
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:
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:
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:
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:
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 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.