1. 问题场景

分区失败重启虚拟机,导致系统进入 dracut 页面开机显示
在这里插入图片描述
直接回车,等待重启失败页面
在这里插入图片描述
在这里插入图片描述
自动进入dracut 模式(救援)。

2. 临时解决进入系统

查了一下:如果出现 “dracut提示进入 dracut 模式或者 dracut emergency shell,这可能表示系统无法正常引导或加载文件系统

shell命令行执行以下:

dracut:/# lvm vgscan
dracut:/# lvm vgchange -ay 
dracut:/# exit

这种方式可以临时解决进入系统远程SSH 也是正常的)。但是重启之后依然会进入dracut模式

3. 重新操作分区扩容

由于是分区操作可能没有操作完成就重启服务器,导致分区异常启动失败了,那现在可正常进入服务器了,就重新检查分区

在这里插入图片描述
磁盘占用情况可以看到root 目录还是 50G的大小,这是之前创建虚拟机默认大小

在这里插入图片描述
可以看到磁盘总的容量已经扩容到500G了,原来是 200G;

看下当前磁盘分区情况:fdisk -l
在这里插入图片描述
接着使用 fdisk 修改磁盘分区fdisk /dev/sda
在这里插入图片描述
上面截图就是新增分区操作

# 创建分区命令
fdisk /dev/sda输入p
新增分区输入:n
回车(默认为主分区primary)
分区号、起始扇区、结束扇区都默认(回车)
设置分区格式 直接输入t
分区号默认(回车)
Hex 代码为 8e (8e代表Linux LVM分区类型)
w (写入分区表等待分区完成

这里虽然提示设备资源忙,忽略这个错误,继续执行 命令partprobe

然后参考VMWare ESXI 给虚拟机硬盘扩容记录(CentOS7) 进行分区合并

配置分区成功后,在合并分区时:vgdisplay -v 没有显示新增的分区 sda3
在这里插入图片描述

[root@aikg ~]# lvm  
lvm> 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.
lvm> vgdisplay -v
  --- Volume group ---
  VG Name               centos
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <199.00 GiB
  PE Size               4.00 MiB
  Total PE              50943
  Alloc PE / Size       50942 / 198.99 GiB
  Free  PE / Size       1 / 4.00 MiB
  VG UUID               7EFuUv-WWlG-kFEM-XDWJ-niAh-iP8A-VxFGya
   
  --- Logical volume ---
  LV Path                /dev/centos/swap
  LV Name                swap
  VG Name                centos
  LV UUID                wpAfVQ-XL8j-UExO-D6dL-eud3-fLiR-sLejTp
  LV Write Access        read/write
  LV Creation host, time data-source1, 2021-03-24 14:20:04 +0800
  LV Status              available
  # open                 2
  LV Size                <7.88 GiB
  Current LE             2016
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0
   
  --- Logical volume ---
  LV Path                /dev/centos/home
  LV Name                home
  VG Name                centos
  LV UUID                KeIjj6-JOO1-aAb1-7eG8-egkk-XCGu-u6FcKw
  LV Write Access        read/write
  LV Creation host, time data-source1, 2021-03-24 14:20:04 +0800
  LV Status              available
  # open                 1
  LV Size                <141.12 GiB
  Current LE             36126
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1
   
  --- Logical volume ---
  LV Path                /dev/centos/root
  LV Name                root
  VG Name                centos
  LV UUID                0038QM-K8CI-KKFz-0mdD-HyS4-S34U-xFjHL0
  LV Write Access        read/write
  LV Creation host, time data-source1, 2021-03-24 14:20:05 +0800
  LV Status              available
  # open                 1
  LV Size                50.00 GiB
  Current LE             12800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:2
   
  --- Physical volumes ---
  PV Name               /dev/sda2     
  PV UUID               wwBC0l-n45J-WPZg-frd7-8q5b-ELYx-ONQNtg
  PV Status             allocatable
  Total PE / Free PE    50943 / 1
   
lvm> 
lvm> vgdisplay -v
  --- Volume group ---
  VG Name               centos
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <199.00 GiB
  PE Size               4.00 MiB
  Total PE              50943
  Alloc PE / Size       50942 / 198.99 GiB
  Free  PE / Size       1 / 4.00 MiB
  VG UUID               7EFuUv-WWlG-kFEM-XDWJ-niAh-iP8A-VxFGya
   
  --- Logical volume ---
  LV Path                /dev/centos/swap
  LV Name                swap
  VG Name                centos
  LV UUID                wpAfVQ-XL8j-UExO-D6dL-eud3-fLiR-sLejTp
  LV Write Access        read/write
  LV Creation host, time data-source1, 2021-03-24 14:20:04 +0800
  LV Status              available
  # open                 2
  LV Size                <7.88 GiB
  Current LE             2016
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0
   
  --- Logical volume ---
  LV Path                /dev/centos/home
  LV Name                home
  VG Name                centos
  LV UUID                KeIjj6-JOO1-aAb1-7eG8-egkk-XCGu-u6FcKw
  LV Write Access        read/write
  LV Creation host, time data-source1, 2021-03-24 14:20:04 +0800
  LV Status              available
  # open                 1
  LV Size                <141.12 GiB
  Current LE             36126
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1
   
  --- Logical volume ---
  LV Path                /dev/centos/root
  LV Name                root
  VG Name                centos
  LV UUID                0038QM-K8CI-KKFz-0mdD-HyS4-S34U-xFjHL0
  LV Write Access        read/write
  LV Creation host, time data-source1, 2021-03-24 14:20:05 +0800
  LV Status              available
  # open                 1
  LV Size                50.00 GiB
  Current LE             12800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:2
   
  --- Physical volumes ---
  PV Name               /dev/sda2     
  PV UUID               wwBC0l-n45J-WPZg-frd7-8q5b-ELYx-ONQNtg
  PV Status             allocatable
  Total PE / Free PE    50943 / 1
   
lvm> pvcreate /dev/sda3
  Physical volume "/dev/sda3" successfully created.
lvm> 
lvm> vgextend centos /dev/sda3
  Volume group "centos" successfully extended
lvm> 
lvm> vgdisplay -v             
  --- Volume group ---
  VG Name               centos
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               498.99 GiB
  PE Size               4.00 MiB
  Total PE              127742
  Alloc PE / Size       50942 / 198.99 GiB
  Free  PE / Size       76800 / 300.00 GiB
  VG UUID               7EFuUv-WWlG-kFEM-XDWJ-niAh-iP8A-VxFGya
   
  --- Logical volume ---
  LV Path                /dev/centos/swap
  LV Name                swap
  VG Name                centos
  LV UUID                wpAfVQ-XL8j-UExO-D6dL-eud3-fLiR-sLejTp
  LV Write Access        read/write
  LV Creation host, time data-source1, 2021-03-24 14:20:04 +0800
  LV Status              available
  # open                 2
  LV Size                <7.88 GiB
  Current LE             2016
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0
   
  --- Logical volume ---
  LV Path                /dev/centos/home
  LV Name                home
  VG Name                centos
  LV UUID                KeIjj6-JOO1-aAb1-7eG8-egkk-XCGu-u6FcKw
  LV Write Access        read/write
  LV Creation host, time data-source1, 2021-03-24 14:20:04 +0800
  LV Status              available
  # open                 1
  LV Size                <141.12 GiB
  Current LE             36126
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1
   
  --- Logical volume ---
  LV Path                /dev/centos/root
  LV Name                root
  VG Name                centos
  LV UUID                0038QM-K8CI-KKFz-0mdD-HyS4-S34U-xFjHL0
  LV Write Access        read/write
  LV Creation host, time data-source1, 2021-03-24 14:20:05 +0800
  LV Status              available
  # open                 1
  LV Size                50.00 GiB
  Current LE             12800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:2
   
  --- Physical volumes ---
  PV Name               /dev/sda2     
  PV UUID               wwBC0l-n45J-WPZg-frd7-8q5b-ELYx-ONQNtg
  PV Status             allocatable
  Total PE / Free PE    50943 / 1
   
  PV Name               /dev/sda3     
  PV UUID               Vb7c4n-aqeD-Kwr5-gkN6-0Zoa-QZVW-gvlmfo
  PV Status             allocatable
  Total PE / Free PE    76799 / 76799
   
lvm> 

然后再次操作,新建 pv 后,才显示 sda3 这个物理卷;接着操作扩容根目录
在这里插入图片描述
在这里插入图片描述
正常扩容完毕。

接着重启服务器发现可以正常启动了。

原文地址:https://blog.csdn.net/linmengmeng_1314/article/details/133298874

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任

如若转载,请注明出处:http://www.7code.cn/show_19309.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱suwngjj01@126.com进行投诉反馈,一经查实,立即删除

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注