3

I have an external disk sda on the machine and I want to create an LVM physical volume from free space of the sda. Here are the partition sizes:

 Name                     Flags                   Part Type             FS Type                            [Label]                       Size (MB)
 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
                                                          Pri/Log              Free Space                                                            1.05              *
        sda1                     Boot                     Primary              xfs                                                                1073.75              *
        sda2                                              Primary              swap                                                               8456.77              *
        sda3                                              Primary              xfs                                                              107374.19              *
                                                          Pri/Log              Free Space                                                       383202.13              *

Actually, I want to create a sda4 partition as LVM Physical Volume and create the LVM volume group on that. Can someone tell how can I do that?

I should mention that the goal is to set up a Cinder node for the OpenStack. According to the documentation, it should be done using the commands:

pvcreate /dev/sdb
vgcreate cinder-volumes /dev/sdb

But there is not a second disk sdb on my machine and I want to know how to do that using just the disk sda.

1 Answers1

2

Instead of /dev/sdb, you can use a partition on your /dev/sda as a physical LVM partition but you have to create it first.

IMPORTANT NOTICE: Make a backup of the whole disk before modifying partitions on your hard drive.

If you can use GUI, use GParted to create the new partition. Otherwise, run:

sudo parted /dev/sda

In the parted environment (indicated by the (parted) prompt), issue:

print free

Then issue the following command where <START> is replaced by the number given by the previous command as the start of the free space after sda3.

mkpart primary ext4 <START> 100%

Quit parted.

quit

Then you should be able to issue the commands:

sudo pvcreate /dev/sda4
sudo vgcreate cinder-volumes /dev/sda4
Melebius
  • 11,431
  • 9
  • 52
  • 78