In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
After setting the disk size of the virtual machine, Vmvare found that there was not enough disk space. How to expand the disk size at this time?
First of all, in the case of ensuring that the virtual machine is off, right-click to set, select hard disk, and expand, so that you can increase the size of the disk.
However, due to the lack of partitioning and disk mount settings, we cannot use the increased disk space after starting the virtual machine. What should we do at this time? There are two ways.
Log in to the system with your root account first
First, mount the new disk space to a directory
1. Fdisk-l will have the following message:
Device Boot Start End Blocks Id System/dev/sda1 * 1 64 512000 83 Linux/dev/sda2 64 2611 20458496 8e Linux LVMDisk / dev/mapper/vg_zxw-lv_root: 18.8GB, 18832424960 bytes255 heads, 63 sectors/track, 2289 cylindersUnits = cylinders of 16065512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000
We can see the total disk size and the size used
Indicates that the newly created partition will be sda3
2. Zoning the remaining space
Fdisk / dev/sda/
Prompt for m
Enter the command n to add a new partition
Enter the command p to create the primary partition
Enter enter and choose the default size so that no space is wasted
Enter w to keep the modification
Enter reboot to restart linux, which must be reboot, otherwise / dev/sda3 cannot be formatted
At this point, you can see the new partition such as / dev/sda3 under the / dev/ directory.
Mkfs.ext2 / dev/sda3 format
3. Mount to the directory
Create a disk3 directory under the root directory
[mount / dev/sda3 / disk3/] mount the partition to / disk3/
Modify the / etc/fstab file in vim, add a line [/ dev/sda3 / disk3 ext2 defaults 00], and save it to realize automatic boot mount.
Enter df-h to view
At this point, the newly added disk space capacity can be reflected on the disk3, and restart to automatically mount the partition, and the additional disk space work is completed.
If there is no room for the current disk, you can use the method of adding a disk. In the VMware main interface, select the [VMware] drop-down menu, select [Settings], and add a disk in the [Add] way. The following operations are similar and will not be repeated.
Second, directly expand the new disk space to the "/" root directory
This may be more practical, and it is more convenient for us to extend the new disk space directly to the root directory.
1. Fdisk-l will have the following message:
Device Boot Start End Blocks Id System/dev/sda1 * 1 64 512000 83 Linux/dev/sda2 64 2611 20458496 8e Linux LVMDisk / dev/mapper/vg_zxw-lv_root: 18.8GB, 18832424960 bytes255 heads, 63 sectors/track, 2289 cylindersUnits = cylinders of 16065512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000
We can see the total disk size and the size used
Indicates that the newly created partition will be sda3
2. Zoning the remaining space
Fdisk / dev/sda/
Prompt for m
Enter the command n to add a new partition
Enter the command p to create the primary partition
Enter enter and choose the default size so that no space is wasted
Enter w to keep the modification
3. Our new partition / dev/sda3 is not LVM's. So, next, use fdisk to change it to LVM.
Fdisk / dev/sdaCommand (m for help): mCommand (m for help): t / / change the partition system idPartition number (1-4): 3 / / specify the partition number Hex code (type L to list codes): 8e / / specify the id number to be changed, and 8e represents LVM. Command (m for help): W
After rebooting the system, log in to the system. (be sure to restart the system, otherwise the new partition cannot be expanded)
4. Format the newly added partition:
# fdisk-lDevice 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 will find that there is an extra partition.
# 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:
5. Expand the new partition
The # lvs#pvcreate / dev/sda3 / / pvcreate directive is used to initialize a physical hard disk partition into a physical volume for use by LVM. To create a physical volume, you must partition the hard disk and set the partition type to "8e" before you can initialize the partition to a physical volume using the pvcreat directive. The Physical volume "/ dev/sda3" successfully created#vgextend VolGroup00 / dev/sda3 (where is the lvm group name that currently needs to be expanded, which can be viewed through df-h, for example, mine is: / dev/mapper/VolGroup00-LogVol00) / / vgextend directive is used to dynamically extend the volume group, which increases the volume group capacity by adding physical volumes to the volume group. # vgdisplay / / is used to display metadata information for LNM volume groups. -Volume group-VG Name vg_zxwSystem ID Format lvm2Metadata Areas 1Metadata Sequence No 3VG Access read/writeVG Status resizableMAX LV 0Cur LV 2Open LV 2Max PV 0Cur PV 1Act PV 1VG Size 19.51 GiBPE Size 4.00 MiBTotal PE 4994Alloc PE / Size 4994 / 19.51 GiBFree PE / Size 4994 / 10.01GBVG UUID sqBgTs-iA8x-tCXZ-KYxK-SyWS-TfXQ-uBsLaR (see Free PE / Size 4994 / 10.01GB, indicating that we can expand 10.01GB at most. I generally choose less than 10.01GB) # lvextend-Lock 9.8G / dev/VolGroup00/LogVol00 / dev/sda3Logical volume LogVol00 successfully resized#e2fsck-a / dev/VolGroup00/LogVol00 / / use the e2fsck directive to check for file system errors. You can also check the ext2 file system with "fsck-t ext2-V / dev/sda3/. (do fsck, check the file system) # resize2fs / dev/VolGroup00/LogVol00 / / resize2fs instruction is used to increase or shrink the size of the unloaded" ext2/ext3 "file system. # df-h / / check your system disk space" / "directory becomes 40GB
Ok, it's done.
Summary
The above is the Vmvare virtual machine disk size expansion introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support to the website!
If you think this article is helpful to you, you are welcome to reprint it, please indicate the source, thank you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.