• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to create and manage LVM on OpenSUSE leap 42.3

2297

To create and manage LVM on OpenSUSE Leap 42.3

LVM is a widely-used technique and extremely flexible disk management scheme for deploying logical rather than physical storage. With LVM, system administrator can easily resize and extend the logical drive when it is required. In this tutorial, you will learn the method to create and manage LVM on OpenSUSE Leap 42.3

 

Creating and Managing  LVM

First, add new hardisk of any size and to view it use the following command.

linuxhelp:~ # fdisk -l
Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0003044e
Device     Boot   Start      End  Sectors  Size Id Type
/dev/sda1          2048  4177919  4175872    2G 82 Linux swap / Solaris
/dev/sda2  *    4177920  4997119   819200  400M 83 Linux
/dev/sda3       4997120 41943039 36945920 17.6G 83 Linux
Disk /dev/sdb: 5 GiB, 5368709120 bytes, 10485760 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

 

Next, you need to create a new Partiton using fdisk tool and select partition type as LVM. Refer the following command. 

linuxhelp:~ # fdisk /dev/sdb

Welcome to fdisk (util-linux 2.30.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xf6c29730.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-6291455, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-6291455, default 6291455): +1G

Created a new partition 1 of type ' Linux'  and of size 1 GiB.

Command (m for help): p
Disk /dev/sdb: 3 GiB, 3221225472 bytes, 6291456 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf6c29730

Device     Boot Start     End Sectors Size Id Type
/dev/sdb1        2048 2099199 2097152   1G 83 Linux

Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 8e
Changed type of partition ' Linux'  to ' Linux LVM' .

Command (m for help): p
Disk /dev/sdb: 3 GiB, 3221225472 bytes, 6291456 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf6c29730

Device     Boot Start     End Sectors Size Id Type
/dev/sdb1        2048 2099199 2097152   1G 8e Linux LVM

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.

 

 

And then, you need to initialize the partition /dev/sdb1 as an LVM physical volume by making use of the following command.

 linuxhelp:~ # pvcreate /dev/sdb1
  Physical volume " /dev/sdb1"  successfully created.
linuxhelp:~ # pvs
  PV         VG Fmt  Attr PSize PFree
  /dev/sdb1     lvm2 ---  1.00g 1.00g

 

After that you need to run    pvdisplay and pvscan commands in the following manner to display the properties of LVM. 

linuxhelp:~ # pvdisplay
  " /dev/sdb1"  is a new physical volume of " 1.00 GiB" 
  --- NEW Physical volume ---
  PV Name               /dev/sdb1
  VG Name               
  PV Size               1.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               CWNuoW-xfe6-A3DY-27oo-fXtL-nV9I-4VlWpx
linuxhelp:~ # pvscan
  PV /dev/sdb1                      lvm2 [1.00 GiB]
  Total: 1 [1.00 GiB] / in use: 0 [0   ] / in no VG: 1 [1.00 GiB]

 

After that, you need to create volume group name vg1 and add /dev/sdb1 partition into the group with the help of the following command. 

linuxhelp:~ # vgcreate vg1 /dev/sdb1
Volume group " vg1"  successfully created

 

After that, you need to create a logical volume as follows. 

linuxhelp:~ # lvcreate -n lv1 -l 100%FREE vg1
Logical volume " lv1"  created.


And display the created logical volumes   by running the following command. 

linuxhelp:~ # lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg1/lv1
  LV Name                lv1
  VG Name                vg1
  LV UUID                3aT3Iz-Ap3n-e22r-XaKT-eU4B-t3kB-BjsEt3
  LV Write Access        read/write
  LV Creation host, time linuxhelp, 2017-12-05 16:49:25 +0530
  LV Status              available
  # open                 0
  LV Size                1020.00 MiB
  Current LE             255
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0



Later, make use of the mkfs command to format the newly created LVM as follows . 

linuxhelp:~ # mkfs.ext4 /dev/vg1/lv1
mke2fs 1.43.7 (16-Oct-2017)
Creating filesystem with 261120 4k blocks and 65280 inodes
Filesystem UUID: d348b933-25b9-4dc0-aed3-9c15095fc05a
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376
Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

 

And then, create the mount point and mount the new LVM   as follows. 

linuxhelp:~ # mkdir -p /data
linuxhelp:~ # mount /dev/vg1/lv1 /data/


Finally, verify the new disk layout with the help of the following command. 

linuxhelp:~ # df -h
Filesystem           Size  Used Avail Use% Mounted on
udev                 441M     0  441M   0% /dev
tmpfs                 92M  6.6M   85M   8% /run
/dev/sda3             16G   12G  3.4G  78% /
tmpfs                456M     0  456M   0% /dev/shm
tmpfs                5.0M  4.0K  5.0M   1% /run/lock
tmpfs                456M     0  456M   0% /sys/fs/cgroup
/dev/sda1            453M   48M  378M  12% /boot
tmpfs                 92M   16K   92M   1% /run/user/1000
/dev/mapper/vg1-lv1  988M  2.6M  919M   1% /data

 

With this, this tutorial on creating and managing LVM on OpenSUSE leap 42.3 comes to an end. 

Tags:
isaac
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

What is LVM? And what is the purpose of using this?

A

LVM is a widely-used technique and extremely flexible disk management scheme
for deploying logical rather than physical storage. With LVM, system administrator can
easily resize and extend

Q

Do I need a special lvm2 kernel module?

A

No. You need device-mapper. The lvm2 tools use device-mapper to interface
with the kernel and do all their device mapping (hence the name device-mapper).
As long as you have device-mapper,

Q

Is it possible to increase the logical volume on fly?

A

Yes.We can increase the logical volume without umount it.

Q

How to reduce the logical volume ? is it possible to reduce on fly?

A

No.You can’t reduce the logical volume on fly. Here is the steps to reduce the logical volume on redhat Linux.

Q

which command to display the created logical volume?

A

display the created logical volumes by running the following command
# lvdisplay

Related Tutorials in How to create and manage LVM on OpenSUSE leap 42.3

Related Tutorials in How to create and manage LVM on OpenSUSE leap 42.3

How to Install and update openssl on opensuse15.1
How to Install and update openssl on opensuse15.1
Nov 15, 2019
How to create SSL certificate in OpenSUSE
How to create SSL certificate in OpenSUSE
Aug 12, 2017
How to Manage and Create LVM on CentOS 7
How to Manage and Create LVM on CentOS 7
Mar 6, 2018
How to Install AnyDesk on opensuse15.1
How to Install AnyDesk on opensuse15.1
Oct 30, 2019
How to configure Apache Virtual Host in OpenSUSE
How to configure Apache Virtual Host in OpenSUSE
Nov 1, 2016
How to install PIP on OpenSUSE Leap 42.3
How to install PIP on OpenSUSE Leap 42.3
Nov 30, 2017
How to install Webmin in OpenSUSE
How to install Webmin in OpenSUSE
Nov 7, 2016
How to install Wordpress on opensuse15.1
How to install Wordpress on opensuse15.1
Nov 27, 2019

Related Forums in How to create and manage LVM on OpenSUSE leap 42.3

Related Forums in How to create and manage LVM on OpenSUSE leap 42.3

LVM (Logical Volume Manager)
connor class=
How to activate and deactivate Logical volumes, Volume group and Physical volume
Feb 16, 2017
pv command
muhammad class=
pvcreate command not found error
May 9, 2017
Pligg
aiden class=
CMS : Pligg install on opensuse
Oct 6, 2017
OpenSUSE
dalogui class=
Ayuda urgente instale SSL para servidor Opensuse y ahora no funciona tengo servicio web
Jul 15, 2019
Apache
rebeccajazz class=
Apache2 : mod_proxy in opensuse
Jan 3, 2018
OpenSUSE
victorsamuel class=
exec: "git": executable file not found in $PATH
Nov 16, 2017
OpenSUSE
lucas class=
best browser for OpenSUSE
Apr 17, 2017
Apache
rolando class=
How to find apache user in opensuse
Sep 23, 2017

Related News in How to create and manage LVM on OpenSUSE leap 42.3

Related News in How to create and manage LVM on OpenSUSE leap 42.3

openSUSE Leap 42.3 Officially Released
openSUSE Leap 42.3 Officially Released
Jul 27, 2017
Tyson Foods Honored as SUSE Customer of the Year
Tyson Foods Honored as SUSE Customer of the Year
Feb 11, 2017
SUSE Soon To Be Largest Independent Linux Vendor
SUSE Soon To Be Largest Independent Linux Vendor
Apr 14, 2019
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 keel johnston ?
Unhide the folders on windows Explorer

Give any solutions to unhide folder using command prompt?

forum3

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.