TheKoguryo's Tech Blog

 Version 2024.04.01

Warning

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

3.6.6 Unmounting Block Volume

Unmount

  1. Connect to the Compute Instance with SSH.

  2. Update /etc/fstab
    Execute the sudo vi /etc/fstab command to delete /mnt/vol1, the volume to be unmounted, from the fstab file.

    sudo vi /etc/fstab
    
  3. Unmount

    sudo umount /mnt/vol1
    

Disconnect to Volume

  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 appears.

    image-20220110180428340

  6. Copy the commands of Disconnect COMMANDS and execute them one by one in the SSH session connected to the instance.

    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 -T iqn.2015-12.com.oracleiaas:2626c782-30e1-43c2-847a-2504080445ec -p 169.254.2.3:3260 -u
    Logging out of session [sid: 1, target: iqn.2015-12.com.oracleiaas:2626c782-30e1-43c2-847a-2504080445ec, portal: 169.254.2.3,3260]
    Logout of [sid: 1, target: iqn.2015-12.com.oracleiaas:2626c782-30e1-43c2-847a-2504080445ec, portal: 169.254.2.3,3260] successful.
    [opc@examplelinuxinstance ~]$ sudo iscsiadm -m node -o delete -T iqn.2015-12.com.oracleiaas:2626c782-30e1-43c2-847a-2504080445ec -p 169.254.2.3:3260
    
  7. Check with the fdisk -l command to confirm whether or not it has been dismounted.

    You can see that the /dev/sdb disk is gone.

    [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
    

Unmount Volume

  1. In the OCI console, click the action icon next to the Block Volume you want to dismount, then click Detach.

    image-20220110181021504

  2. After confirming the warning, click Detach volume. We ran the /etc/fstab cleanup, unmount, and iSCSI Disconnect commands all earlier.

    image-20220110181115560

  3. It shows DETACHING status. When finished, it will disappear from the Attached Block Volumes list.



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