{"id":36,"date":"2011-08-24T09:07:22","date_gmt":"2011-08-24T09:07:22","guid":{"rendered":"http:\/\/francisfisher.me.uk\/problem\/?p=36"},"modified":"2012-07-19T18:55:04","modified_gmt":"2012-07-19T18:55:04","slug":"increasing-the-size-of-the-main-linux-partition-ubuntu-11-04","status":"publish","type":"post","link":"https:\/\/francisfisher.me.uk\/problem\/2011\/increasing-the-size-of-the-main-linux-partition-ubuntu-11-04\/","title":{"rendered":"Increasing the size of the main linux partition (Ubuntu 11.04)"},"content":{"rendered":"<p>I have an installation of Ubuntu 11.04 running as a virtual machine under VirtualBox. It recently ran out of space, so I needed to expand the partition.<\/p>\n<p>First I made a new partition that was larger than my existing partition (i.e. I created a new disc image in VirtualBox).<\/p>\n<p>I then added the Ubuntu 11.04 DVD image to my VM as a new DVD device. I also needed to remove the VBoxGuestAdditions.iso, as it turns out that the VirtualBox bios only lets you boot off the first CD\/DVD it finds.<\/p>\n<p>That done, I fired up my VM and pressed F12 to get into the boot device menu, then chose to boot from CD. When this booted up I chose the option to run the live cd rather than install Ubuntu.<\/p>\n<p>Once I hit the gnome2 desktop, I fired up a terminal and ran<\/p>\n<pre>$ sudo gparted<\/pre>\n<p>gparted showed two discs - sda and sdb. sda1 was my linux partition, and there was an extended partition containing a swap partition on sda5. sdb was empty as expected. I performed the following actions:<\/p>\n<ul>\n<li>select and copy the sda1 partition.<\/li>\n<li>switch to sdb and create a partition table.<\/li>\n<li>paste the sda1 partition into sdb, and change its size so it fills the entire disc minus 500MB or whatever you want for the swap partition.<\/li>\n<li>create an extended partition on sdb<\/li>\n<li>create a new swap partition inside the extended partition.<\/li>\n<li>I set the partition flag bootable on sdb1 although I don't think this was necessary.<\/li>\n<\/ul>\n<p>Having done this I now needed to install grub. To get grub to work, I had to chroot into the new partition before installing it.<\/p>\n<pre>$ sudo mkdir \/mnt\/sdb1\r\n$ sudo mount \/dev\/sdb1 \/mnt\/sdb1 -t ext2\r\n$ sudo mount --bind \/dev \/mnt\/sdb1\/dev\r\n$ sudo mount --bind \/proc \/mnt\/sdb1\/proc\r\n$ sudo mount --bind \/sys \/mnt\/sdb1\/sys\r\n$ sudo chroot \/mnt\/sdb1\r\n$ sudo grub-install\r\n$ sudo update-grub<\/pre>\n<p>At this stage I shutdown, and removed the old linux partition from my VM. When I started up again, it succesfully booted into my VM, from where I am writing this article!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have an installation of Ubuntu 11.04 running as a virtual machine under VirtualBox. It recently ran out of space, so I needed to expand the partition. First I made a new partition that was larger than my existing partition (i.e. I created a new disc image in VirtualBox). I then added the Ubuntu 11.04 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false},"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/francisfisher.me.uk\/problem\/wp-json\/wp\/v2\/posts\/36"}],"collection":[{"href":"https:\/\/francisfisher.me.uk\/problem\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/francisfisher.me.uk\/problem\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/francisfisher.me.uk\/problem\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/francisfisher.me.uk\/problem\/wp-json\/wp\/v2\/comments?post=36"}],"version-history":[{"count":5,"href":"https:\/\/francisfisher.me.uk\/problem\/wp-json\/wp\/v2\/posts\/36\/revisions"}],"predecessor-version":[{"id":166,"href":"https:\/\/francisfisher.me.uk\/problem\/wp-json\/wp\/v2\/posts\/36\/revisions\/166"}],"wp:attachment":[{"href":"https:\/\/francisfisher.me.uk\/problem\/wp-json\/wp\/v2\/media?parent=36"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/francisfisher.me.uk\/problem\/wp-json\/wp\/v2\/categories?post=36"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/francisfisher.me.uk\/problem\/wp-json\/wp\/v2\/tags?post=36"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}