Add a second hard disk for a Linux Virtual Machine

Source: Internet
Author: User

During the development process, we often find that the virtual machine's hard disk is not enough. In this case, we need to expand the hard disk for the virtual machine. You can use the following method.

(1) In VM -- settings -- hard disk -- add, you can choose to create a new hard disk or add an existing hard disk.

(2) After the system is started, you can use fdisk-L/dev/SD * in the terminal to list newly added hard disks, such as SDB. Assume that the SCSI hard disk is used.

(3) fdisk/dev/SDB, enter the fdisk operation interface "command (M for help ):". Type "N" to create a new partition, and "p" to create the primary partition. Then, select the primary Partition Number, select "1", and press ENTER for two consecutive times, set the start range of the cylindrical partition by default, that is, all the storage space is allocated to the previously created partition, and enter "W" to write the partition information.

(4) format and format is relatively simple, and mkfs can be done with one command. ext4/dev/sdb1. Here we format the hard disk as an ext4 file system. Note that there is an additional "1" behind the SDB ", this indicates the primary partition we created in the previous step.

(5) use the sudo blkid/dev/sdb1 command to list the uuid information of the partition, for example:

/Dev/sdb1: UUID = "abd75825-233b-4719-b216-60fed7baa40d" type = "ext4"

(6) Add the Mount list to/etc/fstab. After the system is started, it will be automatically mounted.

UUID = e9718dc1-d675-4b7b-a3c3-755248d03d39/home/share/vmdisk1 ext4 errors = remount-ro 0
UUID = 0cb5c487-8e06-4df4-941a-4fa043cac813/home/share/vmdisk2 ext4 errors = remount-ro 0

Both disks are mounted to the/home/share/vmdisk1 vmdisk2 File System Using the ext4 file system.

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.