Increase the size of hard disk partitions for virtual machines
Source: Internet
Author: User
Increase the size of the hard disk partition of a VM-Linux general technology-Linux technology and application information. The following is a detailed description. I installed a lot of things with 8 GB of ubuntu before, and I found that the partitions were not enough. I had to install a bunch of things for reinstallation, so I should add the VM partition.
I am using vmware 6.0. There are two ways to add partitions. One is to use the tool provided by VM to increase the size of the entire partition. The other is to add a hard disk partition.
When doing this, make sure that your VM is off. (You can back up Ubuntu. vmdk if you are not at ease)
I:
1: First, let's talk about using VMWARE's built-in tools.
Find your vmware installation directory and find the vmware-vdiskmanager.exe file in the installation directory. Of course, double-click it. I just want you to confirm that you have this file before you can use it. Open the command line cd to your vmware installation directory and enter
Vmware-vdiskmanager: If you find that a bunch of commands are listed, it indicates that they can be used. Now we can use it to adjust the partition size of the VM.
D: \ Ubuntu10 \ Ubuntu. vmdk. This is the OS physical disk file in your VM.
Now, it will take some time for you to wait for him to re-adjust the partition. In fact, he adds some partition links on your original basis. For example, if you have 10 GB, then he will allocate another 16-10 = 6 GB space, the original data remains unchanged, so rest assured that your data will not be lost.
2: Use the setting of VM
Edit virtual machine settings, select add to add the hard disk. here you need to select the new partition size of the hard disk type based on your needs and actual conditions.
II:
All right, the above two are added with partitions, but ubuntu still cannot recognize them, so you have to display the format to ubuntu, and then stick it on him to tell him to start the mount on this new partition. Use the following command.
Start the VM and go to ubuntu to start a terminal.
$ Sudo fdisk/dev/sda
Here, my hard disk type is serial port or SATA, so it is/dev/sda. If it is an IDE hard disk or a parallel port, it is/dev/hda.
If you don't know what type you are, you can run cd/dev and then ls-a to find out if there are sda, hda, and so on.
A command appears
Command (m for help ):
In this case, enter n to Command (m for help): n and press Enter.
The following option appears:
Command action
L logical (5 or over)
P primary partition (1-4)
Select p
Then
Primary partition (1-4 ):
In this case, you need to check which Partition Number is not used in your partition and open another terminal.
Enter sudo fdisk-l
My current list is
/Dev/sda1
/Dev/sda2
/Dev/sda3
/Dev/sda5
Here, sda3 is the newly added partition. If there is no over-limit partition, It is shown as follows:
/Dev/sda1
/Dev/sda2
/Dev/sda5
However, other cases are not excluded. The purpose is to select a unused number from 1, 2, 3, and 4.
I have never been used before, so I chose 3.
In primary partition (1-4): Enter 3, namely, primary partition (1-4): 3, and press Enter.
If no error is reported
Command (m for help ):
Enter w
The system cannot quickly recognize the new sda3, so after restarting, you can check whether/dev/sda3 exists.
Next, run the next command.
$ Mkfs. ext3/dev/sda3
You can run mkfs and press the tab key to view the related commands. The commands are formatted as the ext3 type. Of course, you can choose what you like, however, in my previous EXT3, I chose ext3 to ensure compatibility.
The last step is to set the partition mounting. Before that, you must determine where you want to mount the new partition. For example, you want to mount it to the extend file in the home directory.
Create an extend file in the home Directory (if the extend directory does not exist). Of course, you can also mount it to an existing file. The directory you want to mount can be anything you like.
Enter the following command on the terminal
$ Sudo gedit/etc/fstab
Add the following content
/Dev/sda3/home/extend ext3 defaults 1 2
You can refer to the existing file for this format.
Okay, and restart. You can use the analyzer in the attachment disk to view the new partition size.
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.