Add a new virtual hard disk to Ubuntu in VirtualBox

Source: Internet
Author: User

Add a new virtual hard disk to Ubuntu in VirtualBox

After Ubuntu is installed in VirtualBox, the hard disk space is insufficient. The following solutions are available:

1. Add a new hard disk

Set-> Storage-> SATA controller-> right-click and select "add virtual hard disk"

Then, create a suitable hard disk as needed

2. Restart the VM.

View disk space of an existing system

Sudo fdisk-l

You can see the newly added virtual hard Disk, which is generally named Disk/dev/sdb.

3. New Hard Disk Partition

Fdisk/dev/sdb

Type m to view help information.

Command (m for help): m

Add new partition

Command (m for help): n

Select the basic partition and enter: p

Create a partition

Partition number (1-4): 1

Enter

First cylinder (1-15908, default 1): Enter

Write and exit

Command (m for help): w

4. Format Disk Partitions

Format/dev/sdb1 in ext4 format

Sudo mkfs. ext4/dev/sdb1

5. Mount partitions

Create a new mount point

Sudo mkdir/work

Mount the new disk partition to the/work directory

Sudo mount-t ext4/dev/sdb1/home/Hadoop/NewDisk1/

View mounting

Df-h

You can see the newly added Hard Disk:/dev/sdb1

6. automatic mounting upon startup

Modify file

Sudo vim/etc/fstab

Add the following to the last line:

/Dev/sdb1/home/hadoop/NewDisk1/ext4 defaults 0 0

There are a total of six parameters in this line, which are the "device where the file system is located; mount point; file system type; mount parameters. Most systems can use" defaults "to meet their needs; the last two are dump and the first is the boot sequence. If there is no need for dump, it is not necessary to set the system boot disk to 0.

7. After all the hard disks have been set successfully, but the partitions are mounted but cannot be written. You need to change the permissions:

Sudo chmod-R 777/home/hadoop/NewDisk1/

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.