We saw volume creation with related issues and probable solutions.
Now we will see volume attach to VM. Create partition on it. Remove it and detach volume from VM.
Attach created volume to testvm. Following is command-line requirement for cinder volume-attach.
Volume ID will get it from cinder-list use auto to autoassign the new device.
You can check volume status is changed to in-use now and also changed attached with VM ID.
Now login to VM and check if /dev/vdb volume is discovered on VM.
It’s discovered successfully.Now create partition /dev/vdb1 on it using fdisk.
Format /dev/vdb1 partition with ext4 filesystem.
Create directory /test and mount /dev/vdb1 on it.
Now cd to /test and create a test file. I have redirected output of dmesg to dmesg.log file and created one file in /test filesystem.
that’s it volume assign. partition creation, filesystem creation and test file creation into it is done now. Remove file, partition and detach volume from VM now.
Commandline requirement for nova volume-detach.
After that just check status of volume is changed to available and detached from VM.
Then you can delete this volume using cinder delete.
This is basic functionality of creating volume. attaching to VM. Creation of partition, Creation of Filesystem. and remove Filesystem, detach volume from VM and reclaim the disk.
Enjoy 🙂