{"id":41408,"date":"2023-11-23T02:58:08","date_gmt":"2023-11-23T02:58:08","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=41408"},"modified":"2023-11-23T04:03:11","modified_gmt":"2023-11-23T04:03:11","slug":"azure-how-to-add-extra-storage-disk-to-azure-vm","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/azure-how-to-add-extra-storage-disk-to-azure-vm\/","title":{"rendered":"Azure: How to add extra storage Disk to Azure VM?"},"content":{"rendered":"\n<p><strong>Prerequisites:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>An Azure account with the necessary permissions to manage resources.<\/li>\n\n\n\n<li>An existing Azure Virtual Machine.<\/li>\n<\/ul>\n\n\n\n<p><strong>Step 1: Sign in to the Azure portal<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to the <a href=\"https:\/\/portal.azure.com\/\" target=\"_blank\" rel=\"noopener\">Azure portal<\/a>.<\/li>\n\n\n\n<li>Sign in with your Azure account credentials.<\/li>\n<\/ol>\n\n\n\n<p><strong>Step 2: Locate your Virtual Machine<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>In the Azure portal, click on &#8220;Virtual machines&#8221; in the left-hand menu.<\/li>\n\n\n\n<li>Select the Virtual Machine to which you want to add an extra disk.<\/li>\n<\/ol>\n\n\n\n<p><strong>Step 3: Add a Data Disk<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>In the VM&#8217;s Overview page, click on the &#8220;Disks&#8221; tab.<\/li>\n\n\n\n<li>On the Disks tab, click the &#8220;+ Add data disk&#8221; button.<\/li>\n\n\n\n<li>This will open a panel where you can configure the new data disk. Configure the settings as needed:\n<ul class=\"wp-block-list\">\n<li>Name: Enter a name for your new data disk.<\/li>\n\n\n\n<li>Size (GiB): Specify the size of the disk in gigabytes.<\/li>\n\n\n\n<li>Cache type: Choose the cache type based on your requirements (None, ReadOnly, ReadWrite).<\/li>\n\n\n\n<li>Source type: Leave it as &#8220;None&#8221; for a new empty disk.<\/li>\n\n\n\n<li>Lun: Specify the Logical Unit Number (LUN). The default value is usually fine unless you have specific requirements.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Click &#8220;OK&#8221; to create the data disk.<\/li>\n<\/ol>\n\n\n\n<p><strong>Step 4: Attach the Data Disk to your VM<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>After creating the data disk, go back to your VM&#8217;s Overview page.<\/li>\n\n\n\n<li>Click on &#8220;Stop&#8221; to deallocate the VM (if it&#8217;s running) because you can&#8217;t attach disks to a running VM. Wait for the VM to stop.<\/li>\n\n\n\n<li>Once the VM is stopped, click on &#8220;Disks&#8221; in the left-hand menu under &#8220;Settings.&#8221;<\/li>\n\n\n\n<li>In the Disks section, you should see the newly created data disk listed. Select it.<\/li>\n\n\n\n<li>Click on the &#8220;Attach&#8221; button at the top of the page.<\/li>\n\n\n\n<li>In the Attach Data Disk panel, choose the LUN (Logical Unit Number). The default value is usually fine.<\/li>\n\n\n\n<li>Click &#8220;OK&#8221; to attach the data disk to your VM.<\/li>\n<\/ol>\n\n\n\n<p><strong>Step 5: Start your VM<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go back to your VM&#8217;s Overview page.<\/li>\n\n\n\n<li>Click on the &#8220;Start&#8221; button to start your VM with the newly attached data disk.<\/li>\n<\/ol>\n\n\n\n<p><strong>Step 6: Initialize and Format the Data Disk (inside the VM)<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Remote into your VM using SSH (for Linux) or RDP (for Windows).<\/li>\n\n\n\n<li>Open the disk management tool specific to your operating system.\n<ul class=\"wp-block-list\">\n<li>For Windows, open Disk Management, and you should see the new disk. Initialize and format it as needed.<\/li>\n\n\n\n<li>For Linux, use commands like <code>fdisk<\/code>, <code>mkfs<\/code>, and <code>mount<\/code> to initialize and format the new disk.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p>Once you&#8217;ve completed these steps, your Azure Virtual Machine should have an extra data disk attached and ready for use.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Commands<\/h2>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">$ lsblk\r\n$ sudo mkfs -t ext4 \/dev\/sdc\r\n$ mkdir \/opt\/4gb\/\r\n$ sudo mount \/dev\/sdc \/opt\/4gb\/\r\n$ df -kh\r\n$ cd \/opt\/4gb\/<\/code><\/span><\/pre>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n","protected":false},"excerpt":{"rendered":"<p>Prerequisites: Step 1: Sign in to the Azure portal Step 2: Locate your Virtual Machine Step 3: Add a Data Disk Step 4: Attach the Data Disk to your VM Step 5: Start your VM Step 6: Initialize and Format the Data Disk (inside the VM) Once you&#8217;ve completed these steps, your Azure Virtual Machine&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_joinchat":[],"footnotes":""},"categories":[2],"tags":[],"class_list":["post-41408","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/41408","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=41408"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/41408\/revisions"}],"predecessor-version":[{"id":41414,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/41408\/revisions\/41414"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=41408"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=41408"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=41408"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}