Create a non-bootable volume (8G)
$ cinder create --display-name test-vol1 8
+---------------------+--------------------------------------+
| Property | Value |
+---------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| created_at | 2014-06-22T14:48:17.015580 |
| display_description | None |
| display_name | test-vol1 |
| encrypted | False |
| id | 3339503f-b422-489d-81b4-7b9eb245fe42 |
| metadata | {} |
| size | 8 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| volume_type | None |
+---------------------+--------------------------------------+
$ cinder show test-vol1
+--------------------------------+--------------------------------------+
| Property | Value |
+--------------------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| created_at | 2014-06-22T14:48:17.000000 |
| display_description | None |
| display_name | test-vol1 |
| encrypted | False |
| id | 3339503f-b422-489d-81b4-7b9eb245fe42 |
| metadata | {} |
| os-vol-host-attr:host | novo |
| os-vol-mig-status-attr:migstat | None |
| os-vol-mig-status-attr:name_id | None |
| os-vol-tenant-attr:tenant_id | d40ee1521270498cbd71cbfdbf54a4ff |
| size | 8 |
| snapshot_id | None |
| source_volid | None |
| status | available |
| volume_type | None |
+--------------------------------+--------------------------------------+
Volume is visible via dashboard
$ nova list
+--------------------------------------+---------------+--------+------------+-------------+--------------------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+---------------+--------+------------+-------------+--------------------------------+
| affcd01a-9669-4b8f-a89c-5152966d8981 | centos-test01 | ACTIVE | - | Running | private=10.0.0.9, 172.24.4.232 |
| 0c84e296-82d1-487b-bb5f-576b4c73607f | fedora-test01 | ACTIVE | - | Running | private=10.0.0.8, 172.24.4.231 |
| c936ede3-4ec6-4e36-8b1e-3c319badc9c5 | jumphost | ACTIVE | - | Running | private=10.0.0.2, 172.24.4.236 |
+--------------------------------------+---------------+--------+------------+-------------+--------------------------------+
$ cinder list
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
| ID | Status | Display Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
| 3339503f-b422-489d-81b4-7b9eb245fe42 | available | test-vol1 | 8 | None | false | |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
Now attach this cinder volume to centos instance
usage: nova volume-attach <server> <volume> [<device>]
$ nova volume-attach affcd01a-9669-4b8f-a89c-5152966d8981 3339503f-b422-489d-81b4-7b9eb245fe42
+----------+--------------------------------------+
| Property | Value |
+----------+--------------------------------------+
| device | /dev/vdb |
| id | 3339503f-b422-489d-81b4-7b9eb245fe42 |
| serverId | affcd01a-9669-4b8f-a89c-5152966d8981 |
| volumeId | 3339503f-b422-489d-81b4-7b9eb245fe42 |
+----------+--------------------------------------+
This volume is showing as in-use and attached to an instance.
$ cinder list
+--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+
| ID | Status | Display Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+
| 3339503f-b422-489d-81b4-7b9eb245fe42 | in-use | test-vol1 | 8 | None | false |affcd01a-9669-4b8f-a89c-5152966d8981 |
+--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+
SSH into centos instance and check /var/log/messages
Jun 22 12:59:34 host-10-0-0-9 kernel: vdb: unknown partition table
/dev/vdb is ready for use :
[root@centos-test01 ~]# fdisk -l /dev/vdb
Disk /dev/vdb: 8589 MB, 8589934592 bytes
16 heads, 63 sectors/track, 16644 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Rackspace also provided a good tutorial page for this feature. Link
# mkfs.ext3 /dev/vdb
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
524288 inodes, 2097152 blocks
104857 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2147483648
64 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
# mkdir /test01
# vi /etc/fstab
/dev/vdb /test01 ext3 defaults 0 0
# mount /test01
No comments:
Post a Comment