───────────────────────────────────────────────────────┐
│ • MobaXterm 11.1 • │
│ (SSH client, X-server and networking tools) │
│ │
│ ➤ SSH session to root@gg12193.synology.me │
│ • 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
[root@localhost ~]#
[root@localhost ~]# 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 字节
查看磁盘容量
[root@localhost ~]# 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的大小
[root@localhost ~]# 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 中有新邮件
[root@localhost ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 3 0 wz--n- <99.00g 4.00m
扩展vg,使用vgextend命令
[root@localhost ~]# vgextend centos /dev/sda3
Volume group "centos" successfully extended
您在 /var/spool/mail/root 中有新邮件
[root@localhost ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 2 3 0 wz--n- 198.99g 100.00g
查看lv大小
[root@localhost ~]# 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命令
[root@localhost ~]# 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命令
[root@localhost ~]# 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.
[root@localhost ~]# 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 使系统重新读取大小
[root@localhost ~]# 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 中有新邮件
[root@localhost ~]# 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
[root@localhost ~]# 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
[root@localhost ~]# 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 中有新邮件
[root@localhost ~]# 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
[root@localhost ~]#