• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How To Create and Extend logical volumes by using LVM on Debian 11

  • 00:32 lsb_release-a
  • 00:45 fdisk -l | grep /dev/sd
  • 01:08 fdisk /dev/sda
  • 02:27 pvcreate /dev/sda1
  • 02:42 pvs
  • 02:50 vgcreate myvg /dev/sda1
  • 03:18 lvcreate -L 1G -n mylv myvg
  • 03:45 lvdisplay myvg
  • 04:02 mkfs.ext4 /dev/myvg/mylv
  • 04:25 mount /dev/myvg/mylv /mnt
  • 04:51 df -h
  • 05:07 fdisk /dev/sdc
  • 05:52 Vgextend myvg /dev/sdc1
  • 06:07 vgs
  • 06:17 lvextend -L +5G /dev/myvg/mylv
  • 06:47 resizefs /dev/myvg/mylv
  • 07:10 fdisk -l
{{postValue.id}}

To Create and Extend logical volumes by using LVM on Debian 11.3

Introduction:

In Linux, the Logical Volume Manager (LVM) is a tool for virtualizing disks. It can create "virtual" hard drive partitions, which can be expanded, shrunk, or moved. It also allows you to use multiple small disks to create larger partitions.

Prerequisite: lvm2 package.

Step 1: Check the installed OS version by using the below command

[root@linuxhelp ~]# lsb_release-a
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye

Step 2: List all physical disk available in system by using the below command

[root@linuxhelp ~]# fdisk -l | grep /dev/sd

Step 3: Open fdisk to create partition on /dev/sda disk by using the below command

[root@linuxhelp ~]# fdisk /dev/sda

Welcome to fdisk (util-linux 2.23.2).
Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): 
Using default response p
Partition number (1-4, default 1): 
First sector (2048-41943039, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): +5G
Partition 1 of type Linux and of size 5GiB is set
Command (m for help): wq

Selected partition 1
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Step 4: Create physical volume in /dev/sdb1 drive by using the below command

[root@linuxhelp ~]# pvcreate /dev/sda1
  Physical volume "/dev/sda1" successfully created.

Step 5: List the physical volume by using the below command

[root@linuxhelp ~]# pvs

Step 6: Create the volume group named “myvg” with PVs contained by using the below command

[root@linuxhelp ~]# vgcreate myvg /dev/sda1
  Volume group "myvg" successfully created

Step 7: Create logical volume named “mylv” with 1GB size in volume group “myvg” by using the below command

[root@linuxhelp ~]# lvcreate -L 1G -n mylv myvg
  Logical volume "mylv" created.

Step 8: View the volume group with details by using the below command

[root@linuxhelp ~]# lvdisplay myvg

Step 9: Format the logical volume “mylv” to ext4 file system by using the below command

[root@linuxhelp ~]# mkfs.ext4 /dev/myvg/mylv
mke2fs 1.45.6 (20-jun-2022)
Creating filesystem with 524288 4k blocks and 131072 inodes
Filesystem UUID: ad44c4a1-6c8b-4335-96fe-56e68916c4b4
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912

Step 10: Mount the logical volume “mylv” to the directory /mnt by using the below command

[root@linuxhelp ~]# mount /dev/myvg/mylv /mnt

Step 11: View the mounted status by using the below command

[root@linuxhelp ~]# df -h

Step 12: Open the fdisk to create partions on /dev/sdc disk by using the below command

[root@linuxhelp ~]# fdisk /dev/sdc
Welcome to fdisk (util-linux 2.23.2).
Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): 
Using default response p
Partition number (1-4, default 1): 
First sector (2048-41943039, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): +5G
Partition 1 of type Linux and of size 5GiB is set
Command (m for help): wq

Selected partition 1
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Step 13: Extend the volume group with “/dev/sdc1” drive by using the below command

[root@linuxhelp ~]# Vgextend  myvg /dev/sdc1
Physical  volume “/dev/sdc1 “ successfully created.
Volume Group “myvg” successfully extented

Step 14: List the volume group by using the below command

[root@linuxhelp ~]#vgs
VG	#PV	#LV	#SN	ATTR	Vsize	Vfree
Myvg	2	1	0	wn—n-	6.99g	5.99g

Step 15: Extend the “mylv” logical volume by 5GB using the below command

[root@linuxhelp ~]# lvextend -L +5G /dev/myvg/mylv
Logical Volume myvg/mllv Successfully resized.

Step 16: Use resize2fs command to change effect on logical volume by using the below command

[root@linuxhelp ~]# resizefs /dev/myvg/mylv

resize2fs 1.46.2 (28-feb-2022)

Step 17: List the mounted drives to see the changes in memory by using the below command

[root@linuxhelp ~]# fdisk -l

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to Create and Extend logical volumes by using LVM on Debian 11.3. Your feedback is much welcome.

Tags:
jackson
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

What is logical volume management (LVM)?

A

Logical Volume Management provides a method of elastic storage space on mass-storage devices that is more flexible than conventional partitioning schemes.

Q

What is Physical Volume?

A

Physical volumes (PVs) are which can be either hard disks, hard disk partitions

Q

What are volume Groups?

A

Volume Groups are user-defined groups of drives

Q

What are Logical Volumes?

A

Logical Volumes are composed of a group of PV's and LV’s. It is the organizational group for LVM.

Q

How to Format the logical volume File System?

A

Mkfs.ext4 /dev/

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Luk Van De Looverbosch ?
How to create a root ?

Hello,
How to create root@linuxhelp in Linux Mint 20.1 64-bit ?
Thanks in advance for your reply.
Best regards.

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.