cheng029 发表于 2012-11-6 17:12:50

ESXI4.1 linux虚拟机调整扩充磁盘大小

首先调整磁盘大小为60G
注意: 如果虚拟机做快照是无法调节置备大小的,要先删除快照才能调整

点确定后,重启虚拟机OS shutdown -r now
fdisk -l
Disk /dev/sda: 64.4 GB, 64424509440 bytes255 heads, 63 sectors/track, 7832 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   IdSystem/dev/sda1   *         1          13      104391   83Linux/dev/sda2            14      2610    20860402+8eLinux LVM# df -hl文件系统            容量已用 可用 已用% 挂载点/dev/mapper/VolGroup00-LogVol00                     19G   12G6.4G64% //dev/sda1            99M   20M   75M21% /boottmpfs               2.0G   02.0G   0% /dev/shm
# fdisk /dev/sda
The number of cylinders for this disk is set to 7832.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): nCommand action   e   extended   p   primary partition (1-4)pPartition number (1-4): 3First cylinder (2611-7832, default 2611): 默认回车Using default value 2611Last cylinder or +size or +sizeM or +sizeK (2611-7832, default 7832):默认回车Using default value 7832
Command (m for help): tPartition number (1-4): 3Hex code (type L to list codes): 8eChanged system type of partition 3 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/sda: 64.4 GB, 64424509440 bytes255 heads, 63 sectors/track, 7832 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   IdSystem/dev/sda1   *         1          13      104391   83Linux/dev/sda2            14      2610    20860402+8eLinux LVM/dev/sda3            2611      7832    41945715   8eLinux LVM
Command (m for help): w      保存退出The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.The kernel still uses the old table.The new table will be used at the next reboot.Syncing disks.
重启虚拟机OS# shutdown -r nowfdisk -lDisk /dev/sda: 64.4 GB, 64424509440 bytes255 heads, 63 sectors/track, 7832 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes   Device Boot      Start         End      Blocks   IdSystem/dev/sda1   *         1          13      104391   83Linux/dev/sda2            14      2610    20860402+8eLinux LVM/dev/sda3            2611      7832    41945715   8eLinux LVM# df -hl文件系统            容量已用 可用 已用% 挂载点/dev/mapper/VolGroup00-LogVol00                     19G   12G6.4G64% //dev/sda1            99M   20M   75M21% /boottmpfs               2.0G   02.0G   0% /dev/shm# df -T /dev/sda1文件系统      类型   1K-块      已用   可用 已用% 挂载点/dev/sda1   ext3      101086   19487   7638021% /boot
格式化/dev/sda3# mkfs.ext3 /dev/sda3    mke2fs 1.39 (29-May-2006)Filesystem label=OS type: LinuxBlock size=4096 (log=2)Fragment size=4096 (log=2)5248992 inodes, 10486428 blocks524321 blocks (5.00%) reserved for the super userFirst data block=0Maximum filesystem blocks=4294967296321 block groups32768 blocks per group, 32768 fragments per group16352 inodes per groupSuperblock backups stored on blocks:          32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,          4096000, 7962624Writing inode tables: done                            Creating journal (32768 blocks): doneWriting superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 28 mounts or180 days, whichever comes first.Use tune2fs -c or -i to override.创建PV# pvcreate /dev/sda3Physical volume "/dev/sda3" successfully created查看PV状态# pvdisplay/dev/hdc: open failed: 找不到介质--- Physical volume ---PV Name               /dev/sda2VG Name               VolGroup00PV Size               19.89 GB / not usable 19.49 MBAllocatable         yes (but full)PE Size (KByte)       32768Total PE            636Free PE               0Allocated PE          636PV UUID               KjvMTJ-8laN-yuwe-N0oA-jtsF-Z0oc-CnzOUX
"/dev/sda3" is a new physical volume of "40.00 GB"--- NEW Physical volume ---PV Name               /dev/sda3VG Name               PV Size               40.00 GBAllocatable         NOPE Size (KByte)       0Total PE            0Free PE               0Allocated PE          0PV UUID               J9yLqC-vpK8-jiwd-5STl-kbRT-BGMg-UB6uPk
# vgdisplay/dev/hdc: open failed: 找不到介质--- Volume group ---VG Name               VolGroup00System ID             Format                lvm2Metadata Areas      1Metadata Sequence No3VG Access             read/writeVG Status             resizableMAX LV                0Cur LV                2Open LV               2Max PV                0Cur PV                1Act PV                1VG Size               19.88 GBPE Size               32.00 MBTotal PE            636Alloc PE / Size       636 / 19.88 GBFreePE / Size       0 / 0   VG UUID               V6H9Dr-e1mb-7E3v-uEgv-UyYX-da9Q-fD8VVp
刚创建的PV加入相应的VG # vgextend VolGroup00 /dev/sda3 /dev/hdc: open failed: 找不到介质Volume group "VolGroup00" successfully extended
# vgdisplay /dev/hdc: open failed: 找不到介质--- Volume group ---VG Name               VolGroup00System ID             Format                lvm2Metadata Areas      2Metadata Sequence No4VG Access             read/writeVG Status             resizableMAX LV                0Cur LV                2Open LV               2Max PV                0Cur PV                2Act PV                2VG Size               59.88 GBPE Size               32.00 MBTotal PE            1916Alloc PE / Size       636 / 19.88 GBFreePE / Size       1280 / 40.00 GBVG UUID               V6H9Dr-e1mb-7E3v-uEgv-UyYX-da9Q-fD8VVp
    查看LV状态# lvdisplay/dev/hdc: open failed: 找不到介质--- Logical volume ---LV Name                /dev/VolGroup00/LogVol00VG Name                VolGroup00LV UUID                sSmNj2-Gw4B-hYE2-9nUw-ybJV-6Yxa-DU4VJtLV Write Access      read/writeLV Status            available# open               1LV Size                19.12 GBCurrent LE             612Segments               1Allocation             inheritRead ahead sectors   auto- currently set to   256Block device         253:0
--- Logical volume ---LV Name                /dev/VolGroup00/LogVol01VG Name                VolGroup00LV UUID                LIrXiG-3IiO-LhjI-o3yN-vI5T-Yamm-FxD31jLV Write Access      read/writeLV Status            available# open               1LV Size                768.00 MBCurrent LE             24Segments               1Allocation             inheritRead ahead sectors   auto- currently set to   256Block device         253:1
=========================================================# lvextend -l +2559 /dev/VolGroup00/   勿回车LogVol00LogVol01注意!不知道选哪个,通过以下命令获取可以得到# df -hl文件系统            容量已用 可用 已用% 挂载点/dev/mapper/VolGroup00-LogVol00                     19G   12G6.4G64% //dev/sda1            99M   20M   75M21% /boottmpfs               2.0G   02.0G   0% /dev/shm=========================================================为/dev/VolGroup00/LogVol00增加容量# lvextend -l +2559 /dev/VolGroup00/LogVol00 /dev/hdc: open failed: 找不到介质Extending logical volume LogVol00 to 99.09 GBInsufficient free space: 2559 extents needed, but only 1280 available
# lvextend -l +1280 /dev/VolGroup00/LogVol00 /dev/hdc: open failed: 找不到介质Extending logical volume LogVol00 to 59.12 GBLogical volume LogVol00 successfully resized
用 resize2fs 调整文件系统大小# resize2fs /dev/mapper/VolGroup00-LogVol00resize2fs 1.39 (29-May-2006)Filesystem at /dev/mapper/VolGroup00-LogVol00 is mounted on /; on-line resizing requiredPerforming an on-line resize of /dev/mapper/VolGroup00-LogVol00 to 15499264 (4k) blocks.The filesystem on /dev/mapper/VolGroup00-LogVol00 is now 15499264 blocks long.# df -hl文件系统            容量已用 可用 已用% 挂载点/dev/mapper/VolGroup00-LogVol00                     58G   12G   44G21%    //dev/sda1            99M   20M   75M21% /boottmpfs               2.0G   02.0G   0% /dev/shm

高峰之巅 发表于 2013-3-18 09:05:51

此地禁止大小便,违者没收工具。

hc6538 发表于 2013-5-17 06:02:25

走,MM,咱们化蝶去……

色破飞机 发表于 2013-5-19 14:50:24

如果跟导师讲不清楚,那么就把他搞胡涂吧!

阿尔海南粉 发表于 2013-5-22 06:07:06

睡眠是一门艺术——谁也无法阻挡我追求艺术的脚步!

5ol.cc 发表于 2013-5-26 00:04:05

沙发!沙发!

760176104 发表于 2013-5-30 23:17:25

沒有激情的亲吻,哪來床上的翻滾?
页: [1]
查看完整版本: ESXI4.1 linux虚拟机调整扩充磁盘大小