Openstack-cinder_lvm_driver Command Summary

Source: Internet
Author: User

http://blog.csdn.net/sxmatch/article/details/9304127

DD If=/dev/zero of=cinder-volumes bs=1 count=0 seek=2g
losetup/dev/loop2 cinder-volumes
fdisk/dev/loop2
#Type in the followings:
n
P
1
Enter
enter
t
8e
W

Proceed to create the physical volume then the volume Group:

PVCREATE/DEV/LOOP2
vgcreate CINDER-VOLUMES/DEV/LOOP2

Cinder when using LVM (logical volume management) as driver, a series of commands are required to perform the normal use of cinder in the SUSE environment and Ubuntu environments that do not install LVM:

1. Create physical volumes (typically select another or more hard disks that are not used by the server as physical volumes for cinder use)

pvcreate [disk device path] For example: Pvcreate/dev/sdb You can use the Pvdisplay command to view the physical volume details after the creation is complete

2. Create a volume group (cinder default volume group name is Cinder-volumes)

Vgcreate [Volume group name] [partition or disk to add to the volume group] For example: Vgcreate cinder-volumes/dev/sdb You can use the Vgdisplay command to view the volume group details after the creation is complete

3. Activate the volume group (after this step is complete, cinder will be able to use LVM normally)

Vgchange-ay [Volume group name] For example Vgchange-ay cinder-volumes

4. If the volume group does not have enough space, you can add a new physical volume to the volume group later

Vgextend [Volume group name] [physical volume path] For example: vgextend CINDER-VOLUMES/DEV/SDC Note Adding a new physical volume also activates the volume group again

5. To remove a physical volume from a volume group, first make sure that no logical volume is used for this physical volume

Vgreduce [Volume group name] [physical volume path] For example: Vgreduce CINDER-VOLUMES/DEV/SDC

6. Create a logical volume (Cinder's LVM driver is to create a volume using this command)

lvcreate-l [Volume size MB]-N [Volume name] [volume group name] For example: Lvcreate-l 1000-n volume1 cinder-volumes After creation, you can also query: Lvdisplay

7. Expand the logical volume (you can extend the size of the logical volume, depending on the parameters there are two ways)

lvextend-l [Size] [logical volume Path] For example: 1. Extended to 12G lvextend-l 12g/dev/cinder-volumes/volume1; 2. Increase 12G lvextend-l +12g/dev/cinder-vol Umes/volume1

8. Reduce logical volumes (as with extensions, there are two different ways depending on the parameters)

lvreduce-l [Size] [logical volume Path] For example: 1. Reduced to 4G lvreduce-l 4g/dev/cinder-volumes/volume1; 2. Reduce 4G lvreduce-l -4g/dev/cinder-volumes/volume1

9. Delete the logical volume (make sure the volume is not mounted)

Lvremove [Logical Volume Path] For example: lvremove/dev/cinder-volumes/volume1

Note Sometimes when deleting a logical volume, it is reported that the can ' t remove open logical Volume error, you need to first clear the Linux system in the Block device mapping relationship, for example: Dmsetup remove-f/dev/mapper/cinder– Volumes-volume1

10.LVM driver after the volume is created, iSCSI Target is also created for the volume and used for subsequent hanging volumes when the cinder implementation is tgtadm (in addition to the ITEADM and Lioadm two implementations) the commands used are:

tgt-admin–update [iSCSI Target name] For example: Tgt-admin–update iqn.2010-10.org.openstack: volume-2748f2f2-4394-4e6e-af8d-8dd34496c024 (The Cinder default iSCSI name is the prefix + volume uuid, where the prefix defaults to Iqn.2010-10.org.openstack:)

To query all of the iSCSI target commands: Tgt-admin–show

command to remove iSCSI target: Tgt-admin–force–delete [iSCSI target name] For example: Tgt-admin–force–delete iqn.2010-10.org.openstack: volume-2748f2f2-4394-4e6e-af8d-8dd34496c024


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.