Expanded disks in VMware

Source: Internet
Author: User
Tags hex code

Just started to install the system in the virtual machine, only divided the size of the 20G, with the continuous use, the results when installing a software to remind me of insufficient disk space

Using "df-h" to View "/" Directory usage has reached 90%, causing the system to run very slowly. I expanded the root disk space in the following ways.
First, close your virtual machine system and find the following: Select "Edit Virtual mache settings"

Click "Expand"

Expand the virtual machine space to "40G" (according to individual needs to fill the space size). But Linux is not visible underneath.
Second, use the Fdisk tool under Linux to partition.
Log in to your Linux system with the root user and view your system's partitions
#fdisk-L
The following information will appear:
Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 512000 Linux
/dev/sda2 2611 20458496 8e Linux LVM
disk/dev/mapper/vg_zxw-lv_root:18.8 GB, 18832424960 bytes
255 heads, Sectors/track, 2289 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000
Disk/dev/mapper/vg_zxw-lv_root doesn ' t contain a valid partition table
disk/dev/mapper/vg_zxw-lv_swap:2113 MB, 2113929216 bytes
255 heads, Sectors/track, 257 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000
Disk/dev/mapper/vg_zxw-lv_swap doesn ' t contain a valid partition table
According to the prompt information can be determined that the system's disk interface is SCSI, corresponding to "SDA" if the above red font is "HDA", then the system's disk interface for the IDE "HDA" so I do the operation:

#fdisk/dev/sda/

Warning:dos-compatible mode is deprecated. It ' s strongly recommended to
Switch off the mode (command ' C ') and change display units to
Sectors (Command ' u ').
Command (M for help): M//"list Fdisk's assistance"
Command Action
A toggle a bootable flag
b Edit BSD Disklabel
C Toggle the DOS compatibility flag
D Delete a partition
L list known partition types
M Print this menu
n Add a new partition
o Create a new empty DOS partition table
P Print the partition table
Q Quit without saving changes
s create a new empty Sun Disklabel
t change a partition ' s system ID
U Change display/entry units
V Verify the partition table
W Write table to disk and exit
X Extra functionality (experts only)
Command (M for help): N//"N to add new partition"
Command Action
E Extended
P primary partition (1-4)
P//"Select Create Primary Partition" At this point,

Partition number (1-4): 3//fdisk will let you select the primary partition's numbers, if you already have the primary partition Sda1,sda2, then the number is selected 3, that is, the partition to be created Sda3.
First cylinder (2611-3916, default 2611)://At this point, Fdisk will let you choose the starting value of the partition this is the start value of the partition (start cylinder); It is best to press ENTER directly,
Using Default Value 2611
Last cylinder, +cylinders or +size{k,m,g} (2611-3916, default 3916)://At this point, Fdisk will let you choose the start value of the partition this is the end of the partition Value it's best to press ENTER directly,
Using Default Value 3916
Command (M for help): W//w "Save All and exit, Partition complete"
The partition table has been altered!
Calling IOCTL () to re-read partition table.
Warning:re-reading the partition table failed with error 16:device or resource busy.
The kernel still uses the old table. The new table is being used at
The next reboot or after you run Partprobe (8) or KPARTX (8)
Syncing disks.
Third, our new partition/dev/sda3, but not LVM. So, next use Fdisk to change it to LVM.
#fdisk/DEV/SDA
Command (M for help): M
Command (M for help): t//change partition system ID

Partition number (1-4): 3//Specify partition numbers
Hex code (type L to list codes): 8e//Specifies the ID number to be changed, and 8e represents LVM.
Command (M for help): W
Four, restart the system, the landing system. (Be sure to restart the system, or you will not be able to expand the new partition)
V. Format the newly added partition:
#fdisk-L

Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 512000 Linux
/dev/sda2 2611 20458496 8e Linux LVM
/dev/sda3 2611 3916 10483750 8e Linux LVM
You'll find a piece of partition more.
#mkfs-T ext3/dev/sda3//Create a "ext3" file system on the hard disk partition "/dev/sda3".
At this point we can use the new partition:
VI. expansion of new partitions
#lvs
The #pvcreate/dev/sda3//pvcreate directive is used to initialize a physical hard disk partition to a physical volume for use by LVM. To create a physical volume, you must first partition the hard disk and set the type of the hard disk partition to "8e" before you can use the Pvcreat directive to initialize the partition to a physical volume.
Physical volume "/dev/sda3" successfully created
#vgextend Volgroup00/dev/sda3 (which is the LVM group name that you currently need to expand, can be viewed through df-h, for example my:/dev/mapper/volgroup00-logvol00)// The vgextend directive is used for dynamic extended volume groups, which increase the capacity of a volume group by adding physical volumes to the volume group.
#vgdisplay-V//To display metadata information for the LNM volume group.

---Volume Group---
VG Name Vg_zxw
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access Read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
ACT PV 1
VG Size 19.51 GiB
PE Size 4.00 MiB
Total PE 4994
Alloc pe/size 4994/19.51 GiB
Free Pe/size 4994/10.01GB
VG UUID Sqbgts-ia8x-tcxz-kyxk-syws-tfxq-ubslar

(Main view free pe/size 4994/10.01GB, we can have up to 10.01GB of expansion space.) I generally choose less than 10.01GB)

Description: Use vgdisplay-v in my environment to display the following

Where/dev/centos/root is the second parameter in my next step, so the next few steps/dev/volgroup00/logvol00 corresponding should be replaced by/dev/centos/root

# Lvextend-l+9.8g/dev/volgroup00/logvol00/dev/sda3

Logical Volume LogVol00 successfully resized
#e2fsck-a/dev/volgroup00/logvol00//use e2fsck instruction to check for file system errors. You can also use the Fsck-t ext2-v/dev/sda3/to check the ext2 file system.

(Do fsck, check the file system)

#resize2fs/dev/volgroup00/logvol00//resize2fs instruction is used to increase or shrink the size of the "EXT2/EXT3" file system that is not loaded. If you fail with RESIZE2FS, replace with Xfs_growfs/dev/centos/root.

#df-H//Check your system disk space "/" Directory becomes 40GB

OK, that's it.

Reference: http://zhongxw.blog.51cto.com/3429597/787219/

Expanded disks in VMware

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.