Linux space expansion tutorial in vmare

Source: Internet
Author: User
Article Title: Linux space expansion tutorial under vmare. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

With the continuous use of Linux virtual machines, VMware often encounters the problem that the hard disk space of pre-installed linux virtual machines is too small, resulting in a lot of software cannot be installed, while reinstalling a new one is quite troublesome. So I searched the internet for how to resize the vmware hard disk. Summary:

1. the mount point must be a directory.

2. A partition is mounted to an existing Directory. The directory cannot be empty, but the contents in the directory are unavailable.

I. First, use the VMware tool to resize the allocated hard disk space:

1. vmware provides a command line tool, vmware-vdiskmanager.exe, located in the installation directory of vmware, such

C: \ Program Files \ VMware Workstation \ vmware-vdiskmanager.exe.

Run cmd in windows and go to the installation directory of vmware.

Vmware-vdiskmanager.exe can view help

2. for resizing, enter the following command:

Vmware-vdiskmanager-x 50 Gb "D: \ VMware \ WinXP \ myLinux. vmdk"

Note: The system to be resized cannot be running at this time. The parameter "-x" indicates that the hard disk space of the virtual machine is to be expanded, the following number is the size to be expanded (in this example, it is extended to 50 GB, which is the total amount of a disk, including the original disk capacity ). Finally, it is the specific file of the Virtual Machine disk to be operated. If there is a space in the path name, it must be enclosed in double quotation marks. Press enter to start execution. After the execution is complete, exit the Command Prompt window,

Restart VMware and you will find that the disk space of the VM has changed to 50 GB.

After restarting the virtual machine, we found that the hard disk of the virtual machine was changed to 50 GB, but after entering the linux system, we used "df-ah" to check whether the hard disk space was as large as originally.

Although the disk has been expanded, but the file system has not been partitioned and specified, the linux operating system cannot be identified (in fact, it is equivalent to your hard disk although it is large, but you didn't partition it ). Next we will perform partition processing.

Method 2: Use the VM graphic interface to close the VM, edit the VM configuration, and directly resize the hard disk space.

3. Partition: (switch to the Root user and use the sudo command in Ubuntu)

Fdisk command: fdisk-l: print the current disk partition table. At this time, we can see that the total number of disks has indeed increased to 50 GB, but the partitions are only those original partitions.

Run the following command: fdisk/dev/sda. "sda is the resized hard disk, which is a SCSI hard disk, and an IDE-type hard disk is hda. This operation is performed on this hard disk"

Type: m "list fdisk help"

Here we want to add a new partition, which will be scaled out into a new partition, so that it can be identified by the operating system mounting.

Type: n "command n to add a new partition"

At this time, fdisk will let you choose to add as a logical partition (number starting from 5) or primary partition (Number 1 to 4 ). Select the primary partition, and then type p. Select logical partition and enter l.

We select the primary partition as follows:

Type: p "select create primary partition"

At this time, fdisk will let you select the number of the primary partition. If you already have the sda1 and sda2 primary partitions, select 3 as the number, that is, the partition to be created is sda3.

Type: 3

At this time, fdisk will let you choose the Start value of the partition. This is the start cylinder value of the partition. You 'd better press enter here,

If you enter a non-default number, the space is wasted;

At this point, type: w "Save all and exit, partition is completed"

We cannot use this partition now. Because it is not formatted, We need to restart the system to see sda3 under dev. If it is not restarted, we cannot perform the following operations.

4. format the newly added partition:

Type: mkfs-t ext3/dev/sda3

Or format the specified partition in mkfs. ext3/dev/sda3, and so on. Most of the current systems are in the ext3 format. If you need other partitions, you can view the help of mkfs.

Now we can use this new partition:

5. Mount the partition:

Manually mount the partition, and enter sudo mount/dev/sda3/mnt/sda3 to mount the new partition to the/mnt/sda3/directory.

(Note: Ubuntu is mounted to the/media directory by default, and the manually mounted information has registration information under the/etc/mtab file)

After automatic mounting is started, modify the/etc/fstab file and add a line in the file:

/Dev/sda3/mnt/sda3 ext3 defaults, 0 1

You can use the new partition here.

Manual mounting in Redhat environment:

1. Create a/oracledir folder

2 mount/dev/sda3 // oracledir

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.