LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-25-2009, 08:00 AM   #1
Syllan
LQ Newbie
 
Registered: Aug 2009
Posts: 1

Rep: Reputation: 0
Unhappy Ubuntu guest increase hard drive using VirtualBox?


I have Vista, running Ubuntu through Sun VirtualBox and now I've run out of hard drive space. Is there anyway I can increase the Ubuntu hard drive without having to reinstall everything thing again? E.g. can I maka a new hard drive and then paste the old one in it?

Since Im new on Linux I really don't want to start installing everything again and just all the download would take me a day to make.
 
Old 08-25-2009, 09:02 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Yes -- it can be done. It's relatively serious ubuntu systems administration so make sure you have a backup of anything you value and go carefully. You're going to research some techniques, learn a lot, sweat and cuss a bit and -- have fun!

In Windows, in VirtualBox, configure a new, bigger .vdi file for the ubuntu vdm.

Boot ubuntu and log on.

Open a terminal to get a command prompt.

From here on I'm assuming you're root. If you're not (that's the ubuntu way) then prefix all the command with sudo.

If you only have one disk already it's probably /dev/sda in which case the new disk will be /dev/sdb.

Assuming that's right, run cfdisk /dev/sda and note what partitions you already have. You will want to create similar (but some bigger!) on /dev/sdb.

Run cfdisk /dev/sdb. This should not show any partitions! Create the partition(s) you need. Type 83 Linux is a good choice and you'll want some swap.

Create file system(s) on you new partitions by mkfs.ext3 /dev/sdb<n> where <n> is 1, 2, 3 as required. Don't create a file system on the swap partition.

Now mount each partition in turn that has files you want to copy (all but swap) using mount /dev/sdb<n> /mnt and copy all the files from each old file system to the new. I never know the best way to do that so hopefully someone else will chip in. Maybe something like
Code:
cd <source directory>
tar c . | (cd /mnt; tar xp)
or
Code:
cp -dpR <source directory>var* <source directory>var.* /mnt
Shut down ubuntu.

Edit: after copying each file system, unmount it before going on to the next, using umount /mnt.

In Windows, in VirtualBox, de-configure the old .vdi file for the ubuntu vdm.

Boot ubuntu and, with a bit of luck and a fair wind, it's all set up as you want.

Last edited by catkin; 08-25-2009 at 09:04 AM.
 
Old 08-25-2009, 09:29 AM   #3
j1alu
Member
 
Registered: Apr 2009
Distribution: debian gnu/linux
Posts: 798

Rep: Reputation: Disabled
if you`re more comfortable with the gui,i once followed this guide:
http://www.my-guides.net/en/content/view/122/1/
(after that i had to change some settings in vbox,settings, harddisk, but can`t remember exactly what. I think i created a new hard-disk and pointed it to the new image...)
went fine, but took me a while
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Guest additions for Ubuntu 9.04 in VirtualBox 2.1.4 OSE bruno.braga LinuxQuestions.org Member Intro 0 07-28-2009 09:36 PM
problem installing guest additions in Fedora 11 guest (virtualbox) mia_tech Linux - Desktop 9 07-28-2009 12:15 AM
Virtualbox Gentoo Guest - Can't get guest additions working MALDATA Gentoo 3 06-18-2009 11:43 PM
Unable to connect Virtualbox XP Guest to MySQL on Ubuntu Host pabs111 Linux - Newbie 3 06-05-2009 02:28 PM
Ubuntu Host Virtualbox guest Networking weirdness ddales Linux - Networking 0 01-20-2008 02:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration