1. shut down your VM system and find the following content: Select EditVirtualmachesettings and click Expand to Expand the VM space to 40 GB (enter the space size as needed ). But it is not visible in linux. 2. use the fdisk tool in linux for partitioning. Log on to your linux system as the root user and view
1. shut down your VM system and find the following content: Select "Edit Virtual mache settings"
Click "Expand"
Expand the virtual machine space to "40 GB" (fill in the space size as needed ). But it is not visible in linux.
2. use the fdisk tool in linux for partitioning.
Log on to your linux system as the root user and view the partition of your system.
# Fdisk-l
The following information is displayed:
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, 63 sectors/track, 2289 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Sector size (logical/physical): 512 bytes/512 bytes
I/O size (minimum/optimal): 512 bytes/512 bytes
Disk identifier: 0x00000000
Disk/dev/mapper/vg_zxw-lv_root doesn "str">'t contain a valid partition table
Disk/dev/mapper/vg_zxw-lv_swap: 2113 MB, 2113929216 bytes
255 heads, 63 sectors/track, 257 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Sector size (logical/physical): 512 bytes/512 bytes
I/O size (minimum/optimal): 512 bytes/512 bytes
Disk identifier: 0x00000000
Disk/dev/mapper/vg_zxw-lv_swap doesn't contain a valid partition table
Based on the prompts, we can determine that the disk interface of this system is SCSI, corresponding to "sda". if the above red font is "hda ", therefore, the disk interface of this system corresponds to "hda" in IDE, so I will perform the following operations:
# Fdisk/dev/sda/
WARNING: DOS-compatible mode is deprecated. It's stronglyrecommended
Switch off themode (command 'C') and change display units
Sectors (command 'u ').
Command (m forhelp): 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 partitiontable
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 forhelp): n // "Command n is used to add a new partition"
Command action
E extended
P primary partition (1-4)
P // "select Create primary partition" at this time,
Partition number (1-4): 3 // fdisk will let you select the number of the primary Partition. if you already have the primary Partition sda1 and sda2, select 3, that is, the partition to be created is sda3.
First cylinder (2611-3916, default2611): // at this time, fdisk will let you choose the Start value of the partition. this is the Start value of the partition (startcylinder). you 'd better press enter here,
Using default value 2611
Last cylinder, + cylinders or + size {K, M, G} (2611-3916, default3916): // at this time, fdisk will let you choose the start value of the partition. this is the End value of the partition. press enter directly,
Using default value 3916
Command (m for help): w // w "save all and exit, partition division completed"
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 will be usedat
The next reboot or after you run partprobe (8) or kpartx (8)
Syncing disks.
3. our new partition/dev/sda3 is not an LVM. Therefore, use fdisk to change it to LVM.
# Fdisk/dev/sda
Command (m for help): m
Command (m for help): t // change the partition system id
Partition number (1-4): 3 // specify the Partition number
Hex code (type L to list codes): 8e // specify the ID number to be changed. 8e indicates LVM.
Command (m for help): w
4. after the system is restarted, log on to the system. (You must restart the system. Otherwise, the new partition cannot be expanded) 5. 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 LinuxLVM
You will find one more partition.
# Mkfs-t ext3/dev/sda3 "rem"> // Create an ext3 file system on the hard disk partition "/dev/sda3.
Now we can use this new partition:
6. expand new partitions#
Lvs
# Pvcreate/dev/sda3 "rem"> // The pvcreate command is used to initialize a physical hard disk partition as a physical volume for use by LVM. To create a physical volume, you must first partition the hard disk and set the hard disk partition type to "8e" before using the pvcreat command to initialize the partition as a physical volume.
Physical volume "str"> "/dev/sda3" successfully created
# Vgextend VolGroup00/dev/sda3 (here is the name of the lvm Group to be expanded, which can be viewed through df-h, for example, my is:/dev/mapper/VolGroup00-LogVol00) // The vgextend command is used to dynamically expand a volume group. It adds physical volumes to the volume group to increase the volume group capacity.
# Vgdisplay // displays the metadata of an LNM volume group.
--- Volume group ---
VGName vg_zxw
SystemID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VGAccess read/write
VGStatus resizable
MAXLV 0
CurLV 2
OpenLV 2
MaxPV 0
CurPV 1
ActPV 1
VGSize 19.51 GiB
PESize 4.00 MiB
TotalPE 4994
Alloc PE/Size 4994/19 .51 GiB
Free PE/Size 4994/10 .01 GB
SqBgTs-iA8x-tCXZ-KYxK-SyWS-TfXQ-uBsLaR VGUUID
(For details, refer to Free PE/Size 4994/10 .01 GB, which means we can have up to 10.01GB of extended space. I usually choose less than 10.01 GB)
# Lvextend-L + 9.8G/dev/VolGroup00/LogVol00/dev/sda3
Logical volume LogVol00 successfully resized
# E2fsck-a/dev/VolGroup00/LogVol00 "rem"> // run the e2fsck command to check for file system errors. You can also use "fsck-t ext2-V/dev/sda3/" to check the ext2 file system.
(Perform fsck and check the file system)
# Resize2fs/dev/VolGroup00/LogVol00 "rem"> // The resize2fs command is used to increase or contract the size of the unloaded "ext2/ext3" file system.
# Df-h "rem"> // check your system disk space. "/" The directory is changed to 40 GB.
OK.