{"id":2552,"date":"2017-09-05T22:29:09","date_gmt":"2017-09-05T22:29:09","guid":{"rendered":"http:\/\/blog.paranoidprofessor.com\/?p=2552"},"modified":"2017-09-05T22:29:09","modified_gmt":"2017-09-05T22:29:09","slug":"virtualbox-disk-too-small","status":"publish","type":"post","link":"https:\/\/blog.paranoidprofessor.com\/index.php\/2017\/09\/05\/virtualbox-disk-too-small\/","title":{"rendered":"virtualbox disk too small ?"},"content":{"rendered":"<p>The first few times I used VirtualBox it wasn&#8217;t clear why you would ever want to create a virtual disk that is dynamic. \u00a0I could only envision having three machines each with a disk that wasn&#8217;t fully expanded only to run out of real storage when I really needed it.<\/p>\n<p>However, just like real machines it is possible to full up the hard disk and want just a tiny bit more space. \u00a0Of course you can add a second virtual disk to your machine but there is another option. \u00a0It is actually possible to add to a small extra bit of space to your virtual hard disk, but only under once situation. \u00a0It is not possible to expand a fixed size disk beyond its initial size but it is possible to extend a dynamic disk to a larger size.<\/p>\n<p>The steps to extend a virtual harddisk is actually pretty simple.<\/p>\n<ol>\n<li>extend the virtual disk image (vdi)<\/li>\n<li>mount gparted inside the virtual machine<\/li>\n<li>select and extend the partition<\/li>\n<\/ol>\n<h2>Original state<\/h2>\n<p>The disk drive associated with my virtual machine was only 10GB. \u00a0This is actually more than enough for small tests.<\/p>\n<h2><a href=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk1.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2571\" src=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk1.png\" alt=\"\" width=\"1037\" height=\"521\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk1.png 1037w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk1-300x151.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk1-768x386.png 768w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk1-1024x514.png 1024w\" sizes=\"(max-width: 1037px) 100vw, 1037px\" \/><\/a><\/h2>\n<h2>Extend the virtual disk image<\/h2>\n<p>This first step needs to be performed on a disk image that is not currently being used by virtualbox. \u00a0This step is done by running the command line program vboxmanage. \u00a0Simply give the total size of the disk image and the disk is extended.<\/p>\n<p><a href=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk3.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2572\" src=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk3.png\" alt=\"\" width=\"983\" height=\"445\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk3.png 983w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk3-300x136.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk3-768x348.png 768w\" sizes=\"(max-width: 983px) 100vw, 983px\" \/><\/a><\/p>\n<p>The command both gives feedback while running and runs really fast.<\/p>\n<pre>vboxmanage modifyhd &lt;qualified path to disk&gt; --resize &lt;# of megabytes&gt;<\/pre>\n<p>Virtualbox can display the disk size as soon as the command has finished running.<\/p>\n<p><a href=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk4.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2573\" src=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk4.png\" alt=\"\" width=\"1067\" height=\"521\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk4.png 1067w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk4-300x146.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk4-768x375.png 768w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk4-1024x500.png 1024w\" sizes=\"(max-width: 1067px) 100vw, 1067px\" \/><\/a><\/p>\n<h2>Mount Gparted inside the VM<\/h2>\n<p>Simply resizing the virtual disk image is not actually enough. \u00a0This will make the disk itself larger but it will not make any more space available to the client operating system inside of the virtual machine. \u00a0This space can be allocated to the partition by using some tool to extend the partition.<\/p>\n<p><a href=\"https:\/\/gparted.org\/\" target=\"_blank\">Gparted<\/a> is one of the easiest tools to use to enlarge the partition. \u00a0However, just like many other Linux tools it needs to be run on a volume that is not currently mounted. In order to do that simply download the gparted live disk and mount it to the virtual machine.<\/p>\n<p>The Gparted live disk will boot up just like on any physical machine, it will bring up a grub menu and let you start the Gparted live installation.<\/p>\n<p><a href=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk5.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2574\" src=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk5.png\" alt=\"\" width=\"799\" height=\"544\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk5.png 799w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk5-300x204.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk5-768x523.png 768w\" sizes=\"(max-width: 799px) 100vw, 799px\" \/><\/a><\/p>\n<h2>Actual extension of file system<\/h2>\n<p>The actual extensino of the file system in this particular case is trivial. \u00a0Simply select \/dev\/sda5 and resize this to use the extra two gigabytes that have been added.<\/p>\n<p><a href=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk6.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2575\" src=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk6.png\" alt=\"\" width=\"563\" height=\"290\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk6.png 563w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk6-300x155.png 300w\" sizes=\"(max-width: 563px) 100vw, 563px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk7.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2576\" src=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk7.png\" alt=\"\" width=\"563\" height=\"290\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk7.png 563w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk7-300x155.png 300w\" sizes=\"(max-width: 563px) 100vw, 563px\" \/><\/a><\/p>\n<p>This particular case was trivial by design. \u00a0I didn&#8217;t want to move the swap partition system to the end of the disk and move the free space to the end of the partition.<\/p>\n<p><a href=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk8.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2578\" src=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk8.png\" alt=\"\" width=\"781\" height=\"527\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk8.png 781w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk8-300x202.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk8-768x518.png 768w\" sizes=\"(max-width: 781px) 100vw, 781px\" \/><\/a><\/p>\n<p>You can see that the space has been allocated to the partition \/dev\/sda2 but not yet being used by the file system. \u00a0The next step is to expand the actual filesystem on \/dev\/sda5<\/p>\n<p><a href=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk9.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2580\" src=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk9.png\" alt=\"\" width=\"565\" height=\"289\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk9.png 565w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk9-300x153.png 300w\" sizes=\"(max-width: 565px) 100vw, 565px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk10.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2581\" src=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk10.png\" alt=\"\" width=\"565\" height=\"289\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk10.png 565w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/09\/vmresize-disk10-300x153.png 300w\" sizes=\"(max-width: 565px) 100vw, 565px\" \/><\/a><\/p>\n<p>It may seem like a lot of effort to simply add a few gigabytes or more space to a virtual disk image but the entire process can be done in a few minutes.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The first few times I used VirtualBox it wasn&#8217;t clear why you would ever want to create a virtual disk that is dynamic. \u00a0I could only envision having three machines each with a disk that wasn&#8217;t fully expanded only to &hellip; <a href=\"https:\/\/blog.paranoidprofessor.com\/index.php\/2017\/09\/05\/virtualbox-disk-too-small\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[20],"tags":[85],"_links":{"self":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/2552"}],"collection":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/comments?post=2552"}],"version-history":[{"count":8,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/2552\/revisions"}],"predecessor-version":[{"id":2582,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/2552\/revisions\/2582"}],"wp:attachment":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/media?parent=2552"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/categories?post=2552"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/tags?post=2552"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}