Skip to content

Enable LVM flag on partition using parted in Linux

Avatar photo

https://www.linkedin.com/in/gineesh/ https://twitter.com/GiniGangadharan

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.

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.

Avatar photo


https://www.linkedin.com/in/gineesh/ https://twitter.com/GiniGangadharan
Gineesh Madapparambath is the founder of techbeatly and he is the author of the book - ๐—”๐—ป๐˜€๐—ถ๐—ฏ๐—น๐—ฒ ๐—ณ๐—ผ๐—ฟ ๐—ฅ๐—ฒ๐—ฎ๐—น-๐—Ÿ๐—ถ๐—ณ๐—ฒ ๐—”๐˜‚๐˜๐—ผ๐—บ๐—ฎ๐˜๐—ถ๐—ผ๐—ป. 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). (aka Gini Gangadharan - iamgini.com)

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.