Environment:
OS: Ubuntu 14.04 guest VM
VirtualBox: 4.3.6 on Windows 7 host
Add a hard drive in VirtualBox:
OS: Ubuntu 14.04 guest VM
VirtualBox: 4.3.6 on Windows 7 host
Add a hard drive in VirtualBox:
- Go to VirtualBox Manager
- Select the VM where drive needs to be added and click 'Settings' (ctrl+S)
- On settings dialog, click on 'Storage' from left navigation panel. 'Storage Tree' and 'Attributes' will be shown at right side (see Pic-01)
- Under 'Storage Tree', select 'Controller: SATA', 'Add CD/DVD Device' and 'Add Hard Disk' icons will be displayed (see Pic-01)
- Click on 'Add Hard Disk' (see Pic-01)
Pic-01: Settings dialog box - Click on 'Create New Disk' on popup (see Pic-02)
Pic-02 - Select 'VDI - VirtualBox Disk Image' and Click Next
Pic-03: HDD file type - Select hard drive file type and click Next
Pic-04: Storage on Hard drive - Specify file lcoation and size and click Create. It will take few minutes to finish.
Make the hard drive available in Ubuntu:
- Check drives
Command: "sudo fdisk -l"
Output:Disk /dev/sdb: 107.4 GB, 107374182400 bytes255 heads, 63 sectors/track, 13054 cylinders, total 209715200 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000Disk /dev/sdb doesn't contain a valid partition table - Create partition
Command: "sudo fdisk /dev/sdb" - type 'n' to create partition
- Next select partition type p=Primary, e=Extended
- Specify number of partitions
- I had to create two partitions. For me next two options were to specify first sector and last sector where I selected default.
- 'w' to write the changes
- 'q' to quite fdisk
- Update kernel with changes
Command: "sudo partprobe /dev/sdb" - Format hard drive
Command: "sudo mkfs /dev/sdb2 -t ext4" - Create a directory for mount point. Following convention to create under /mnt
Command: "sudo mkdir /mnt/sdb2" - Make the folder writable
Command: "sudo chmod 777 /mnt/sdb2" - Mount drive to folder
Command: "sudo mount /dev/sdb2 /mnt/sdb2 -t ext4"