How to set up Cinder volumes correctly?

asked 2014-10-29 07:59:59 -0500

mr_element gravatar image

updated 2014-10-29 10:39:17 -0500

BrunoGraz gravatar image

Hi, I am working on a server with a single physical HDD. I have installed Ubuntu 14.04 and using command:

sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL

I get this output:

NAME   FSTYPE   SIZE MOUNTPOINT LABEL
sda           837.9G
├─sda1 ext4   832.9G /
├─sda2            1K
├─sda4         1023K
└─sda5 swap       5G [SWAP]
sr0            1024M

I have set up the Cinder service but when I try inputting this command:

pvcreate /dev/sda1

I get as output: Can't open /dev/sda1 exclusively. Mounted filesystem?

What have I missed and how to set the volume(s) correctly?

edit retag flag offensive close merge delete

Comments

You should "pvcreate /dev/sda" without specify any partitions on it. Not sda1 but sda.

Ramirezkiv gravatar imageRamirezkiv ( 2016-01-21 07:03:07 -0500 )edit

5 answers

Sort by » oldest newest most voted
1

answered 2014-10-30 06:48:59 -0500

You can add one more drive to that instance. Let us say "dev/sdb". Then you can do pvcreate /dev/sdb

Best option is:

  1. Create a loopback device in your machine.
  2. Create physical volume (using pvcreate) on that device.
  3. Then create Volume Group on top of that "vgcreate".

How to create:

  1. Create a 8G loopback device using: dd if=/dev/zero of=NewDrive.img bs=1G count=8

  2. Create loop back device: losetup /dev/loop0 NewDrive.img

  3. Then create physical volume on it: pvcreate /dev/loop0

  4. Now you can create volume group: vgcreate "cinder-volumes" /dev/loop0

edit flag offensive delete link more
0

answered 2015-04-07 03:17:56 -0500

Kannan Raman gravatar image

updated 2015-04-07 03:18:43 -0500

@BharatKumarKobagana, your steps are perfect but, it fails in few systems saying "No such File or Directory" during physical volume creation. For that we found a solution where we have to format the file device and then need to be assigned back to loopback device.

STEPS:

  1. Create a 8G loopback device using: dd if=/dev/zero of=NewDrive.img bs=1G count=8

    #Additional Step

  2. Device file format for some ext3 or other: mkfs.ext3 NewDrive.img

  3. Create loop back device: losetup /dev/loop0 NewDrive.img

  4. Then create physical volume on it: pvcreate /dev/loop0

  5. Now you can create volume group: vgcreate "cinder-volumes" /dev/loop0

edit flag offensive delete link more
0

answered 2014-10-29 09:51:17 -0500

Alex Z gravatar image

In your case /dev/sda1 is already mounted as root file system - you cannot make PV on it. It will be better if you will have a second HDD, or even to have RAID for it (depending on your needs). If you want only prove idea you need to make empty partition for PV.

for example. make /dev/sda1- for root fs - I think 20GB will be enough /dev/sda2 - for SWAP for example 5G as in your case /dev/sda3 - all other space - is about 800G for PV for cinder-volumes

when you make pvcreate /dev/sda3 ... vgcreate cinder-volumes /dev/sda3 ... and so on

edit flag offensive delete link more

Comments

1

I need to reformat the whole system to do that or I can reallocate the existing space as it is in Ubuntu? How can I do that - just a rough description?

mr_element gravatar imagemr_element ( 2014-10-30 04:28:53 -0500 )edit

resize of root partition in the place is difficult, if it is a fresh installation only for cinder I think simpler and faster just to reinstall with new partitioning.

Alex Z gravatar imageAlex Z ( 2014-10-31 05:34:15 -0500 )edit
0

answered 2014-12-14 12:35:19 -0500

Nael gravatar image

In that case in a fresh installation , what would be the ideal partitioning during a fresh Ubuntu install? (what partition formats etc. ) ??

edit flag offensive delete link more
0

answered 2016-02-07 21:32:52 -0500

you could just do a vgextend "cinder-volume-name" /dev/loopX on the newly created physical volume to add that space onto the existing backend as well.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2014-10-29 07:59:59 -0500

Seen: 5,119 times

Last updated: Apr 07 '15