zl程序教程

您现在的位置是:首页 >  其它

当前栏目

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

报错 区别 以及 扩容 LVM XFS
2023-09-14 09:08:38 时间

最近老套路硬盘扩容报错

如下报错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