扩展VMware 虚拟机硬盘容量,不需要重装系统心得

    技术2022-05-20  32

    1.使用vmware自带vmware-vdiskmanager.exe进行扩容第一步。

        首先,进入“运行”,cmd,进入vmware-vdiskmanager.exe所在目录(例如:我的是在C:/Program Files/VMware/VMware Workstation,则(1)c: (2)cd Program Files (3)cd VMware (4)cd VMware Workstation   最后进入C:/Program Files/VMware/VMware Workstation),执行vmware-vdiskmanager.exe -x 20GB "E:/Red Hat Enterprise Linux 5/Red Hat Enterprise Linux 5.vmdk"(其中20GB指扩容后的大小,E:/Red Hat Enterprise Linux 5/Red Hat Enterprise Linux 5.vmdk指要扩容的虚拟机的磁盘)

    a. 异常情况:Failed to expand the disk 'E:/VM/SUSEServer.vmdk': One of the parameters supplied is invalid (0x100003e80).

       原因:-x后的参数是扩大后的硬盘空间大小。如果空间大小小于或等于原有的硬盘空间大小,就会出现这个错误。

    b. 异常情况:目录中有空格出现,要加上在路径上""

    2 调整Fedora 8文件系统大小[转】   转载来自:http://blog.csdn.net/jjl_china/archive/2009/09/15/4550883.aspx进入Fedora 8系统终端,先添加一个磁盘分区fdisk /dev/sda

    我的执行过程:[root@localhost ~]# fdisk /dev/sda

    The number of cylinders for this disk is set to 3916.There is nothing wrong with that, but this is larger than 1024,and could in certain setups cause problems with:1) software that runs at boot time (e.g., old versions of LILO)2) booting and partitioning software from other OSs(e.g., DOS FDISK, OS/2 FDISK)

    Command (m for help): p

    Disk /dev/sda: 32.2 GB, 32212254720 bytes255 heads, 63 sectors/track, 3916 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDisk identifier: 0x000bc363

    Device Boot Start End Blocks Id System/dev/sda1 * 1 25 200781 83 Linux/dev/sda2 26 1958 15526822+ 8e Linux LVM/dev/sda3 1959 2610 5237190 8e Linux LVM

    Command (m for help): nCommand actione extendedp primary partition (1-4)pSelected partition 4First cylinder (2611-3916, default 2611): Using default value 2611Last cylinder or +size or +sizeM or +sizeK (2611-3916, default 3916): Using default value 3916

    Command (m for help): tPartition number (1-4): 4Hex code (type L to list codes): 8eChanged system type of partition 4 to 8e (Linux LVM)

    Command (m for help): p

    Disk /dev/sda: 32.2 GB, 32212254720 bytes255 heads, 63 sectors/track, 3916 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDisk identifier: 0x000bc363

    Device Boot Start End Blocks Id System/dev/sda1 * 1 25 200781 83 Linux/dev/sda2 26 1958 15526822+ 8e Linux LVM/dev/sda3 1959 2610 5237190 8e Linux LVM/dev/sda4 2611 3916 10490445 8e Linux LVM

    Command (m for help): wThe 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 used at the next reboot.Syncing disks.

    (注:建议重启一下Fedora系统)

    [root@localhost ~]# pvcreate /dev/sda4Physical volume "/dev/sda4" successfully created[root@localhost ~]# vgextend VolGroup00 /dev/sda4Volume group "VolGroup00" successfully extended[root@localhost ~]# lvextend -l +100%FREE /dev/VolGroup00/LogVol00 Extending logical volume LogVol00 to 28.25 GBLogical volume LogVol00 successfully resized[root@localhost ~]# lvresize -l +100%FREE /dev/VolGroup00/LogVol00New size (904 extents) matches existing size (904 extents)lvresize: Resize a logical volume

    lvresize[-A|--autobackup y|n][--alloc AllocationPolicy][-d|--debug][-h|--help][-i|--stripes Stripes [-I|--stripesize StripeSize]]{-l|--extents [+|-]LogicalExtentsNumber[%{VG|LV|FREE}] |-L|--size [+|-]LogicalVolumeSize[kKmMgGtTpPeE]}[-n|--nofsck][-r|--resizefs][-t|--test][--type VolumeType][-v|--verbose][--version]LogicalVolume[Path] [ PhysicalVolumePath... ]

    [root@localhost ~]# resize2fs /dev/VolGroup00/LogVol00 resize2fs 1.40.2 (12-Jul-2007)Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing requiredold desc_blocks = 2, new_desc_blocks = 2Performing an on-line resize of /dev/VolGroup00/LogVol00 to 7405568 (4k) blocks.The filesystem on /dev/VolGroup00/LogVol00 is now 7405568 blocks long.

     


    最新回复(0)