{"id":220,"date":"2021-12-01T11:11:42","date_gmt":"2021-12-01T09:11:42","guid":{"rendered":"https:\/\/amsd.go.ro\/wordpress\/?p=220"},"modified":"2023-01-28T22:14:45","modified_gmt":"2023-01-28T20:14:45","slug":"how-to-enlarge-virtual-disk-in-virtualbox","status":"publish","type":"post","link":"https:\/\/amsd.go.ro\/wordpress\/?p=220","title":{"rendered":"How To Expand virtual Disk in VirtualBox"},"content":{"rendered":"\n<p>When you create a virtual hard disk in VirtualBox, you specify a maximum disk size. If you want more space on your virtual machine\u2019s hard disk later, you\u2019ll have to enlarge the virtual hard disk and partition.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Expand VirtualBox Drive<\/h2>\n\n\n\n<p>The first thing you need to do is expand your virtual drive using the <strong>VBoxmanage<\/strong> command line tool provided by VirtualBox or the GUI.<\/p>\n\n\n\n<p><strong>Using the GUI:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Shutdown the virtual machine that is using the disk.<\/li><li>Open the VM VirtualBox Manager (the main window that opens when you launch the GUI)<\/li><li>Click File<\/li><li>Select Virtual Media Manager from the menu.<\/li><li>Select the Hard disks tab.<\/li><li>Choose the disk you wish to resize from the list.<\/li><li>Click the Properties button.<\/li><li>In the Attributes tab, use the slider or text box to specify the new size.<\/li><li>Click Apply.<\/li><\/ol>\n\n\n\n<p><strong>Using the command line:<\/strong><\/p>\n\n\n\n<p>First, shutdown the virtual machine hat is using the disk.<\/p>\n\n\n\n<p>Replace MB in the examples with how big, in megabytes, you wish to resize the disk to.<\/p>\n\n\n\n<p>Linux\/Unix:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ vboxmanage modifymedium disk <mark>\/virtual\/disk\/file<\/mark> --resize <mark>MB<\/mark><\/code><\/pre>\n\n\n\n<p>Windows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>C:\\&gt; cd C:\\Program Files\\Oracle\\VirtualBox\nC:\\Program Files\\Oracle\\VirtualBox&gt;VBoxManage modifymedium disk <mark>C:\\path\\to\\file<\/mark> --resize <mark>MB<\/mark><\/code><\/pre>\n\n\n\n<p>If you are running an older version and one of the commands doesn\u2019t work, try this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vboxmanage modifyhd <mark>\/path\/to\/disk<\/mark> --resize <mark>MB<\/mark><\/code><\/pre>\n\n\n\n<p>Real Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ vboxmanage modifymedium disk \\\n  \"\/home\/tyler\/VirtualBox VMs\/CentOS 7 ext4 Clone\/CentOS 7 ext4 Clone.vdi\" \\\n  --resize 30000\n0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Resize Partition with GParted<\/h2>\n\n\n\n<p>Download the <a href=\"http:\/\/gparted.org\/download.php\">gparted<\/a> live cd.<\/p>\n\n\n\n<p>Attach the gparted live cd as a drive to your virtual machine and make it the \u201cPrimary Master\u201d.<\/p>\n\n\n\n<p><strong>Note<\/strong>: Ensure the checkbox \u201cLive CD\u201d is selected when you add the CD drive.<\/p>\n\n\n\n<p>Now start your VM.<\/p>\n\n\n\n<p>The gparted UI will load. Now resize the parition by expanding it to use the available free space on the virtual disk.<\/p>\n\n\n\n<p>Shutdown your VM, remove the gparted live cd drive and set your virtual disk to once again be the \u201cPrimary Master\u201d drive.<\/p>\n\n\n\n<p>However, after you restart your VM you will notice that CentOS is still not aware of the additional space:<\/p>\n\n\n\n<p><code>df<\/code> <code>-h<\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Expand CentOS Partition<\/h2>\n\n\n\n<p>Now you will need to expand your Linux partition to use the free space on the drive.<\/p>\n\n\n\n<p>First check the sizes of the current partitions and get the name:<\/p>\n\n\n\n<p><code>vgdisplay -v<\/code><\/p>\n\n\n\n<p>On my system the name of the partition to expand was \u201c\/dev\/centos\/root\u201d.<\/p>\n\n\n\n<p>Extend the volume with the available free space:<\/p>\n\n\n\n<p><code>lvextend -l +100%FREE \/dev\/centos\/root<\/code><\/p>\n\n\n\n<p>Now you are ready to perform the online resize:<\/p>\n\n\n\n<p><code>xfs_growfs \/dev\/centos\/root<\/code><\/p>\n\n\n\n<p><strong>NOTE<\/strong>: resize2fs works on other distributions of Linux but not on CentoOS, so you must use xfs_growfs.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you create a virtual hard disk in VirtualBox, you specify a maximum disk size. If you want more space on your virtual machine\u2019s hard disk later, you\u2019ll have to enlarge the virtual hard disk and partition. Expand VirtualBox Drive [&hellip;]<\/p>\n<div class=\"link-more\"><a href=\"https:\/\/amsd.go.ro\/wordpress\/?p=220#more-220\" class=\"more-link\">Continue reading &#10142; <span class=\"screen-reader-text\">How To Expand virtual Disk in VirtualBox<\/span><\/a><\/div>","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[11,28],"class_list":["post-220","post","type-post","status-publish","format-standard","hentry","category-technology","tag-ps_57","tag-virtualization"],"_links":{"self":[{"href":"https:\/\/amsd.go.ro\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/220","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/amsd.go.ro\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/amsd.go.ro\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/amsd.go.ro\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/amsd.go.ro\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=220"}],"version-history":[{"count":5,"href":"https:\/\/amsd.go.ro\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/220\/revisions"}],"predecessor-version":[{"id":265,"href":"https:\/\/amsd.go.ro\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/220\/revisions\/265"}],"wp:attachment":[{"href":"https:\/\/amsd.go.ro\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/amsd.go.ro\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=220"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/amsd.go.ro\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}