Block Storage

Block Storage

ボリュームの作成

  1. demo クレデンシャルを読み込み、非管理プロジェクトとして以下の手順を実行します。

    $ . demo-openrc
    
  2. 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     |
    +---------------------+--------------------------------------+
    
  3. しばらくすると、ボリュームの状態が 作成中 (creating) から 利用可能 (available) に変わるでしょう。

    $ openstack volume list
    
    +--------------------------------------+--------------+-----------+------+-------------+
    | ID                                   | Display Name | Status    | Size | Attached to |
    +--------------------------------------+--------------+-----------+------+-------------+
    | a1e8be72-a395-4a6f-8e07-856a57c39524 | volume1      | available |    1 |             |
    +--------------------------------------+--------------+-----------+------+-------------+
    

ボリュームのインスタンスへの接続

  1. ボリュームをインスタンスに接続します。

    $ openstack server add volume INSTANCE_NAME VOLUME_NAME
    

    INSTANCE_NAME をインスタンス名に、VOLUME_NAME を接続したいボリューム名に置き換えます。

    volume1 ボリュームを provider-instance インスタンスに接続します。

    $ openstack server add volume provider-instance volume1
    

    注釈

    このコマンドは何も出力しません。

  2. ボリュームの一覧を表示します。

    $ 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  |
    +--------------------------------------+--------------+--------+------+--------------------------------------------+
    
  3. SSH を使用して、インスタンスにアクセスします。fdisk コマンドを使用して、ボリュームがブロックストレージデバイス /dev/vdb として存在することを確認します。

     $ 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 エンドユーザーガイドの ボリュームの管理 を参照してください。

インスタンスの起動 に戻ります。

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.