LAB 20 ‐ Detach Block Volume - gautam-amitesh/OCI GitHub Wiki
Earlier we attached a block volume to an instance first by using the OCI console then we got iSCI attach commands (updated as Connect) which we used in PuTTY terminal. Now we want to detach this block volume from this instance. First, we need to ensure that no any applications are using the volume. Second, we unmount the filesystem using umount command. Third, we remove or comment out any references to this specific volume in our /etc/fstab file using vi in the PuTTY terminal. Fourth, we run the iSCSI detach commands (updated as Disconnect) that we obtained earlier when attaching it via the OCI console. Finally, we detach the volume using the OCI console.
-
After ensuring that no any applications are using the volume, unmount the volume but before that we want a reference from where we can compare the current state after performing any operation (eg. unmount) so we run
lsblkanddf -hlsblkdf -hsudo umount /u01lsblkdf -h -
Now we will either comment out the line or delete the line which refernces this volume in
/etc/fstabfilesudo vi /etc/fstab-
comment out the line
add # before the line -
remove the line
-
-
Now we run
iSCSI Disconnect commandwhich will show a successful messagesudo iscsiadm -m node -T iqn.2015-12.com.oracleiaas:d0e3a79c-4036-4db5-8df5-ea1981e21e46 -p 169.254.2.2:3260 -u sudo iscsiadm -m node -o delete -T iqn.2015-12.com.oracleiaas:d0e3a79c-4036-4db5-8df5-ea1981e21e46 -p 169.254.2.2:3260 -
Now we will verify if the volume is detached
lsblk -
In OCI console navigate to
storage detailspage of the instance and click theactionsmenu in theAttached block volumessection and clickDetach volumeNavigation menu > Compute > Instances > the instance (bastion-server1) > Storage > Actions > Detach