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

LVM

Practice Exercises

Uploaded by

Nilabha sadhu
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

LVM

Practice Exercises

Uploaded by

Nilabha sadhu
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

LVM - Logical Volume Manager

It is used to manage volume and disk on a Linux system.

It also allows disks to be combined together.

Examples of LVM.

Example: Local Disk C, D, E in Windows

1. Single disk can be divided into multiple partitions

2. Multiple disks can be combined into one group. Then we can change it
into different partition/volume.

Possibilities of LVM

1. New space can be created on a server for different project.

File Systems: It will determine how datas will be stored.

1) ext2, ext3, ext4: Extended File System. Default file system in Linux.

2) FAT (FAT 16, FAT 32) -- File Allocation Table. It was used in MS DOS, and
tradional windows system.

3) NTFS: New Technology File System. It is by default present in modern


day Hard Drive Partitions.

2. In case of low disk space, we can increase the space.

3. In case of extra space, using lvm we can reduce the space.


Steps of LVM:

1) Install a new Hard Drive.

2) Make a partition.

3) Allot Physical Volume.

4) Manage Volume Groups.

5) Manage Logical Volumes

6) Apply File System.

7) Set Mountpoint.

fdisk -l (To see our new drive is present or not)

fdisk /dev/sdb (to open fdisk terminal)

n (for creating new partition)

p (for selecting primary)

1 (to select partition number)

Partition of 2gb has been created

t ( to change fromm linux to type to LVM)

l (to list all codes)


8e

m (for help)

w (to write table to disk)

fdisk -l ( We can see a partition has been created of sdb as sdb1)

pvcreate /dev/sdb1 (To create physical volume)

pvdisplay (To check physical volume)

vgcreate vgapps /dev/sdb1 (To create Volume group)

vgdisplay (To display Volume Groups)

lvcreate -L 1000M -n app1-lv vgapps (To create Logical Volume 1)

lvcreate -L 1000M -n app2-lv vgapps (To create Logical Volume 1)

lvdisplay | more (To display logical volumes)

mkfs.ext4 /dev/vgapps/app1-lv (To assign file system for app1)

mkfs.ext4 /dev/vgapps/app2-lv (To assign file system for app2)

mkdir /app1 (To create folder for app 1)


mkdir /app2 (To create folder for app 2)

mount /dev/vgapps/app1-lv /app1/ (To mount app1 directory)

mount /dev/vgapps/app2-lv /app2/ (To mount app2 directory)

df -Th (To display file system)

Now we will make permanent changes to the disks

cat /etc/mtab

copy the last two lines for 2 new mounting files

vi /etc/fstab

paste those 2 lines at the last of the page

now we will modify some changes

the changes should be look like this

/app1 ext4 defaults

/app2 ext4 defaults

Save the file

mount -av (To check the mounted files)


Extending the Disk space using LVM

SSH - Secure Shell, Communication in encrypted format. It works only in


Command Line Interface.

Port No: 22 (By Default) But we can change from 1024 to 32,767.

Redhat - yum

Debian - apt

SSH Installation Steps

sudo yum install openssh-client

sudo yum install openssh-server

systemctl status sshd

sudo apt install openssh-client

sudo apt install openssh-server

systemctl status sshd

sudo file /etc/ssh/sshd_config

ssh username@serverIP

Server password

ssh-keygen
ssh-copy-id serverusername@serverIP

ServerPassword

You might also like