VMware virtual Machine (Linux) increases root disk space

Source: Internet
Author: User
Tags hex code

VMware virtual Machine (Linux) increases root disk space today, check the school's monitoring and repair system, can not access the!!! The system is running slowly, using the top command to see the memory usage 90%, using "df-h" to View "/" Directory usage has reached 80%, 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, view your system's partitions #fdisk-L will receive the following information:

device boot      start          end      blocks   id  system / dev/sda1   *           1           64      512000    83  linux /dev/sda2               64        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 /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/ 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 (comm and ' U ').

Command (M for Assist): M//"list fdisk help" 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 CREA Te 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//"commands n for adding a new partition" 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 the 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 The value here is best to press ENTER directly, Using the 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 would be used on 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          64       512000   83  linux /dev/sda2               64        2611     20458496    8e  Linux LVM /dev/sda3             2611        3916     10483750    8e  Linux LVM  you'll find a piece more partitioned.  

#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//To display metadata information for the LNM volume group.

---Volume Group---

VG Name vg_zxw System ID Format lvm2 Metadata areas 1 Metadata Seq Uence 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, indicating that we can have up to 10.01GB

Expand the space. I generally choose less than 10.01GB)

# 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.

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

OK, that's it.

Reference URL: http://wenku.baidu.com/link?url= K3ff5ancc3qiu7ocahhcc7bcxv2ko21zzfhcbjxxhsrnf1kmkjmoslf52xq0ce2jbuhrauptl2mz6ffarz0rxkp4zs_1nta2x10niam96fk

VMware virtual Machine (Linux) increases root disk space

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.