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/