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

LPI102 - Network Administration: Lesson 3 - Managing Partitions and File Systems

This document discusses managing partitions and file systems in Linux. It covers creating partitions with fdisk, making file systems with mkfs, mounting partitions manually and persistently by editing /etc/fstab. It also introduces logical volume management with LVM, which makes it easier to manage and resize disk space by creating physical volumes, volume groups, and logical volumes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
119 views

LPI102 - Network Administration: Lesson 3 - Managing Partitions and File Systems

This document discusses managing partitions and file systems in Linux. It covers creating partitions with fdisk, making file systems with mkfs, mounting partitions manually and persistently by editing /etc/fstab. It also introduces logical volume management with LVM, which makes it easier to manage and resize disk space by creating physical volumes, volume groups, and logical volumes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

LPI102 - Network Administration

Lesson 3 – Managing Partitions and File Systems


Objectives

• Understanding about Disk Partition


• Creating Disk Partitions
• Making the File System
• Deleting Disk Partition
• Mounting the File Systems
Disk Partition
• HDDs are the main storage
device on most computers.
• A partition is a logical
division on a hard disk drive
(HDD). It is a contiguous set
of blocks on a drive that are
treated as an independent
disk. 
• A partition index is an index
that relates sections of
the hard drive to partitions.
Disk Partition
• The first partition as MBR(Master Boot Record) where
operating system is installed.
– MBR contains two important utilities:
• IPL (Initial Program Loader) contains the boot loader, So it is
responsible for booting the operating system. On Centos7, the
default boot loader is grub2.
• The PTI (Partition Table Information) is the information about
the number of partitions on the disk, sizes of the partition and
types of partitions.
Managing Disk Partitions
1. Using fdisk –l command to view the existing partitions.
Managing Disk Partitions
2. Executing fdisk command to specify the disk device to create
partitions on.
Managing Disk Partitions
3. Command action:
• m: help
• n: add a new partition
• w: write table to disk and exit
Managing Disk Partitions
4. Using fdisk –l command to view the new created partitions.
Managing Disk Partitions
5. Updating the new partition table:
• After creating a new partition the changes will be effected in
the partition table only after reboot the system.
• Another way to avoid rebooting the system, run the
partprobe command with the disk device name as an
argument to force a re-read of its partition table.
[root@svr2 Desktop]# partprobe /dev/sdb1
Managing Disk Partitions
6. Creating the file systems
• After creating the block device, we need to assign the specify
file system to it so we can start storing the data into it.
[root@svr2 Desktop]# mkfs -t ext4 /dev/sdb1
Managing Disk Partitions
7. Mounting the file systems:
• Once the file system format has been applied. The last step
to adding a new file system is to attach into the directory
structure.
• There are two type of mounting which will be used in Linux
and any Unix.
– Manually mounting file systems.
– Persistently mounting file systems.
Managing Disk Partitions
7.1 Manually mounting file systems
• In this case, we will create a directory and mount it
temporarily. Once the system is rebooted the mounting will
be lost.
• Syntax:
#mount <Device name> <directory name>
• Example
[root@svr2 Desktop]# mkdir /data1
[root@svr2 Desktop]# mount /dev/sdb1 /data1
[root@svr2 Desktop]# mount | grep data1
/dev/sdb1 on /data1 type ext4 (rw,relatime,seclabel,data=ordered)
Managing Disk Partitions
7.2 Persistently mounting file systems
[root@svr2 Desktop]# vim /etc/fstab
Managing Disk Partitions
8. Verifying Mount Point:
Logical Volume Management

• Logical Volume Management (LVM) makes it easier to


manage disk space.
– If a file system needs more space, it can be added to its logical
volumes from the free spaces in its volume group and the file
system can be re-sized as we wish.
– If a disk starts to fail, replacement disk can be registered as a
physical volume with the volume group and the logical volumes
extents can be migrated to the new disk without data loss.
Logical Volume Management Architecture
Logical Volume Managment

• Step 1: Create partitions


– fdisk /dev/sdb /dev/sdc /dev/sdc
• Step 2: Create physical volume (PV)
– pvs (pvscan)
– pvdisplay
– pvcreate /dev/sdb1 /dev/sdc1 /dev/sdd1
• Step 3: Create volume group (VG)
– vgs (vgscan)
– vgdisplay
– vgcreate DataVG /dev/sdb1 /dev/sdc1 /dev/sdd1
Logical Volume Management

• Step 4: Create Logical Volume (LV)


– lvs (lvscan)
– lvdisplay
– lvcreate –L 9G –n Data DataVG
– lvcreate –L 6G –n Backup DataVG
– lvcreate –l 100%FREE –n Others DataVG
• Step 5: Format Logical Volume
– mkfs -t ext4 /dev/DataVG/Data
– mkfs -t ext4 /dev/DataVG/Backup
– mkfs -t ext4 /dev/DataVG/Others
Summary
 Using fdisk –l command to view all Disk Partitions in Linux
 Managing Disk Partitions: fdisk /dev/sdb
p: print partition table
n: new partition
d: delete partition
 Formatting Disk Partitions: mkfs –t ext4 /dev/sdb1
 Checking size of Disk Partitions: fdisk –s /dev/sdb1
 Attaching Disk Partitions into Directory:
mount /dev/sdb1 /data1

You might also like