{"id":458,"date":"2025-07-14T17:28:37","date_gmt":"2025-07-14T17:28:37","guid":{"rendered":"http:\/\/77interactive.com\/?p=458"},"modified":"2025-08-10T22:15:35","modified_gmt":"2025-08-10T22:15:35","slug":"attach-drive-in-oci","status":"publish","type":"post","link":"http:\/\/77interactive.com\/?p=458","title":{"rendered":"Attach Drive in OCI"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code># Mount a disk in OCI\nThe following command mounts a disk in Oracle Cloud Infrastructure (OCI):  \nhttps:&#47;&#47;docs.oracle.com\/en-us\/iaas\/Content\/Block\/Tasks\/connectingtoavolume_topic-Connecting_to_iSCSIAttached_Volumes.htm  \n\n## Mounting commands via iscsiadm\nThe following commands are found in the three dot menu for each volume.  \nThe volume iqn is found in the volume page.\n```\n$ iscsiadm -m node -o new -T &lt;volume IQN> -p &lt;iSCSI IP address>:&lt;iSCSI\u00a0port>\nNew iSCSI node &#91;tcp:&#91;hw=,ip=,net_if=,iscsi_if=default] 169.254.0.2,3260,-1 iqn.2015-12.us.oracle.com:c6acdaXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX] added\n\n$ iscsiadm -m node -T &lt;volume IQN> -o update -n node.startup -v automatic \n\n$ iscsiadm -m node -T &lt;volume's IQN> -p &lt;iSCSI\u00a0IP Address>:&lt;iSCSI port> -l\nLogging in to &#91;iface: default, target: iqn.2015-12.us.oracle.com:c6acdaXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX, portal: 169.254.0.2,3260] (multiple)\nLogin to &#91;iface: default, target: iqn.2015-12.us.oracle.com:c6acdaXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX, portal: 169.254.0.2,3260] successful.\n```\nNote: Some of these commands produce no output.\n\n## Locate the disk with fdisk\nVerify the disk exists using **fdisk**.  \nThis will display extended disk information for all disks.  \nNewer disks will appear near the bottom of the output.  \n```\n$ fdisk -l\n...\n...\nDisk \/dev\/sdb: 1 TiB, 1099511627776 bytes, 2147483648 sectors\nDisk model: BlockVolume\nUnits: sectors of 1 * 512 = 512 bytes\nSector size (logical\/physical): 512 bytes \/ 4096 bytes\nI\/O size (minimum\/optimal): 4096 bytes \/ 1048576 bytes\n...\n```\n\n# Prepare the disk\nNext, prepare the disk for a file system using **fdisk** or **parted**\n\n## Prepare the disk with parted\nCreate the partitions using **parted** with the following:\n```\nsudo parted \/dev\/sdc mklabel gpt\nsudo parted -a optimal \/dev\/sdc mkpart primary ext4 0% 100%\n```\nThe command above utilizes the entire disk. \n\n## Prepare the disk with fdisk\nCreate the partition using the **fdisk** command.  \nThe fdisk command is interactive.  \nThe first command will be **n** to create a new parition.  \nThen, select the defaults options.  \nLastly, use **w** to write the changes.  \n```\n# Walk through with fdisk\nsudo fdisk \/dev\/sdc\n\nWelcome to fdisk (util-linux 2.37.4).\nChanges will remain in memory only, until you decide to write them.\nBe careful before using the write command.\n\nDevice does not contain a recognized partition table.\nCreated a new DOS disklabel with disk identifier 0x3fdba443.\n\nCommand (m for help): n\nPartition type\n   p   primary (0 primary, 0 extended, 4 free)\n   e   extended (container for logical partitions)\nSelect (default p):\n\nUsing default response p.\nPartition number (1-4, default 1):\nFirst sector (2048-2147483647, default 2048):\nLast sector, +\/-sectors or +\/-size{K,M,G,T,P} (2048-2147483647, default 2147483647):\n\nCreated a new partition 1 of type 'Linux' and of size 1024 GiB.\n\nCommand (m for help): w\nThe partition table has been altered.\nCalling ioctl() to re-read partition table.\nSyncing disks.\n```\n\n# Format the new filesytem\nNow that the disk is partitioned, format the disk.  \nIn this example, we will used **ext4**.  \nThe command takes a few moments as the drive is formatted.  \n```\nsudo mkfs.ext4 \/dev\/sdc1\nmke2fs 1.46.5 (30-Dec-2021)\nDiscarding device blocks: done\nCreating filesystem with 268435200 4k blocks and 67108864 inodes\nFilesystem UUID: cf468075-167f-4673-8689-8412bf6cc071\nSuperblock backups stored on blocks:\n        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,\n        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,\n        102400000, 214990848\n\nAllocating group tables: done\nWriting inode tables: done\nCreating journal (262144 blocks): done\nWriting superblocks and filesystem accounting information: done\n```\n\n# Create a mount point directory and mount the drive\n\nCreate a directory that will host the drive.\n```\nsudo mkdir \/mnt\/backups\n```\nNext, mount the drive on the newly created directory\n```\nsudo mount \/dev\/sdc1 \/mnt\/backups\n```\n\n# Modify the \/etc\/fstab file\nWe need to persist the changes in the fstab file.  \n\n## Obtain the disk UUID\nFirst, get the UUID for the disk.\n```\n$ sudo blkid \/dev\/sdc1\n\/dev\/sdc1: UUID=\"cf468075-167f-4673-8689-8412bf6cc071\" TYPE=\"ext4\" PARTUUID=\"3fdba443-01\"\n```\n## Update \/etc\/fstab\nWith the UUID in hand, we will update the **\/etc\/fstab** file.  \n```\nsudo nano \/etc\/fstab\n```\nNavigate to the bottom of the file and add the following line with the UUID and the following settings.\n```\nUUID=your-uuid-here \/mnt\/backups ext4 defaults,_netdev,nofail,noatime,nodiratime,data=journal 0 2\n```\nThe settings are as follows:\n- noatime: Skips updating access timestamps\u2014reduces unnecessary I\/O.\n- nodiratime: Skips access timestamps on directories (optional, often bundled with noatime).\n- data=journal: Writes metadata and file data to the journal. Safer for backups, slightly slower than data=ordered, but ensures recovery in the event of power loss or crashes.\n- _netdev: Prevents the disk from mounting until network is available\u2014essential for iSCSI drives.\n- nofail: allows the boot process to continue even if the specified filesystem fails to mount.\n- defaults: Includes typical options like rw, suid, dev, exec, auto, nouser, and async.\n\n# Mount and Reboot\nLastly, we will mount the new drive and reboot the server\n```\n$ sudo mount -a\n$ sudo reboot\n```<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":452,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[57],"tags":[42],"class_list":["post-458","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-linux"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Attach Drive in OCI - 77 Interactive<\/title>\n<meta name=\"description\" content=\"Learn how to mount and partition a disk in Oracle Cloud Infrastructure. Get the exact commands to mount a disk in linux.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/77interactive.com\/?p=458\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Attach Drive in OCI - 77 Interactive\" \/>\n<meta property=\"og:description\" content=\"Learn how to mount and partition a disk in Oracle Cloud Infrastructure. Get the exact commands to mount a disk in linux.\" \/>\n<meta property=\"og:url\" content=\"http:\/\/77interactive.com\/?p=458\" \/>\n<meta property=\"og:site_name\" content=\"77 Interactive\" \/>\n<meta property=\"article:published_time\" content=\"2025-07-14T17:28:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-10T22:15:35+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/77interactive.com\/wp-content\/uploads\/2025\/06\/buildings2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Rudy\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rudy\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/77interactive.com\/?p=458#article\",\"isPartOf\":{\"@id\":\"http:\/\/77interactive.com\/?p=458\"},\"author\":{\"name\":\"Rudy\",\"@id\":\"http:\/\/77interactive.com\/#\/schema\/person\/0e61d2a984b8304618026b207e6121e9\"},\"headline\":\"Attach Drive in OCI\",\"datePublished\":\"2025-07-14T17:28:37+00:00\",\"dateModified\":\"2025-08-10T22:15:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/77interactive.com\/?p=458\"},\"wordCount\":4,\"image\":{\"@id\":\"http:\/\/77interactive.com\/?p=458#primaryimage\"},\"thumbnailUrl\":\"http:\/\/77interactive.com\/wp-content\/uploads\/2025\/06\/buildings2.png\",\"keywords\":[\"Linux\"],\"articleSection\":[\"linux\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/77interactive.com\/?p=458\",\"url\":\"http:\/\/77interactive.com\/?p=458\",\"name\":\"Attach Drive in OCI - 77 Interactive\",\"isPartOf\":{\"@id\":\"http:\/\/77interactive.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/77interactive.com\/?p=458#primaryimage\"},\"image\":{\"@id\":\"http:\/\/77interactive.com\/?p=458#primaryimage\"},\"thumbnailUrl\":\"http:\/\/77interactive.com\/wp-content\/uploads\/2025\/06\/buildings2.png\",\"datePublished\":\"2025-07-14T17:28:37+00:00\",\"dateModified\":\"2025-08-10T22:15:35+00:00\",\"author\":{\"@id\":\"http:\/\/77interactive.com\/#\/schema\/person\/0e61d2a984b8304618026b207e6121e9\"},\"description\":\"Learn how to mount and partition a disk in Oracle Cloud Infrastructure. Get the exact commands to mount a disk in linux.\",\"breadcrumb\":{\"@id\":\"http:\/\/77interactive.com\/?p=458#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/77interactive.com\/?p=458\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/77interactive.com\/?p=458#primaryimage\",\"url\":\"http:\/\/77interactive.com\/wp-content\/uploads\/2025\/06\/buildings2.png\",\"contentUrl\":\"http:\/\/77interactive.com\/wp-content\/uploads\/2025\/06\/buildings2.png\",\"width\":1024,\"height\":1024},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/77interactive.com\/?p=458#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/77interactive.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Attach Drive in OCI\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/77interactive.com\/#website\",\"url\":\"http:\/\/77interactive.com\/\",\"name\":\"77 Interactive\",\"description\":\"Rudy&#039;s Code snippets\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/77interactive.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"http:\/\/77interactive.com\/#\/schema\/person\/0e61d2a984b8304618026b207e6121e9\",\"name\":\"Rudy\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/77interactive.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e336b9aecd39b40691ff8ccfcd68506415072dbe8caffc0485b94a1bc22b774d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e336b9aecd39b40691ff8ccfcd68506415072dbe8caffc0485b94a1bc22b774d?s=96&d=mm&r=g\",\"caption\":\"Rudy\"},\"url\":\"http:\/\/77interactive.com\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Attach Drive in OCI - 77 Interactive","description":"Learn how to mount and partition a disk in Oracle Cloud Infrastructure. Get the exact commands to mount a disk in linux.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/77interactive.com\/?p=458","og_locale":"en_US","og_type":"article","og_title":"Attach Drive in OCI - 77 Interactive","og_description":"Learn how to mount and partition a disk in Oracle Cloud Infrastructure. Get the exact commands to mount a disk in linux.","og_url":"http:\/\/77interactive.com\/?p=458","og_site_name":"77 Interactive","article_published_time":"2025-07-14T17:28:37+00:00","article_modified_time":"2025-08-10T22:15:35+00:00","og_image":[{"width":1024,"height":1024,"url":"http:\/\/77interactive.com\/wp-content\/uploads\/2025\/06\/buildings2.png","type":"image\/png"}],"author":"Rudy","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Rudy","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/77interactive.com\/?p=458#article","isPartOf":{"@id":"http:\/\/77interactive.com\/?p=458"},"author":{"name":"Rudy","@id":"http:\/\/77interactive.com\/#\/schema\/person\/0e61d2a984b8304618026b207e6121e9"},"headline":"Attach Drive in OCI","datePublished":"2025-07-14T17:28:37+00:00","dateModified":"2025-08-10T22:15:35+00:00","mainEntityOfPage":{"@id":"http:\/\/77interactive.com\/?p=458"},"wordCount":4,"image":{"@id":"http:\/\/77interactive.com\/?p=458#primaryimage"},"thumbnailUrl":"http:\/\/77interactive.com\/wp-content\/uploads\/2025\/06\/buildings2.png","keywords":["Linux"],"articleSection":["linux"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"http:\/\/77interactive.com\/?p=458","url":"http:\/\/77interactive.com\/?p=458","name":"Attach Drive in OCI - 77 Interactive","isPartOf":{"@id":"http:\/\/77interactive.com\/#website"},"primaryImageOfPage":{"@id":"http:\/\/77interactive.com\/?p=458#primaryimage"},"image":{"@id":"http:\/\/77interactive.com\/?p=458#primaryimage"},"thumbnailUrl":"http:\/\/77interactive.com\/wp-content\/uploads\/2025\/06\/buildings2.png","datePublished":"2025-07-14T17:28:37+00:00","dateModified":"2025-08-10T22:15:35+00:00","author":{"@id":"http:\/\/77interactive.com\/#\/schema\/person\/0e61d2a984b8304618026b207e6121e9"},"description":"Learn how to mount and partition a disk in Oracle Cloud Infrastructure. Get the exact commands to mount a disk in linux.","breadcrumb":{"@id":"http:\/\/77interactive.com\/?p=458#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/77interactive.com\/?p=458"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/77interactive.com\/?p=458#primaryimage","url":"http:\/\/77interactive.com\/wp-content\/uploads\/2025\/06\/buildings2.png","contentUrl":"http:\/\/77interactive.com\/wp-content\/uploads\/2025\/06\/buildings2.png","width":1024,"height":1024},{"@type":"BreadcrumbList","@id":"http:\/\/77interactive.com\/?p=458#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/77interactive.com\/"},{"@type":"ListItem","position":2,"name":"Attach Drive in OCI"}]},{"@type":"WebSite","@id":"http:\/\/77interactive.com\/#website","url":"http:\/\/77interactive.com\/","name":"77 Interactive","description":"Rudy&#039;s Code snippets","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/77interactive.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"http:\/\/77interactive.com\/#\/schema\/person\/0e61d2a984b8304618026b207e6121e9","name":"Rudy","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/77interactive.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e336b9aecd39b40691ff8ccfcd68506415072dbe8caffc0485b94a1bc22b774d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e336b9aecd39b40691ff8ccfcd68506415072dbe8caffc0485b94a1bc22b774d?s=96&d=mm&r=g","caption":"Rudy"},"url":"http:\/\/77interactive.com\/?author=1"}]}},"_links":{"self":[{"href":"http:\/\/77interactive.com\/index.php?rest_route=\/wp\/v2\/posts\/458","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/77interactive.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/77interactive.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/77interactive.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/77interactive.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=458"}],"version-history":[{"count":0,"href":"http:\/\/77interactive.com\/index.php?rest_route=\/wp\/v2\/posts\/458\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/77interactive.com\/index.php?rest_route=\/wp\/v2\/media\/452"}],"wp:attachment":[{"href":"http:\/\/77interactive.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=458"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/77interactive.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=458"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/77interactive.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=458"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}