How can Centos7 expand disk space in virtual machines?

Source: Internet
Author: User

How can Centos7 expand disk space in virtual machines?
Description

Situation:You have created a disk in the VirtualBox Virtual Machine and installed the system. It is found that the disk space is too small and you need to add another disk size. Or the Centos7 system needs to expand disk space.

Procedure

1. Create a new disk in VirtualBox and select "add virtual hard disk"

2. Start the system that needs to expand the disk space and enter the terminal as root.
2.1 fdisk-l view disk Information

Explanation: the disk information of the system is marked in red. I added a/dev/sdb disk to the system, and the red box shows the partitions of the corresponding disk. (A disk can be divided into multiple zones)

3. Enter the Newly Added Disk for partitioning
Fdisk/dev/sdb

3.1 InputNAdd a new partition)
Step X in the Figure 3.2 indicates the setting of the new partition on the disk, step 2 indicates the category of the created partition, step 3 and step 4 set the start position of the partition, step 5 Save the partition settings and exit

(You can use fdisk-l to view the sdb1 partition in the/dev/sdb disk)

4. Format Disk Partitions
Mkfs. ext4/dev/sdb1
(Partition format is in ext4 format or another format)

5. Mount the partition of the new disk to the file directory.
Mkdir/data create a mount point
Mount-t ext4/dev/sdb1/work mount with mount

6. Set automatic mounting upon startup
Vi/etc/fstab
Add/dev/sdb1/data ext4 defaults 0 0 in the last row

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.