LVM扩容根分区
LVM扩容根分区
原/目录有100G,现将根目录增加至150G
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | [root@proftp ~] # df -Th 文件系统 类型 容量 已用 可用 已用% 挂载点 /dev/mapper/centos-root xfs 92G 3.0G 89G 4% / devtmpfs devtmpfs 3.9G 0 3.9G 0% /dev tmpfs tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs tmpfs 3.9G 25M 3.8G 1% /run tmpfs tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/vda1 xfs 1014M 143M 872M 15% /boot tmpfs tmpfs 781M 0 781M 0% /run/user/0 [root@proftp ~] # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT fd0 2:0 1 4K 0 disk sr0 11:0 1 1024M 0 rom vda 252:0 0 150G 0 disk ├─vda1 252:1 0 1G 0 part /boot └─vda2 252:2 0 99G 0 part ├─centos-root 253:0 0 91.1G 0 lvm / └─centos-swap 253:1 0 7.9G 0 lvm [SWAP] [root@proftp ~] # fdisk /dev/vda 欢迎使用 fdisk (util-linux 2.23.2)。 更改将停留在内存中,直到您决定将更改写入磁盘。 使用写入命令前请三思。 命令(输入 m 获取帮助):n Partition type : p primary (2 primary, 0 extended, 2 free ) e extended Select (default p): Using default response p 分区号 (3,4,默认 3): 起始 扇区 (209715200-314572799,默认为 209715200): 将使用默认值 209715200 Last 扇区, +扇区 or +size{K,M,G} (209715200-314572799,默认为 314572799): 将使用默认值 314572799 分区 3 已设置为 Linux 类型,大小设为 50 GiB 命令(输入 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@proftp ~] # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT fd0 2:0 1 4K 0 disk sr0 11:0 1 1024M 0 rom vda 252:0 0 150G 0 disk ├─vda1 252:1 0 1G 0 part /boot └─vda2 252:2 0 99G 0 part ├─centos-root 253:0 0 91.1G 0 lvm / └─centos-swap 253:1 0 7.9G 0 lvm [SWAP] [root@proftp ~] # partprobe /dev/vda [root@proftp ~] # [root@proftp ~] # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT fd0 2:0 1 4K 0 disk sr0 11:0 1 1024M 0 rom vda 252:0 0 150G 0 disk ├─vda1 252:1 0 1G 0 part /boot ├─vda2 252:2 0 99G 0 part │ ├─centos-root 253:0 0 91.1G 0 lvm / │ └─centos-swap 253:1 0 7.9G 0 lvm [SWAP] └─vda3 252:3 0 50G 0 part [root@proftp ~] # [root@proftp ~] # vgs VG #PV #LV #SN Attr VSize VFree centos 1 2 0 wz--n- <99.00g 4.00m [root@proftp ~] # vgextend centos /dev/vda3 Physical volume "/dev/vda3" successfully created. Volume group "centos" successfully extended [root@proftp ~] # lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert root centos -wi-ao---- <91.12g swap centos -wi-ao---- <7.88g [root@proftp ~] # [root@proftp ~] # lvextend -l +100%FREE /dev/centos/root Size of logical volume centos /root changed from <91.12 GiB (23326 extents) to <141.12 GiB (36126 extents). Logical volume centos /root successfully resized. [root@proftp ~] # [root@proftp ~] # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT fd0 2:0 1 4K 0 disk sr0 11:0 1 1024M 0 rom vda 252:0 0 150G 0 disk ├─vda1 252:1 0 1G 0 part /boot ├─vda2 252:2 0 99G 0 part │ ├─centos-root 253:0 0 141.1G 0 lvm / │ └─centos-swap 253:1 0 7.9G 0 lvm [SWAP] └─vda3 252:3 0 50G 0 part └─centos-root 253:0 0 141.1G 0 lvm / [root@proftp ~] # [root@proftp ~] # xfs_growfs /dev/centos/root meta-data= /dev/mapper/centos-root isize=512 agcount=4, agsize=5971456 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0 spinodes=0 data = bsize=4096 blocks=23885824, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal bsize=4096 blocks=11663, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 data blocks changed from 23885824 to 36993024 [root@proftp ~] # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT fd0 2:0 1 4K 0 disk sr0 11:0 1 1024M 0 rom vda 252:0 0 150G 0 disk ├─vda1 252:1 0 1G 0 part /boot ├─vda2 252:2 0 99G 0 part │ ├─centos-root 253:0 0 141.1G 0 lvm / │ └─centos-swap 253:1 0 7.9G 0 lvm [SWAP] └─vda3 252:3 0 50G 0 part └─centos-root 253:0 0 141.1G 0 lvm / [root@proftp ~] # df -Th 文件系统 类型 容量 已用 可用 已用% 挂载点 /dev/mapper/centos-root xfs 142G 3.0G 139G 3% / devtmpfs devtmpfs 3.9G 0 3.9G 0% /dev tmpfs tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs tmpfs 3.9G 25M 3.8G 1% /run tmpfs tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/vda1 xfs 1014M 143M 872M 15% /boot tmpfs tmpfs 781M 0 781M 0% /run/user/0 [root@proftp ~] # |
本文作者:香菜哥哥
本文链接:https://www.cnblogs.com/yizhipanghu/p/14333501.html
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
分类:
标签:
,
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步