Get up to 50% off on CKA, CKAD, CKS, KCNA, KCSA exams and courses!

Enable LVM flag on partition using parted in Linux

Recently we have noticed some issue with one of our filesystem having issue and realized wrong flags on partition which was used as a Physical Volume (PV) in LVM ( Logical Volume Management ). You must properly set the lvm flag using any tool like fdisk or parted.

Open parted tool

[root@lpcl02c132 ~]# parted
GNU Parted 3.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted

Check the partitions and free space. We can see /dev/sda is already selected; otherwise you use the correct disk.

(parted) print free
Model: DELL PERC H730P Adp (scsi)
Disk /dev/sda: 600GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number  Start   End     Size    Type      File system  Flags
        32.3kB  1049kB  1016kB            Free Space
 1      1049kB  1075MB  1074MB  primary   xfs          boot
 2      1075MB  71.4GB  70.3GB  primary                lvm
 3      71.4GB  109GB   37.6GB  primary                lvm
 4      109GB   600GB   491GB   extended
 5      109GB   136GB   26.8GB  logical                lvm
 6      136GB   137GB   1078MB  logical                lvm
        137GB   600GB   463GB             Free Space

Create a partition with xfs format.

(parted) mkpart logical xfs 137GB 317G

Check current partions; you can see the partition 7 with 180GB size which we have created just now.

(parted) print free
Model: DELL PERC H730P Adp (scsi)
Disk /dev/sda: 600GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number  Start   End     Size    Type      File system  Flags
        32.3kB  1049kB  1016kB            Free Space
 1      1049kB  1075MB  1074MB  primary   xfs          boot
 2      1075MB  71.4GB  70.3GB  primary                lvm
 3      71.4GB  109GB   37.6GB  primary                lvm
 4      109GB   600GB   491GB   extended
 5      109GB   136GB   26.8GB  logical                lvm
 6      136GB   137GB   1078MB  logical                lvm
 7      137GB   317GB   180GB   logical
        317GB   600GB   283GB             Free Space

Enable lvm flag on partiton 7

(parted) set 7 lvm on

Verify lvm flags

(parted) print free
Model: DELL PERC H730P Adp (scsi)
Disk /dev/sda: 600GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number  Start   End     Size    Type      File system  Flags
        32.3kB  1049kB  1016kB            Free Space
 1      1049kB  1075MB  1074MB  primary   xfs          boot
 2      1075MB  71.4GB  70.3GB  primary                lvm
 3      71.4GB  109GB   37.6GB  primary                lvm
 4      109GB   600GB   491GB   extended
 5      109GB   136GB   26.8GB  logical                lvm
 6      136GB   137GB   1078MB  logical                lvm
 7      137GB   317GB   180GB   logical                lvm
        317GB   600GB   283GB             Free Space

That’s all.

Gineesh Madapparambath

Gineesh Madapparambath

Gineesh Madapparambath is the founder of techbeatly. He is the co-author of The Kubernetes Bible, Second Edition and the author of Ansible for Real Life Automation. He has worked as a Systems Engineer, Automation Specialist, and content author. His primary focus is on Ansible Automation, Containerisation (OpenShift & Kubernetes), and Infrastructure as Code (Terraform). (Read more: iamgini.com)


Note

Disclaimer: The views expressed and the content shared in all published articles on this website are solely those of the respective authors, and they do not necessarily reflect the views of the author’s employer or the techbeatly platform. We strive to ensure the accuracy and validity of the content published on our website. However, we cannot guarantee the absolute correctness or completeness of the information provided. It is the responsibility of the readers and users of this website to verify the accuracy and appropriateness of any information or opinions expressed within the articles. If you come across any content that you believe to be incorrect or invalid, please contact us immediately so that we can address the issue promptly.

Share :

Related Posts

Managing Ansible Inventory

Managing Ansible Inventory

Inventory File An inventory file is a simple and plain text file where we store those host information ansible has to deal with. It can be simple in …

How to create a partition greater than 2TB in Linux

How to create a partition greater than 2TB in Linux

Due to limitation of fdisk utility, you will not be able to create partition greater than 2TB in linux with fdisk. This is a quick example to show …

Enable newly installed vFlash card in Dell iDRAC

Enable newly installed vFlash card in Dell iDRAC

I have explained how to to use vFlash card as an easy boot method here . If you are not able to see a vFlash card (or vFlash card tab is missing in …