0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

OCI学習#3 Block Volume追加

Posted at

概要

OCI Architect Associate 2024資格取得に向けて学習を進めているが、
実際に触ったほうが理解も進み、いざ構築する際に手が止まらなくなると考えたため
OCIチュートリアルを参考に操作感を覚える。
その際の手順等を見返せるように、簡単に記す。

OCI学習記事まとめ

今回の一連の記事を下記にまとめます。
1.OCI学習#1 ネットワーク設定
予算設定、コンパートメント作成、VCN、IGW、ルート表、セキュリティリスト作成。
2.OCI学習#2 インスタンス作成、接続:
インスタンス作成、SSH接続

ゴール

入門編 - Oracle Cloud Infrastructure を使ってみよう
チュートリアルを参考に、下記を実施して操作感を覚える。
1.クライアントからパブリックサブネットのインスタンスSV01へ接続。
2.インスタンスSV01からプライベートサブネットのインスタンスSV02へ接続。
3.SV02へBlock Volumeを追加、マウント。
4.クライアントからObject StorageのObjectにアクセス。
edu02.png

本記事の内容

ブロックボリュームを作成し、インスタンスVM02へアタッチ
インスタンスVM02 OS上でパーティション設定、マウント

構築

ブロックボリューム作成

1.[ストレージ]-[ブロック・ストレージ]-[ブロック・ボリューム]をクリック
2.[ブロック・ボリュームの作成]をクリック
基本的には全てデフォルト。ブロックボリュームも最低容量が50GB。
23.png

ブロックボリュームアタッチ

1.[ブロックボリューム]-[対象ボリューム]-[アタッチされたインスタンス]をクリック
2.[インスタンスにアタッチ]をクリック
iSCSI、権限RWを選択。
対象のインスタンスはリストから選択することができる。
デバイスパスについてもプルダウンの中からせんたくかのう
22.png

OS側で設定

・ターゲット設定
OS側で設定を行う下記コマンドについては、ボリューム作成後、アクションボタン(・・・)からコピーして
使用することが可能なのでかなり便利。

sudo iscsiadm -m node -o new -T <Target> -p <IP:port>
sudo iscsiadm -m node -o update -T <Target> -n node.startup -v automatic
sudo iscsiadm -m node -T <Target> -p <IP:port> -l

・ディスク確認(sdbが対象)

[opc@vm02 ~]$ lsblk
NAME               MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                  8:0    0 46.6G  0 disk
tqsda1               8:1    0  100M  0 part /boot/efi
tqsda2               8:2    0    1G  0 part /boot
mqsda3               8:3    0 45.5G  0 part
  tqocivolume-root 252:0    0 35.5G  0 lvm  /
  mqocivolume-oled 252:1    0   10G  0 lvm  /var/oled
sdb                  8:16   0   50G  0 disk

・パーティション設定

[root@vm02 ~]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xdd48d9d7.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p):

Using default response p.
Partition number (1-4, default 1):
First sector (2048-104857599, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-104857599, default 104857599):

Created a new partition 1 of type 'Linux' and of size 50 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

・ファイルシステム作成

[root@vm02 ~]# mkfs -t xfs /dev/sdb1
meta-data=/dev/sdb1              isize=512    agcount=4, agsize=3276736 blks
         =                       sectsz=4096  attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1    bigtime=0 inobtcount=0
data     =                       bsize=4096   blocks=13106944, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=25600, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
Discarding blocks...Done.

・ディレクトリマウント(/dev/sdb1→/work)

[root@vm02 ~]# mkdir /work
[root@vm02 ~]# mount /dev/sdb1 /work/
[root@vm02 ~]# df -Th
Filesystem                 Type      Size  Used Avail Use% Mounted on
devtmpfs                   devtmpfs  428M     0  428M   0% /dev
tmpfs                      tmpfs     474M     0  474M   0% /dev/shm
tmpfs                      tmpfs     474M  6.6M  468M   2% /run
tmpfs                      tmpfs     474M     0  474M   0% /sys/fs/cgroup
/dev/mapper/ocivolume-root xfs        36G  7.3G   29G  21% /
/dev/mapper/ocivolume-oled xfs        10G  147M  9.9G   2% /var/oled
/dev/sda2                  xfs      1014M  332M  683M  33% /boot
/dev/sda1                  vfat      100M  6.0M   94M   6% /boot/efi
tmpfs                      tmpfs      95M     0   95M   0% /run/user/986
tmpfs                      tmpfs      95M     0   95M   0% /run/user/1000
/dev/sdb1                  xfs        50G  389M   50G   1% /work

まとめ

・ブロックボリュームの最低容量は50GB
・iSCSIでアタッチする場合、OS側での設定コマンドは用意されてあり、コピペするだけなので便利。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?