Linux expansion __linux in Linux virtual machines

Source: Internet
Author: User
Tags centos

Basic idea: 1: Virtual machine increases disk capacity

2: Add additional disk capacity to the VMware partition


1. Use the df-h command to view the VMware disk information, as shown in the figure (when the capacity of the virtual machine is 20G)


2. First enlarge the VMware hard disk capacity, Operation diagram: Change 20 to 30


3. Then Linux expansion

@1: Enter FDISK/DEV/SDA (note space), carriage return appears command (M for help)


@2: Check the number of partitions first: p (two partitions/dev/sda1 and/DEV/SDA2)


@3: Input n, (add a new partition) add a partition

@3: Input p (partition type primary partition)

Primary partition Table: The start and end columns of a record partition, and the number of primary partitions. Primary partition size cannot exceed 4

@4: Next steps and explanations, as shown in


@5: Restarting the client

4. Format the newly added partition/dev/sda3

The principle of formatting: Creating different file systems for storing and reading data


5. Add newly added partitions to the LVM group

LVM: is a Linux environment for the management of disk partitions, LVM is built on the hard disk and partition of a logical layer, to improve the flexibility of disk partition management. LVM is a logical layer added between disk partitions and file systems to shield the file system from the lower partition layout, provide an abstract volume, and create a filesystem on the disk.
The simple generalization is that LVM hides the differences between the physical storage devices under an LVM-agreed interface; Benefits: Unified management, Dynamic volume expansion
@1: Creating physical volumes (initializing physical hard disk partitions to physical volumes to initialize physical disk partitions to physical volumes)     
                                                                  
The reason for the error is: CentOS is the name of the volume group, each client will be different, use the Vgdisplay command to view the volume group name
@2: Add the new physical voucher to the volume group VG


* Use Ls-l to view the files in the specified directory, that is, use CD + Specify the directory before this step, cd/dev/mapper

6. File system expansion, that is, expand the logical Volume Lv_root (at this time the volume group has space, so can directly expand the logical volume)

@CentOS use: Resize2fs/dev/mapper/volgrouop-lv_root

@CentOS use: Xfs_growfs dev/mapper/volgrouop-lv_root


7. Finally use the Pvdisplay command to view the volume size, and then the data quit command, exit, as shown below:


And before the size of the volume as shown,


8. Use the df-h command to view the size of the virtual machine hard disk, this time the size of the hard disk becomes larger, the expansion of success.


Note

1: This is some of the basic concepts used to help understand why this step is being performed:


2: Some of the above-related commands

Use of DF command: HTTP://MAN.LINUXDE.NET/DF

LVM Command usage: HTTP://MAN.LINUXDE.NET/?S=LVM

3.VMware Network Connection mode-detailed introduction and distinction between bridging, Nat, and host-only mode

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.