- 查看初始空间
- 查看分区
扩容:
1、磁盘分区
[root@ecs-7837 ~]# 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 —P表示主分区
Partition number (1-4): 3 ----分区盘序号
First cylinder (1-166440, default 1): 83221 —分区开始序号
Last cylinder, +cylinders or +size{K,M,G} (83221-166440, default 166440): —直接回车
Using default value 166440
Command (m for help): t -----改变分区格式
Partition number (1-4): 3
Hex code (type L to list codes): 8e -----分区为lvm格式
Changed system type of partition 3 to 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: 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.
2.可以看到,新增的40G已划分成/dev/sda3了
这一步完成后最好重启一下服务器。
3、添加新LVM到已有的LVM组
1)pvcreate /dev/sda3
2)查看vg name
命令 vgdisplay
3)将pv加入到vg卷组
[root@ecs-7837 ~]# vgextend centos /dev/sda3
linux磁盘挂载和扩容。
4)查看 Free PE/Size 大小,这里为4863
5)查看根目录的lv名称
6)扩容lv
[root@ecs-7837 ~]# lvextend -l +10239 /dev/VolGroup/lv_root
lvextend指令用于在线扩展逻辑卷的空间大小,而不中断应用程序对逻辑卷的访问。其后有两个选项
选项 说明
-L 指定逻辑卷的大小,单位为“kKmMgGtT”字节,也就是Size
-l 指定逻辑卷的大小,单位为PE数
4、扩容文件系统
以上只是卷扩容了,还要对文件系统实现真正扩容
CentOS 6 下执行:
[root@ecs-7837 ~]# resize2fs /dev/VolGroup/lv_root
CentOS 7 下执行:
[root@ecs-7837 ~]# xfs_growfs /dev/VolGroup/lv_root
5、查看磁盘空间是否扩容
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)