linux系统中扩容逻辑卷

1、卸载逻辑卷的挂载

[root@linuxprobe dev]# df -h  ## 查看挂载
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root         18G  2.9G   15G  17% /
devtmpfs                     985M     0  985M   0% /dev
tmpfs                        994M   80K  994M   1% /dev/shm
tmpfs                        994M  8.8M  986M   1% /run
tmpfs                        994M     0  994M   0% /sys/fs/cgroup
/dev/sda1                    497M  119M  379M  24% /boot
/dev/sr0                     3.5G  3.5G     0 100% /run/media/root/RHEL-7.0 Server.x86_64
/dev/mapper/vgtest1-lvtest1  140M  1.6M  128M   2% /linuxprobe
[root@linuxprobe dev]# umount /linuxprobe/  ## 卸载
[root@linuxprobe dev]# df -h  ## 查看挂载
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root   18G  2.9G   15G  17% /
devtmpfs               985M     0  985M   0% /dev
tmpfs                  994M   80K  994M   1% /dev/shm
tmpfs                  994M  8.8M  986M   1% /run
tmpfs                  994M     0  994M   0% /sys/fs/cgroup
/dev/sda1              497M  119M  379M  24% /boot
/dev/sr0               3.5G  3.5G     0 100% /run/media/root/RHEL-7.0 Server.x86_64

2、扩容逻辑卷

[root@linuxprobe dev]# lvextend -L 300M /dev/vgtest1/lvtest1
  Extending logical volume lvtest1 to 300.00 MiB
  Logical volume lvtest1 successfully resized

3、检查硬盘完整性,并重置磁盘容量

[root@linuxprobe dev]# e2fsck -f /dev/vgtest1/lvtest1  ## 检查完整性
e2fsck 1.42.9 (28-Dec-2013)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/vgtest1/lvtest1: 11/38000 files (0.0% non-contiguous), 10453/151552 blocks
[root@linuxprobe dev]# resize2fs /dev/vgtest1/lvtest1  ## 重置磁盘容量
resize2fs 1.42.9 (28-Dec-2013)
Resizing the filesystem on /dev/vgtest1/lvtest1 to 307200 (1k) blocks.
The filesystem on /dev/vgtest1/lvtest1 is now 307200 blocks long.

4、重新挂载硬盘设备

[root@linuxprobe dev]# cat /etc/fstab  ## 查看开机自启配置文件

#
# /etc/fstab
# Created by anaconda on Wed Oct 28 20:19:08 2020
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/rhel-root   /                       xfs     defaults        1 1
UUID=2f2c5a2f-df13-4b36-99c3-9edd1b976d40 /boot                   xfs     defaults        1 2
/dev/mapper/rhel-swap   swap                    swap    defaults        0 0
/dev/vgtest1/lvtest1    /linuxprobe     ext4    defaults        0       0
[root@linuxprobe dev]# df -h  ## 查看挂载情况
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root   18G  2.9G   15G  17% /
devtmpfs               985M     0  985M   0% /dev
tmpfs                  994M   80K  994M   1% /dev/shm
tmpfs                  994M  8.8M  986M   1% /run
tmpfs                  994M     0  994M   0% /sys/fs/cgroup
/dev/sda1              497M  119M  379M  24% /boot
/dev/sr0               3.5G  3.5G     0 100% /run/media/root/RHEL-7.0 Server.x86_64
[root@linuxprobe dev]# mount -a  ## 重新挂载
[root@linuxprobe dev]# df -h  ## 查看挂载
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root         18G  2.9G   15G  17% /
devtmpfs                     985M     0  985M   0% /dev
tmpfs                        994M   80K  994M   1% /dev/shm
tmpfs                        994M  8.8M  986M   1% /run
tmpfs                        994M     0  994M   0% /sys/fs/cgroup
/dev/sda1                    497M  119M  379M  24% /boot
/dev/sr0                     3.5G  3.5G     0 100% /run/media/root/RHEL-7.0 Server.x86_64
/dev/mapper/vgtest1-lvtest1  287M  2.1M  266M   1% /linuxprobe
原文地址:https://www.cnblogs.com/liujiaxin2018/p/13897746.html