1、ESXI操作界面增大硬盘容量
进入esxi操作界面,打开虚拟机设置,增大磁盘容量。
2、查看磁盘
进入linux系统,输入命令查看磁盘总容量
fdisk -l
3、对空闲磁盘进行分区
fdisk /dev/sda
依次输入
1、n,新建分区
2、指定分区编号,可以直接回车默认
[root@debian ~]# fdisk /dev/sda
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n (新建分区)
Command action
e extended
p primary partition (1-4)
p (主分区)
Partition number (1-4): 3 (选择默认或指定分区号,默认起始位置和结束位置(全盘))
First cylinder (5222-6527, default 5222):
Using default value 5222
Last cylinder, +cylinders or +size{K,M,G} (5222-6527, default 6527):
Using default value 6527
再次输入:
1、t,更改分区类型
2、输入分区编号
3、输入分区类型8e
4、保存并退出
Command (m for help): t (分区类型 -> 8e (LVM))
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): wq (写入分区表,退出)
The 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 or after you run partprobe(8) or kpartx(8)
Syncing disks.
4、重新读取分区
partprobe /dev/sda3
5、创建物理卷
pvcreate /dev/sda3
6、查看磁盘映射名称
vgdisplay
7、扩展逻辑卷
vgextend debian-vg /dev/sda3
8、确认剩余空间
pvs
9、查看SWAP分区路径
cat /etc/fstab
10、关闭SWAP分区
swapoff /dev/mapper/debian--vg-swap_1
11、对SWAP分区扩容
lvresize -L +4G /dev/mapper/debian--vg-swap_1
12、重新加载SWAP分区大小
mkswap /dev/mapper/debian--vg-swap_1
13、重新打开SWAP分区
swapon /dev/mapper/debian--vg-swap_1
14、确认是否成功
free -h