TheKoguryo's Tech Blog

 Version 2024.10.18

Warning

This content has been generated by machine translation. The translations are automated and have not undergone human review or validation.

3.6.3 Connecting to Block Volume

After mounting the Block Volume, you need to establish an iSCSI connection. It is executed by the iscsiadm command, and the command to be executed is provided by the mounted Block Volume, so you can copy it and run it as it is.

  1. Open the navigation menu in the OCI console. Go to Compute > Instances.

  2. Click on the name of the target Instance you created earlier.

  3. On the Instance detail page, click Resources > Attached block volumes in the lower left corner.

  4. Click on the action icon (three dots on the right) next to the Block Volume you just mounted, then click on iSCSI commands and information.

    image-20220110162102923

  5. The iSCSI commands and information dialog pops up. You can check the IP and Port for the mounted volume, and the commands to be used for mounting and dismounting are displayed. Since IP and Port are already entered in the command, you can copy and use it as it is.

    Copy the command in the Connect entry to connect.

    image-20220110162233402

  6. Connect via SSH connected to the attached instance.

  7. Copy the commands in Connect Commands and run them one by one in order in your SSH session.

    ubuntu@NOTEBOOK-WORK:~/.ssh$ ssh -i privateKey opc@146.56.171.xx
    Last login: Mon Jan 10 07:24:34 2022 from 223.62.21.xx
    [opc@examplelinuxinstance ~]$ sudo iscsiadm -m node -o new -T iqn.2015-12.com.oracleiaas:2626c782-30e1-43c2-847a-2504080445ec -p 169.254.2.3:3260
    sudo iscsiadm -m node -T iqn.2015-12.com.oracleiaas:2626c782-30e1-43c2-847a-2504080445ec -p 169.254.2.3:3260 -lNew iSCSI node [tcp:[hw=,ip=,net_if=, iscsi_if=default] 169.254.2.3,3260,-1 iqn.2015-12.com.oracleiaas:2626c782-30e1-43c2-847a-2504080445ec] added
    [opc@examplelinuxinstance ~]$ sudo iscsiadm -m node -o update -T iqn.2015-12.com.oracleiaas:2626c782-30e1-43c2-847a-2504080445ec -n node.startup -v automatic
    [opc@examplelinuxinstance ~]$ sudo iscsiadm -m node -T iqn.2015-12.com.oracleiaas:2626c782-30e1-43c2-847a-2504080445ec -p 169.254.2.3:3260 -l
    Logging in to [iface: default, target: iqn.2015-12.com.oracleiaas:2626c782-30e1-43c2-847a-2504080445ec, portal: 169.254.2.3,3260] (multiple)
    Login to [iface: default, target: iqn.2015-12.com.oracleiaas:2626c782-30e1-43c2-847a-2504080445ec, portal: 169.254.2.3,3260] successful.
    
  8. After performing all iSCSI commands for mounting, you can now format and mount as you would a hard disk in Linux. First, run the following command to check whether it is mounted or not.

    sudo fdisk -l
    
    • Execution result

      • If you look at the bottom, you can see that Disk /dev/sdb is mounted.
      [opc@examplelinuxinstance ~]$ sudo fdisk -l
      WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
      
      Disk /dev/sda: 50.0 GB, 50010783744 bytes, 97677312 sectors
      Units = sectors of 1 * 512 = 512 bytes
      Sector size (logical/physical): 512 bytes / 4096 bytes
      I/O size (minimum/optimal): 4096 bytes / 1048576 bytes
      Disk label type: gpt
      Disk identifier: BBBA97C2-4E47-43B0-9059-2702FDB720E7
      
      
      #         Start          End    Size  Type            Name
       1         2048       411647    200M  EFI System      EFI System Partition
       2       411648     17188863      8G  Linux swap
       3     17188864     97675263   38.4G  Microsoft basic
      
      Disk /dev/sdb: 53.7 GB, 53687091200 bytes, 104857600 sectors
      Units = sectors of 1 * 512 = 512 bytes
      Sector size (logical/physical): 512 bytes / 4096 bytes
      I/O size (minimum/optimal): 4096 bytes / 1048576 bytes
      
      • If you look at the bottom, you can see that Disk /dev/sdb is mounted.


As an individual, this article was written with my personal time. There may be errors in the content of the article, and the opinions in the article are personal opinions.

Last updated on 10 Jan 2022