Add a new hard disk to Ubuntu in virtualbox

Source: Internet
Author: User

Vitrualbox does not allow you to change the disk size. Therefore, when the hard disk is insufficient, you can only add a new hard disk.

The procedure is as follows:

1. Disable Ubuntu, enable vistualbox, and choose "Settings"> "Storage"> "add virtual hard disk"

2. Start Ubuntu with the following command:
#1 sudo fdisk-l // view the existing system disk space
----------------------------------------------------------------------------
Disk/dev/SDA: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 Cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Disk identifier: 0x000af383

Device boot start end blocks ID system
/Dev/sda1*1 1244 9992398 + 83 Linux
/Dev/sda2 1245 1305 489982 + 5 extended
/Dev/sda5 1245 1305 489951 82 Linux swap/Solaris

Disk/dev/SDB: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 Cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Disk identifier: 0x00000000

Disk/dev/SDB doesn' t contain a valid Partition Table
----------------------------------------------------------------------------

The above information shows the Newly Added Disk Space/dev/sdb. here we need to partition the new disk space.
#2 fdisk/dev/SDB
#3 command (M for help): m // enter m to view help information.
The output is as follows:
----------------------------------------------------------------------------
Command action
A toggle a bootable flag
B edit BSD disklabel
C toggle the DOS compatibility flag
D delete a partition
L List known partition types
M print this menu
N Add a new partition
O create a new empty DOS partition table
P print the Partition Table
Q quit without saving changes
S create a new empty sun disklabel
T change a partition's System ID
U change display/entry units
V verify the Partition Table
W write table to disk and exit
X extra functionality (experts only)
----------------------------------------------------------------------------
#4 command (M for help): n
The output is as follows:
----------------------------------------------------------------------------
Command action
E extended
P primary partition (1-4)
----------------------------------------------------------------------------

Type: P and select add primary partition;
Type: 1 and select the primary Partition Number as 1. In this way, the primary partition created is sdb1;

#5 first cylinder (1-1014, default 1): 1 // Number of disks starting from the first primary Partition
#6 last cylindet or + Siza or + sizem or + sizek: + 1024 MB // It Can Be A number in MB or the number of disk blocks, here, we enter + MB to indicate that the partition size is 1 GB.

In this way, we have created a partition. If you want to create more partitions, you can continue to create the partition according to the above steps.
Finally, type w to save all and exit to complete the partition of the new disk.

4. Format Disk Partitions
#7 sudo mkfs-T ext3/dev/sdb1 // format/dev/sdb1 in ext3 format

5. Mount partitions
#8 sudo mkdir/Data // create a mount point
#9 sudo Mount/dev/sdb1/Data // mount the new disk partition to the/Data Directory
#10 sudo DF // view the mounting result

6. automatic mounting upon startup
#11 VI/etc/fstab // modify the/etc/fstab file
Add the following content to the/etc/fatab file:
/Dev/sdb1/Data ext3 defaults 1 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.