当前位置:网站首页>LVM操作
LVM操作
2022-07-02 07:35:00 【gaojingsong】
───────────────────────────────────────────────────────┐
│ • MobaXterm 11.1 • │
│ (SSH client, X-server and networking tools) │
│ │
│ * SSH session to [email protected] │
│ • SSH compression : │
│ • SSH-browser : │
│ • X11-forwarding : (remote display is forwarded through SSH) │
│ • DISPLAY : (automatically set on remote server) │
│ │
│ * For more info, ctrl+click on help or visit our website │
└────────────────────────────────────────────────────────────────────┘
Last login: Wed Jun 28 19:26:00 2022 from 123.189.233.143
[[email protected] ~]#
[[email protected] ~]# fdisk -l
磁盘大小为214G,但是挂载可用分区只有100G
磁盘 /dev/sda:214.7 GB, 214748364800 字节,419430400 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x000d0ed9
设备 Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 209715199 103808000 8e Linux LVM
/dev/sda3 209715200 419430399 104857600 8e Linux LVM
磁盘 /dev/mapper/centos-root:53.7 GB, 53687091200 字节,104857600 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘 /dev/mapper/centos-swap:2147 MB, 2147483648 字节,4194304 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘 /dev/mapper/centos-home:50.5 GB, 50457477120 字节,98549760 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
查看磁盘容量
[[email protected] ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 4.0K 7.8G 1% /dev/shm
tmpfs 7.8G 50M 7.8G 1% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/mapper/centos-root 50G 50G 349M 100% /
/dev/sda1 1014M 245M 770M 25% /boot
/dev/mapper/centos-home 47G 2.4G 45G 6% /home
tmpfs 1.6G 0 1.6G 0% /run/user/0
创建pv(给刚刚新建的分区 /dev/sda3),然后把pv加入vg中,相当于扩充vg的大小
[[email protected] ~]# pvcreate /dev/sda3
WARNING: ext4 signature detected on /dev/sda3 at offset 1080. Wipe it? [y/n]: y
Wiping ext4 signature on /dev/sda3.
Physical volume "/dev/sda3" successfully created.
您在 /var/spool/mail/root 中有新邮件
[[email protected]calhost ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 3 0 wz--n- <99.00g 4.00m
扩展vg,使用vgextend命令
[[email protected] ~]# vgextend centos /dev/sda3
Volume group "centos" successfully extended
您在 /var/spool/mail/root 中有新邮件
[[email protected] ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 2 3 0 wz--n- 198.99g 100.00g
查看lv大小
[[email protected] ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home centos -wi-ao---- 46.99g
root centos -wi-ao---- 50.00g
swap centos -wi-ao---- 2.00g
扩展lv,使用lvextend命令
[[email protected] ~]#lvextend -L +40G /dev/mapper/centos-root
Size of logical volume centos/root changed from 50.00 GiB (12800 extents) to 90.00 GiB (23040 extents).
Logical volume centos/root successfully resized.
您在 /var/spool/mail/root 中有新邮件
扩展lv,使用lvextend命令
[[email protected] ~]# lvextend -L +20G /dev/mapper/centos-home
Size of logical volume centos/home changed from 46.99 GiB (12030 extents) to 66.99 GiB (17150 extents).
Logical volume centos/home successfully resized.
[[email protected] ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home centos -wi-ao---- 66.99g
root centos -wi-ao---- 90.00g
swap centos -wi-ao---- 2.00g
发现centos-root空间没有变化,使用命令xfs_growfs 使系统重新读取大小
[[email protected] ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 4.0K 7.8G 1% /dev/shm
tmpfs 7.8G 50M 7.8G 1% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/mapper/centos-root 50G 50G 349M 100% /
/dev/sda1 1014M 245M 770M 25% /boot
/dev/mapper/centos-home 47G 2.4G 45G 6% /home
tmpfs 1.6G 0 1.6G 0% /run/user/0
您在 /var/spool/mail/root 中有新邮件
[[email protected] ~]# xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=3276800 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=13107200, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=6400, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 13107200 to 23592960
[[email protected] ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 4.0K 7.8G 1% /dev/shm
tmpfs 7.8G 50M 7.8G 1% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/mapper/centos-root 90G 50G 41G 56% /
/dev/sda1 1014M 245M 770M 25% /boot
/dev/mapper/centos-home 47G 2.4G 45G 6% /home
tmpfs 1.6G 0 1.6G 0% /run/user/0
[[email protected] ~]# xfs_growfs /dev/mapper/centos-home
meta-data=/dev/mapper/centos-home isize=512 agcount=4, agsize=3079680 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=12318720, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=6015, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 12318720 to 17561600
您在 /var/spool/mail/root 中有新邮件
[[email protected] ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 4.0K 7.8G 1% /dev/shm
tmpfs 7.8G 50M 7.8G 1% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/mapper/centos-root 90G 50G 41G 56% /
/dev/sda1 1014M 245M 770M 25% /boot
/dev/mapper/centos-home 67G 2.4G 65G 4% /home
tmpfs 1.6G 0 1.6G 0% /run/user/0
[[email protected] ~]#
边栏推荐
- [paid promotion] collection of frequently asked questions, recommended list FAQ
- 二叉树专题--P1030 [NOIP2001 普及组] 求先序排列
- 一招快速实现自定义快应用titlebar
- TIPC Getting Started6
- UWA report uses tips. Did you get it? (the fourth bullet)
- 【深入浅出玩转FPGA学习5-----复位设计】
- 二叉树专题--AcWing 3384. 二叉树遍历(已知先序遍历 边建树 边输出中序遍历)
- js数组常用方法
- PCL eigen introduction and simple use
- 【深入浅出玩转FPGA学习2----设计技巧(基本语法)】
猜你喜欢
JVM之垃圾回收器
【快应用】text组件里的文字很多,旁边的div样式会被拉伸如何解决
Shell programming 01_ Shell foundation
HDU1228 A + B(map映射)
Matlab processing of distance measurement of experimental electron microscope
How to use ide to automatically sign and debug Hongmeng application
[AGC] build service 3 - authentication service example
2. Hacking lab script off [detailed writeup]
集成学习概览
全网显示 IP 归属地,是怎么实现的?
随机推荐
Special topic of binary tree -- acwing 3384 Binary tree traversal (known preorder traversal, while building a tree, while outputting middle order traversal)
Point cloud projection picture
From Read and save in bag file Jpg pictures and PCD point cloud
如何用list组件实现tabbar标题栏
nodejs+express+mysql简单博客搭建
【AI应用】海康威视iVMS-4200软件安装
二叉树专题--【深基16.例7】普通二叉树(简化版)(multiset 求前驱 后继 哨兵法)
MongoDB 学习整理(条件操作符,$type 操作符,limit()方法,skip() 方法 和 sort() 方法)
二叉树专题--洛谷 P1229 遍历问题(乘法原理 已知前、后序遍历求中序遍历个数)
[play with FPGA learning 4 in simple terms ----- talk about state machine design]
Static variables in static function
TIPC Getting Started6
VSCode工具使用
全网显示 IP 归属地,是怎么实现的?
二叉树专题--AcWing 19. 二叉树的下一个节点(找树中节点的后继)
static 函数中的静态变量
【深入浅出玩转FPGA学习3-----基本语法】
正则及常用公式
PCL projection point cloud
使用华为性能管理服务,按需配置采样率