다음 단계를 관리자가 아닌 프로젝트로 수행하기 위해 demo credential을 소스로 가져옵니다:
$ . demo-openrc
1 GB 볼륨을 생성합니다:
$ openstack volume create --size 1 volume1
+---------------------+--------------------------------------+
| Field | Value |
+---------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2016-03-08T14:30:48.391027 |
| description | None |
| encrypted | False |
| id | a1e8be72-a395-4a6f-8e07-856a57c39524 |
| multiattach | False |
| name | volume1 |
| properties | |
| replication_status | disabled |
| size | 1 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| type | None |
| updated_at | None |
| user_id | 684286a9079845359882afc3aa5011fb |
+---------------------+--------------------------------------+
잠시 후, 볼륨 상태가 creating 에서 available 로 바뀌어야 합니다:
$ openstack volume list
+--------------------------------------+--------------+-----------+------+-------------+
| ID | Display Name | Status | Size | Attached to |
+--------------------------------------+--------------+-----------+------+-------------+
| a1e8be72-a395-4a6f-8e07-856a57c39524 | volume1 | available | 1 | |
+--------------------------------------+--------------+-----------+------+-------------+
볼륨을 인스턴스에 연결합니다:
$ openstack server add volume INSTANCE_NAME VOLUME_NAME
INSTANCE_NAME 을 인스턴스 이름으로, 그리고 VOLUME_NAME 를 연결하고자 하는 볼륨에 대한 이름으로 변경합니다.
예시
volume1 볼륨을 provider-instance 인스턴스에 연결합니다:
$ openstack server add volume provider-instance volume1
주석
이 명령어는 출력이 없습니다.
볼륨 목록:
$ openstack volume list
+--------------------------------------+--------------+--------+------+--------------------------------------------+
| ID | Display Name | Status | Size | Attached to |
+--------------------------------------+--------------+--------+------+--------------------------------------------+
| a1e8be72-a395-4a6f-8e07-856a57c39524 | volume1 | in-use | 1 | Attached to provider-instance on /dev/vdb |
+--------------------------------------+--------------+--------+------+--------------------------------------------+
SSH를 사용하여 인스턴스에 액세스하고 /dev/vdb 블럭 스토리지 장치에 대한 볼륨이 있는지를 검증하기 위해 fdisk 명령어를 사용합니다:
$ sudo fdisk -l
Disk /dev/vda: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/vda1 * 16065 2088449 1036192+ 83 Linux
Disk /dev/vdb: 1073 MB, 1073741824 bytes
16 heads, 63 sectors/track, 2080 cylinders, total 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/vdb doesn't contain a valid partition table
주석
장치에 파일 시스템을 생성하고 해당 볼륨을 사용하기 위해 마운트해야 합니다.
볼륨 관리 방법에 대한 자세한 정보는 OpenStack End User Guide 내 Manage volumes 를 살펴봅니다.
인스턴스 실행 으로 돌아갑니다.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.