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

简介:

 首先调整磁盘大小为60G

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

点确定后,重启虚拟机OS

[root@download1 ~] shutdown -r now

 

[root@download1 ~]fdisk -l

 

Disk /dev/sda: 64.4 GB, 64424509440 bytes

255 heads, 63 sectors/track, 7832 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          13      104391   83  Linux

/dev/sda2              14        2610    20860402+  8e  Linux LVM

[root@download1 ~]# df -hl

文件系统              容量  已用 可用 已用挂载点

/dev/mapper/VolGroup00-LogVol00

                       19G   12G  6.4G  64% /

/dev/sda1              99M   20M   75M  21% /boot

tmpfs                 2.0G     0  2.0G   0% /dev/shm

 

 [root@download1 ~]# 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): n

Command action

   e   extended

   p   primary partition (1-4)

p

Partition number (1-4): 3

First cylinder (2611-7832, default 2611): 默认回车

Using default value 2611

Last cylinder or +size or +sizeM or +sizeK (2611-7832, default 7832): 默认回车

Using default value 7832

 

Command (m for help): t

Partition number (1-4): 3

Hex code (type L to list codes): 8e

Changed system type of partition 3 to 8e (Linux LVM)

 

Command (m for help): p

 

Disk /dev/sda: 64.4 GB, 64424509440 bytes

255 heads, 63 sectors/track, 7832 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          13      104391   83  Linux

/dev/sda2              14        2610    20860402+  8e  Linux LVM

/dev/sda3            2611        7832    41945715   8e  Linux 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

[root@download1 ~]# shutdown -r now

[root@download1 ~]fdisk -l

Disk /dev/sda: 64.4 GB, 64424509440 bytes

255 heads, 63 sectors/track, 7832 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          13      104391   83  Linux

/dev/sda2              14        2610    20860402+  8e  Linux LVM

/dev/sda3            2611        7832    41945715   8e  Linux LVM

[root@download1 ~]# df -hl

文件系统              容量  已用 可用 已用挂载点

/dev/mapper/VolGroup00-LogVol00

                       19G   12G  6.4G  64% /

/dev/sda1              99M   20M   75M  21% /boot

tmpfs                 2.0G     0  2.0G   0% /dev/shm

[root@download1 ~]# df -T /dev/sda1

文件系统      类型     1K-        已用     可用 已用挂载点

/dev/sda1     ext3      101086     19487     76380  21% /boot

 

 格式化/dev/sda3

[root@download1 ~]# mkfs.ext3 /dev/sda3   

mke2fs 1.39 (29-May-2006)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

5248992 inodes, 10486428 blocks

524321 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=4294967296

321 block groups

32768 blocks per group, 32768 fragments per group

16352 inodes per group

Superblock backups stored on blocks:

         32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

         4096000, 7962624

Writing inode tables: done                           

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 28 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

  创建PV

[root@download1 ~]# pvcreate /dev/sda3

  Physical volume "/dev/sda3" successfully created

  查看PV状态

[root@download1 ~]# pvdisplay

  /dev/hdc: open failed: 找不到介质

  --- Physical volume ---

  PV Name               /dev/sda2

  VG Name               VolGroup00

  PV Size               19.89 GB / not usable 19.49 MB

  Allocatable           yes (but full)

  PE Size (KByte)       32768

  Total PE              636

  Free PE               0

  Allocated PE          636

  PV 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/sda3

  VG Name              

  PV Size               40.00 GB

  Allocatable           NO

  PE Size (KByte)       0

  Total PE              0

  Free PE               0

  Allocated PE          0

  PV UUID               J9yLqC-vpK8-jiwd-5STl-kbRT-BGMg-UB6uPk

  

[root@download1 ~]# vgdisplay 

  /dev/hdc: open failed: 找不到介质

  --- Volume group ---

  VG Name               VolGroup00

  System ID            

  Format                lvm2

  Metadata Areas        1

  Metadata Sequence 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.88 GB

  PE Size               32.00 MB

  Total PE              636

  Alloc PE / Size       636 / 19.88 GB

  Free  PE / Size       0 / 0  

  VG UUID               V6H9Dr-e1mb-7E3v-uEgv-UyYX-da9Q-fD8VVp

  

  刚创建的PV加入相应的VG

[root@download1 ~]# vgextend VolGroup00 /dev/sda3

  /dev/hdc: open failed: 找不到介质

  Volume group "VolGroup00" successfully extended

 

[root@download1 ~]# vgdisplay

  /dev/hdc: open failed: 找不到介质

  --- Volume group ---

  VG Name               VolGroup00

  System ID            

  Format                lvm2

  Metadata Areas        2

  Metadata Sequence No  4

  VG Access             read/write

  VG Status             resizable

  MAX LV                0

  Cur LV                2

  Open LV               2

  Max PV                0

  Cur PV                2

  Act PV                2

  VG Size               59.88 GB

  PE Size               32.00 MB

  Total PE              1916

  Alloc PE / Size       636 / 19.88 GB

  Free  PE / Size       1280 / 40.00 GB

  VG UUID               V6H9Dr-e1mb-7E3v-uEgv-UyYX-da9Q-fD8VVp

  

    查看LV状态

  [root@download1 ~]# lvdisplay

  /dev/hdc: open failed: 找不到介质

  --- Logical volume ---

  LV Name                /dev/VolGroup00/LogVol00

  VG Name                VolGroup00

  LV UUID                sSmNj2-Gw4B-hYE2-9nUw-ybJV-6Yxa-DU4VJt

  LV Write Access        read/write

  LV Status              available

  # open                 1

  LV Size                19.12 GB

  Current LE             612

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     256

  Block device           253:0

  

  --- Logical volume ---

  LV Name                /dev/VolGroup00/LogVol01

  VG Name                VolGroup00

  LV UUID                LIrXiG-3IiO-LhjI-o3yN-vI5T-Yamm-FxD31j

  LV Write Access        read/write

  LV Status              available

  # open                 1

  LV Size                768.00 MB

  Current LE             24

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     256

  Block device           253:1

  

=========================================================

[root@download1 ~]# lvextend -l +2559 /dev/VolGroup00/   勿回车

LogVol00  LogVol01 

注意!不知道选哪个,通过以下命令获取可以得到

[root@download1 ~]# df -hl

文件系统              容量  已用 可用 已用挂载点

/dev/mapper/VolGroup00-LogVol00

                       19G   12G  6.4G  64% /

/dev/sda1              99M   20M   75M  21% /boot

tmpfs                 2.0G     0  2.0G   0% /dev/shm

=========================================================

/dev/VolGroup00/LogVol00增加容量

[root@download1 ~]# lvextend -l +2559 /dev/VolGroup00/LogVol00

  /dev/hdc: open failed: 找不到介质

  Extending logical volume LogVol00 to 99.09 GB

  Insufficient free space: 2559 extents needed, but only 1280 available

 

[root@download1 ~]# lvextend -l +1280 /dev/VolGroup00/LogVol00

  /dev/hdc: open failed: 找不到介质

  Extending logical volume LogVol00 to 59.12 GB

  Logical volume LogVol00 successfully resized

 

 resize2fs 调整文件系统大小

[root@download1 ~]# resize2fs /dev/mapper/VolGroup00-LogVol00

resize2fs 1.39 (29-May-2006)

Filesystem at /dev/mapper/VolGroup00-LogVol00 is mounted on /; on-line resizing required

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

[root@download1 ~]# df -hl

文件系统              容量  已用 可用 已用挂载点

/dev/mapper/VolGroup00-LogVol00

                       58G   12G   44G  21%    /

/dev/sda1              99M   20M   75M  21% /boot

tmpfs                 2.0G     0  2.0G   0% /dev/shm





    本文转自viong 51CTO博客,原文链接:http://blog.51cto.com/viong/1050788,如需转载请自行联系原作者





相关文章
|
4月前
|
Linux 虚拟化 iOS开发
Rocky Linux 10 x86_64 OVF (sysin) - VMware 虚拟机模板
Rocky Linux 10 x86_64 OVF (sysin) - VMware 虚拟机模板
263 35
Rocky Linux 10 x86_64 OVF (sysin) - VMware 虚拟机模板
|
4月前
|
Linux 虚拟化 iOS开发
Rocky Linux 10 aarch64 OVF (sysin) - Apple silicon VMware 虚拟机模板
Rocky Linux 10 aarch64 OVF (sysin) - Apple silicon VMware 虚拟机模板
171 34
Rocky Linux 10 aarch64 OVF (sysin) - Apple silicon VMware 虚拟机模板
|
5月前
|
存储 监控 Linux
Linux: 检测磁盘坏块 你得会吧!
Linux: 检测磁盘坏块 你得会吧!
325 19
Linux: 检测磁盘坏块 你得会吧!
|
4月前
|
Linux
在线对Linux进行磁盘扩容的技术指南。
综上所述,Linux磁盘扩容的过程,重要的不仅是技术,更是对每一步骤的深刻理解和投入的爱心。只要手握正确的工具,我们不仅能满足"孩子"的成长需求,还能享受其中的乐趣和成就。
270 10
|
5月前
|
监控 固态存储 Linux
如何判断Linux磁盘是SSD还是HDD?
总的来说,判断磁盘是SSD还是HDD并不复杂,只需要使用正确的命令和方法,就可以轻松得到结果。希望这些信息对你有所帮助,如果你还有其他问题,欢迎随时提问。
483 15
|
11月前
|
数据库 虚拟化 Windows
虚拟机数据恢复—XenServer虚拟机磁盘文件丢失的数据恢复案例
虚拟机数据恢复环境: 某品牌服务器通过同品牌某型号的RAID卡,将4块STAT硬盘为一组RAID10阵列。上层部署XenServer虚拟化平台,虚拟机安装Windows Server系统,每台虚拟机有两个虚拟机磁盘(系统盘 + 数据盘),虚拟机作为Web服务器使用。 虚拟机故障&分析: 机房异常断电导致服务器中一台VPS(XenServer虚拟机)不可用,虚拟磁盘文件丢失。
|
6月前
|
Linux
Linux系统ext4磁盘扩容实践指南
这个过程就像是给你的房子建一个新的储物间。你需要先找到空地(创建新的分区),然后建造储物间(格式化为ext4文件系统),最后将储物间添加到你的房子中(将新的分区添加到文件系统中)。完成这些步骤后,你就有了一个更大的储物空间。
546 10
|
7月前
|
存储 数据挖掘 虚拟化
vsan数据恢复—vsan缓存盘故障导致虚拟机磁盘文件丢失的数据恢复案例
VMware vsan架构采用2+1模式。每台设备只有一个磁盘组(7+1),缓存盘的大小为240GB,容量盘的大小为1.2TB。 由于其中一台主机(0号组设备)的缓存盘出现故障,导致VMware虚拟化环境中搭建的2台虚拟机的磁盘文件(vmdk)丢失。
|
8月前
|
Ubuntu Linux 网络安全
Linux磁盘挂接教程
Linux磁盘挂接教程
161 14
|
11月前
|
Ubuntu Linux 虚拟化
Linux虚拟机网络配置
【10月更文挑战第25天】在 Linux 虚拟机中,网络配置是实现虚拟机与外部网络通信的关键步骤。本文介绍了四种常见的网络配置方式:桥接模式、NAT 模式、仅主机模式和自定义网络模式,每种模式都详细说明了其原理和配置步骤。通过这些配置,用户可以根据实际需求选择合适的网络模式,确保虚拟机能够顺利地进行网络通信。
680 1

热门文章

最新文章