1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 虚拟机服务器磁盘扩容步骤 vmware ESXi 虚拟机扩容磁盘空间

虚拟机服务器磁盘扩容步骤 vmware ESXi 虚拟机扩容磁盘空间

时间:2019-01-18 20:19:11

相关推荐

虚拟机服务器磁盘扩容步骤 vmware ESXi 虚拟机扩容磁盘空间

主要步骤:

vmware 宿主机编辑虚拟机配置扩容服务器并启动虚拟机

fdisk新建分区

pvcreate新建物理卷

vgextend扩展卷组

lvextend扩容逻辑卷

xfs_growfs扩容文件系统

1. fdisk 查看磁盘信息

[root@node01 html]# fdisk -l

磁盘 /dev/sda:107.4 GB, 107374182400 字节,209715200 个扇区

Units = 扇区 of 1 * 512 = 512 bytes

扇区大小(逻辑/物理):512 字节 / 512 字节

I/O 大小(最小/最佳):512 字节 / 512 字节

磁盘标签类型:dos

磁盘标识符:0x000b41c1

设备 Boot Start End Blocks Id System

/dev/sda1 * 2048 2099199 1048576 83 Linux

/dev/sda2 2099200 33554431 15727616 8e Linux LVM

磁盘 /dev/mapper/centos_centos7-root:14.4 GB, 14382268416 字节,28090368 个扇区

Units = 扇区 of 1 * 512 = 512 bytes

扇区大小(逻辑/物理):512 字节 / 512 字节

I/O 大小(最小/最佳):512 字节 / 512 字节

磁盘 /dev/mapper/centos_centos7-swap:1719 MB, 1719664640 字节,3358720 个扇区

Units = 扇区 of 1 * 512 = 512 bytes

扇区大小(逻辑/物理):512 字节 / 512 字节

I/O 大小(最小/最佳):512 字节 / 512 字节

2. 查看分区

[root@node01 html]# df -h

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

/dev/mapper/centos_centos7-root 14G 12G 1.8G 88% /

devtmpfs 909M 0 909M 0% /dev

tmpfs 920M 0 920M 0% /dev/shm

tmpfs 920M 8.7M 912M 1% /run

tmpfs 920M 0 920M 0% /sys/fs/cgroup

/dev/sda1 1014M 143M 872M 15% /boot

tmpfs 184M 0 184M 0% /run/user/0

tmpfs 184M 0 184M 0% /run/user/1000

[root@node01 html]# du -sh

11G.

3. fdisk新建分区

[root@node01 html]# fdisk /dev/sda

欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。

使用写入命令前请三思。

命令(输入 m 获取帮助):m

命令操作

a toggle a bootable flag

b edit bsd disklabel

c toggle the dos compatibility flag

d delete a partition

g create a new empty GPT partition table

G create an IRIX (SGI) partition table

l list known partition types

m print this menu

n add a new partition

o create a new empty DOS partition table

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)

命令(输入 m 获取帮助):p

磁盘 /dev/sda:107.4 GB, 107374182400 字节,209715200 个扇区

Units = 扇区 of 1 * 512 = 512 bytes

扇区大小(逻辑/物理):512 字节 / 512 字节

I/O 大小(最小/最佳):512 字节 / 512 字节

磁盘标签类型:dos

磁盘标识符:0x000b41c1

设备 Boot Start End Blocks Id System

/dev/sda1 * 2048 2099199 1048576 83 Linux

/dev/sda2 2099200 33554431 15727616 8e Linux LVM

命令(输入 m 获取帮助):n

Partition type:

p primary (2 primary, 0 extended, 2 free)

e extended

Select (default p): p

分区号 (3,4,默认 3):

起始 扇区 (33554432-209715199,默认为 33554432):

将使用默认值 33554432

Last 扇区, +扇区 or +size{K,M,G} (33554432-209715199,默认为 209715199):

将使用默认值 209715199

分区 3 已设置为 Linux 类型,大小设为 84 GiB

命令(输入 m 获取帮助):p

磁盘 /dev/sda:107.4 GB, 107374182400 字节,209715200 个扇区

Units = 扇区 of 1 * 512 = 512 bytes

扇区大小(逻辑/物理):512 字节 / 512 字节

I/O 大小(最小/最佳):512 字节 / 512 字节

磁盘标签类型:dos

磁盘标识符:0x000b41c1

设备 Boot Start End Blocks Id System

/dev/sda1 * 2048 2099199 1048576 83 Linux

/dev/sda2 2099200 33554431 15727616 8e Linux LVM

/dev/sda3 33554432 209715199 88080384 83 Linux

命令(输入 m 获取帮助):t

分区号 (1-3,默认 3):

Hex 代码(输入 L 列出所有代码):8e

已将分区“Linux”的类型更改为“Linux LVM”

命令(输入 m 获取帮助):p

磁盘 /dev/sda:107.4 GB, 107374182400 字节,209715200 个扇区

Units = 扇区 of 1 * 512 = 512 bytes

扇区大小(逻辑/物理):512 字节 / 512 字节

I/O 大小(最小/最佳):512 字节 / 512 字节

磁盘标签类型:dos

磁盘标识符:0x000b41c1

设备 Boot Start End Blocks Id System

/dev/sda1 * 2048 2099199 1048576 83 Linux

/dev/sda2 2099200 33554431 15727616 8e Linux LVM

/dev/sda3 33554432 209715199 88080384 8e Linux LVM

命令(输入 m 获取帮助):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 or after you run partprobe(8) or kpartx(8)

正在同步磁盘。

[root@node01 html]# partprobe

[root@node01 html]# fdisk -l

磁盘 /dev/sda:107.4 GB, 107374182400 字节,209715200 个扇区

Units = 扇区 of 1 * 512 = 512 bytes

扇区大小(逻辑/物理):512 字节 / 512 字节

I/O 大小(最小/最佳):512 字节 / 512 字节

磁盘标签类型:dos

磁盘标识符:0x000b41c1

设备 Boot Start End Blocks Id System

/dev/sda1 * 2048 2099199 1048576 83 Linux

/dev/sda2 2099200 33554431 15727616 8e Linux LVM

/dev/sda3 33554432 209715199 88080384 8e Linux LVM

磁盘 /dev/mapper/centos_centos7-root:14.4 GB, 14382268416 字节,28090368 个扇区

Units = 扇区 of 1 * 512 = 512 bytes

扇区大小(逻辑/物理):512 字节 / 512 字节

I/O 大小(最小/最佳):512 字节 / 512 字节

磁盘 /dev/mapper/centos_centos7-swap:1719 MB, 1719664640 字节,3358720 个扇区

Units = 扇区 of 1 * 512 = 512 bytes

扇区大小(逻辑/物理):512 字节 / 512 字节

I/O 大小(最小/最佳):512 字节 / 512 字节

[root@node01 html]# pvscan

PV /dev/sda2 VG centos_centos7 lvm2 [<15.00 GiB / 0 free]

Total: 1 [<15.00 GiB] / in use: 1 [<15.00 GiB] / in no VG: 0 [0 ]

[root@node01 html]# pvdisplay

--- Physical volume ---

PV Name /dev/sda2

VG Name centos_centos7

PV Size <15.00 GiB / not usable 3.00 MiB

Allocatable yes (but full)

PE Size 4.00 MiB

Total PE 3839

Free PE 0

Allocated PE 3839

PV UUID fnJGTj-hytV-Gdad-RuRN-95QG-kNzb-woGjOD

4. pvcreate新建物理卷

[root@node01 html]# pvcreate /dev/sda3

Physical volume "/dev/sda3" successfully created.

5. vgextend扩展卷组

[root@node01 html]# vgscan

Reading volume groups from cache.

Found volume group "centos_centos7" using metadata type lvm2

[root@node01 html]# vgextend centos_centos7 /dev/sda3

Volume group "centos_centos7" successfully extended

6. lvextend扩容逻辑卷

[root@node01 html]# lvscan

ACTIVE '/dev/centos_centos7/swap' [1.60 GiB] inherit

ACTIVE '/dev/centos_centos7/root' [13.39 GiB] inherit

[root@node01 html]# ls /dev/mapper/centos_centos7-

centos_centos7-root centos_centos7-swap

[root@node01 html]# ls /dev/mapper/centos_centos7-root

/dev/mapper/centos_centos7-root

[root@node01 html]# lvextend -l +100%FREE /dev/mapper/centos_centos7-root

Size of logical volume centos_centos7/root changed from 13.39 GiB (3429 extents) to 97.39 GiB (24932 extents).

Logical volume centos_centos7/root successfully resized.

7. xfs_growfs扩容文件系统

[root@node01 html]# df -hT

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

/dev/mapper/centos_centos7-root xfs 14G 12G 1.8G 88% /

devtmpfs devtmpfs 909M 0 909M 0% /dev

tmpfs tmpfs 920M 0 920M 0% /dev/shm

tmpfs tmpfs 920M 8.7M 912M 1% /run

tmpfs tmpfs 920M 0 920M 0% /sys/fs/cgroup

/dev/sda1 xfs 1014M 143M 872M 15% /boot

tmpfs tmpfs 184M 0 184M 0% /run/user/0

tmpfs tmpfs 184M 0 184M 0% /run/user/1000

[root@node01 html]# xfs_growfs /dev/mapper/centos_centos7-root

meta-data=/dev/mapper/centos_centos7-root isize=512 agcount=4, agsize=877824 blks

= sectsz=512 attr=2, projid32bit=1

= crc=1 finobt=0 spinodes=0

data = bsize=4096 blocks=3511296, imaxpct=25

= sunit=0 swidth=0 blks

naming =version 2 bsize=4096 ascii-ci=0 ftype=1

log =internal bsize=4096 blocks=2560, version=2

= sectsz=512 sunit=0 blks, lazy-count=1

realtime =none extsz=4096 blocks=0, rtextents=0

data blocks changed from 3511296 to 25530368

8. 查看结果

[root@node01 html]# df -h

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

/dev/mapper/centos_centos7-root 98G 12G 86G 12% /

devtmpfs 909M 0 909M 0% /dev

tmpfs 920M 0 920M 0% /dev/shm

tmpfs 920M 8.7M 912M 1% /run

tmpfs 920M 0 920M 0% /sys/fs/cgroup

/dev/sda1 1014M 143M 872M 15% /boot

tmpfs 184M 0 184M 0% /run/user/0

tmpfs 184M 0 184M 0% /run/user/1000

[root@node01 html]#

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。