Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using ubuntu on a virtual machine of disk size of 8 GBs and I was trying to compile kernel to build a module following these steps .

sudo apt-get install build-essential linux-source
cd /usr/src
sudo tar xjvf linux-source-2.6.22.tar.bz2
cd linux-source-2.6.22
sudo cp /boot/config-2.6.22-14-generic .config
sudo make
sudo make modules

but it crashed due to lack of space so I added another virtual hard disk of 8 GBs and I don't know what to do next . I need to do the same exact steps and I am not sure if compiling should be in /usr/src but if so I want to merge the extra space from the extra hard disk into this location . Is that possible ?
In other words , I need to connect the two hard disks .

share|improve this question
up vote 1 down vote accepted

Format the new drive to ext4 with gparted or any tool you wish.

Then mount the partition at /mnt (or any location you choose)

sudo mount /dev/sbb1 /mnt
sudo chown your_user:your_user /mnt

Then put the kernel source in /mnt

mkdir /mnt/src
tar xjvf linux-source-2.6.22.tar.bz2 -C /mnt/src

Then proceed with your build.

Note: you should run make as follows, it will make the modules.

make -j5

You then use sudo to install

sudo make modules_install

FWIW there are a number of helper scripts, see

Ubuntu Wiki compile kernel

Obviously there are a number of considerations in building a custom kernel, good luck to you.

EDIT: To merge 2 hard drives, use LVM. You will not be able to do LVM as your original install is not to LVM, so mounting the new drive is the best option.

share|improve this answer
Thank you , I will try that . but what does -j5 do ? – Ahmed Dec 18 '11 at 20:43
-j5 is a flag for make, it builds concurrently (jobs), makes the build faster. The number should be your number of CPU +1 , a higher number will not hurt. see – bodhi.zazen Dec 18 '11 at 20:46
Nice , previous compilation took ~4 hrs . – Ahmed Dec 18 '11 at 21:10
-j5 is a nice little trick =) – bodhi.zazen Dec 18 '11 at 21:16

Instead of adding a second virtual drive, just expand the size of the original one. To use the added space, you will need to boot the live cd and use gparted to expand the partition. If you have a swap partition you may need to move it over to make room to expand the root partition.

share|improve this answer
I didn't find a way to expand the virtual disk using VBox on Win 7 – Ahmed Dec 19 '11 at 9:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.