sometimes you just need to expand the storage on your virtual disk in virtualbox. however, if you have an older disk like .vmdk file, you cannot expand the size of the disk. you're only option is to add a second disk.

1. first step is to add a virtual disk. just go under storage for the virtual machine you want to add the virtual disk.

2. start the virtual machine. once the kernel has loaded, you can run these command to use the second drive:

fdisk -l


you will see the new drive, it will say:

Disk /dev/hdb: 21.4 GB, 21474836480 bytes
16 heads, 63 sectors/track, 41610 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes


Disk /dev/hdb doesn't contain a valid partition table


you will notice that my new hard drive here is 20G and i have not partitioned the drive. so now we need to partition it

fdisk /dev/hdb


these are the option i ran (in bold)
[root@virtual ~]# fdisk /dev/hdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.


The number of cylinders for this disk is set to 41610.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-41610, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-41610, default 41610):
Using default value 41610

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
now that we have made a partition on hard drive (hdb), we need to format it with a filesystem, we are going to use ext4
mkfs -t ext4 /dev/hdb


when i ran this command i go this error: mkfs.ext4: No such file or directory

so now what.. hmm, will, it seems i can't create a ext4 filesystem on my linux box. so lets see what we can use so run this command to list the filesystems available on this computer

ls /sbin/mkfs*


OUTPUT:
/sbin/mkfs         /sbin/mkfs.ext2  /sbin/mkfs.msdos
/sbin/mkfs.cramfs  /sbin/mkfs.ext3  /sbin/mkfs.vfat
so lets use ext3 then
mkfs -t ext3 /dev/hdb
[root@virtual sbin]# mkfs -t ext3 /dev/hdb
mke2fs 1.39 (29-May-2006)
/dev/hdb is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2621440 inodes, 5242880 blocks
262144 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
160 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.


now u can start using the new hard drive: but first we need to mount it to a new directory so lets create a new directory:

mkdir /mnt/20g


now lets mount the hdb drive to our new directory:

mount /dev/hdb /mnt/20g


done, now you can start writing on your new hard drive:

cd /mnt/20g

to mount the new hard drive automatically at boot time, you can just put this in the fstab file so i use this commands

lets make a backup of fstab first:
cp /etc/fstab /etc/fstab.bak
now lets edit fstab:(note, you can use vi if you like, but i am using nano, its easier)
nano /etc/fstab
this is how fstab will will like
/dev/VolGroup00/LogVol00 /                       ext3    defaults,usrquota,grpquota        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0
now all you need to do is add this line at the end:
/dev/hdb                /mnt/20g               ext3    defaults  0 0
save the changes and reboot. DONE now you can create a symbolic like if you want:
ln -s /mnt/20g /var/www/clients/client1/web1/web/20g