Cyber Deals - Get up to 65% 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)


Disclaimer: Views expressed in articles are those of the respective authors and do not necessarily reflect the views of their employers or this site. While we aim for accuracy, please verify information before relying on it, and let us know if you spot an error.
Share:

Related Posts

How to Install and Configure AWS Command Line Interface (CLI)

How to Install and Configure AWS Command Line Interface (CLI)

The AWS Command Line Interface (CLI) is a unified tool to manage your AWS services. With just one tool to download and configure, you can control …

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...

Slip Stream Method for SQL Server Build

Slip Stream Method for SQL Server Build

This document is to guide when we want to integrate the SQL setup media with Service Pack, Cumulative updates and hotfixes in once single iso...

How to Reset an HPE Blade iLO to factory default

How to Reset an HPE Blade iLO to factory default

During a bulk deployment you noticed that, one of the HPE blade iLO in an HPE c7000 enclosure is not responding properly or configurations are...

Infrastructre & hardware

Register in RHN after installation

There are many situations where we need to register the host/server to RHN server manually, due to network issues, bad certificate/authentication or …

Infrastructre & hardware

How to Check Linux/Unix Operating System Version, Maintenance Level, Architecure

We can identify the Unix Operating System architecture by uname or arch command. Try below examples. Linux kernel version and hardware architecture # …