LVM扩容报错以及 xfs_growfs 和 resize2fs 区别

最近老套路硬盘扩容报错

如下报错01)

[root@localhost ~]# pvcreate /dev/sda1
  Device /dev/sda1 not found.
[root@localhost ~]# pvcreate /dev/sda2
  Device /dev/sda2 not found.
[root@localhost ~]# pvcreate /dev/sda3
  Device /dev/sda3 not found.

遇到这个报错是因为没有运行
partprobe

如下报错02)

[root@localhost ~]# vgextend centos /dev/sda1
  Couldn't create temporary archive name.
[root@localhost ~]# vgextend centos /dev/sda2
  Couldn't create temporary archive name.
[root@localhost ~]# vgextend centos /dev/sda3
  Couldn't create temporary archive name.

这个通常是因为root partition 满了(根目录满了),清理一下文件再运行vgextend

如下报错03)

[root@localhost ~]# resize2fs /dev/centos/root
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/centos/root
Couldn't find valid filesystem superblock.

报错原因是centos7 默认使用了xfs文件系统,

应该使用命令

xfs_growfs /dev/centos/root

所以

如果使用xfs文件系统

  • xfs_growfs /dev/root_vg/root

如果使用ext4文件系统

  • resize2fs /dev/root_vg/root
原文地址:https://www.cnblogs.com/faberbeta/p/13152477.html