6.4. 修​​​​​​​复​​​​​​​物​​​​​​​理​​​​​​​卷​​​​​​​元​​​​​​​数​​​​​​​据​​​​​​​


如​​​​​​​果​​​​​​​不​​​​​​​小​​​​​​​心​​​​​​​覆​​​​​​​盖​​​​​​​或​​​​​​​者​​​​​​​破​​​​​​​坏​​​​​​​了​​​​​​​卷​​​​​​​组​​​​​​​物​​​​​​​理​​​​​​​卷​​​​​​​元​​​​​​​数​​​​​​​据​​​​​​​区​​​​​​​域​​​​​​​,您​​​​​​​会​​​​​​​看​​​​​​​到​​​​​​​出​​​​​​​错​​​​​​​信​​​​​​​息​​​​​​​显​​​​​​​示​​​​​​​元​​​​​​​数​​​​​​​据​​​​​​​区​​​​​​​域​​​​​​​不​​​​​​​正​​​​​​​确​​​​​​​,或​​​​​​​者​​​​​​​系​​​​​​​统​​​​​​​无​​​​​​​法​​​​​​​使​​​​​​​用​​​​​​​特​​​​​​​定​​​​​​​的​​​​​​​ UUID 找​​​​​​​到​​​​​​​物​​​​​​​理​​​​​​​卷​​​​​​​。​​​​​​​您​​​​​​​可​​​​​​​能​​​​​​​需​​​​​​​要​​​​​​​通​​​​​​​过​​​​​​​在​​​​​​​物​​​​​​​理​​​​​​​卷​​​​​​​的​​​​​​​元​​​​​​​数​​​​​​​据​​​​​​​区​​​​​​​域​​​​​​​写​​​​​​​入​​​​​​​新​​​​​​​的​​​​​​​元​​​​​​​数​​​​​​​据​​​​​​​来​​​​​​​修​​​​​​​复​​​​​​​物​​​​​​​理​​​​​​​卷​​​​​​​数​​​​​​​据​​​​​​​,指​​​​​​​定​​​​​​​相​​​​​​​同​​​​​​​的​​​​​​​ UUID 作​​​​​​​为​​​​​​​丢​​​​​​​失​​​​​​​的​​​​​​​元​​​​​​​数​​​​​​​据​​​​​​​。​​​​​​​

警告

在​​​​​​​正​​​​​​​常​​​​​​​的​​​​​​​ LVM 逻​​​​​​​辑​​​​​​​卷​​​​​​​中​​​​​​​您​​​​​​​应​​​​​​​该​​​​​​​不​​​​​​​会​​​​​​​进​​​​​​​行​​​​​​​这​​​​​​​个​​​​​​​操​​​​​​​作​​​​​​​过​​​​​​​程​​​​​​​。​​​​​​​如​​​​​​​果​​​​​​​您​​​​​​​指​​​​​​​定​​​​​​​了​​​​​​​不​​​​​​​正​​​​​​​确​​​​​​​的​​​​​​​ UUID,您​​​​​​​会​​​​​​​丢​​​​​​​失​​​​​​​您​​​​​​​的​​​​​​​数​​​​​​​据​​​​​​​。​​​​​​​
下​​​​​​​面​​​​​​​的​​​​​​​例​​​​​​​子​​​​​​​显​​​​​​​示​​​​​​​排​​​​​​​序​​​​​​​的​​​​​​​输​​​​​​​出​​​​​​​解​​​​​​​个​​​​​​​,您​​​​​​​可​​​​​​​以​​​​​​​看​​​​​​​到​​​​​​​您​​​​​​​的​​​​​​​元​​​​​​​数​​​​​​​据​​​​​​​是​​​​​​​丢​​​​​​​了​​​​​​​还​​​​​​​是​​​​​​​被​​​​​​​破​​​​​​​坏​​​​​​​了​​​​​​​。​​​​​​​
[root@link-07 backup]# lvs -a -o +devices
  Couldn't find device with uuid 'FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk'.
  Couldn't find all physical volumes for volume group VG.
  Couldn't find device with uuid 'FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk'.
  Couldn't find all physical volumes for volume group VG.
  ...
通​​​​​​​过​​​​​​​查​​​​​​​看​​​​​​​ /etc/lvm/archive 目​​​​​​​录​​​​​​​,您​​​​​​​可​​​​​​​能​​​​​​​可​​​​​​​以​​​​​​​找​​​​​​​到​​​​​​​被​​​​​​​覆​​​​​​​盖​​​​​​​的​​​​​​​物​​​​​​​理​​​​​​​卷​​​​​​​ UUID。​​​​​​​在​​​​​​​文​​​​​​​件​​​​​​​ VolumeGroupName_xxxx.vg 中​​​​​​​查​​​​​​​找​​​​​​​该​​​​​​​卷​​​​​​​组​​​​​​​最​​​​​​​后​​​​​​​的​​​​​​​有​​​​​​​效​​​​​​​归​​​​​​​档​​​​​​​ LVM 元​​​​​​​数​​​​​​​据​​​​​​​。​​​​​​​
另​​​​​​​外​​​​​​​,您​​​​​​​可​​​​​​​以​​​​​​​找​​​​​​​到​​​​​​​失​​​​​​​活​​​​​​​的​​​​​​​卷​​​​​​​并​​​​​​​设​​​​​​​定​​​​​​​ partial-P)选​​​​​​​项​​​​​​​,这​​​​​​​样​​​​​​​您​​​​​​​就​​​​​​​可​​​​​​​以​​​​​​​找​​​​​​​到​​​​​​​丢​​​​​​​失​​​​​​​的​​​​​​​被​​​​​​​破​​​​​​​坏​​​​​​​的​​​​​​​物​​​​​​​理​​​​​​​卷​​​​​​​的​​​​​​​ UUID。​​​​​​​
[root@link-07 backup]# vgchange -an --partial
  Partial mode. Incomplete volume groups will be activated read-only.
  Couldn't find device with uuid 'FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk'.
  Couldn't find device with uuid 'FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk'.
  ...
使​​​​​​​用​​​​​​​ pvcreate 的​​​​​​​ --uuid 和​​​​​​​ --restorefile 选​​​​​​​项​​​​​​​恢​​​​​​​复​​​​​​​物​​​​​​​理​​​​​​​卷​​​​​​​。​​​​​​​下​​​​​​​面​​​​​​​的​​​​​​​例​​​​​​​子​​​​​​​使​​​​​​​用​​​​​​​上​​​​​​​述​​​​​​​ UUID FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk 将​​​​​​​ /dev/sdh1 设​​​​​​​备​​​​​​​标​​​​​​​记​​​​​​​为​​​​​​​物​​​​​​​理​​​​​​​卷​​​​​​​。​​​​​​​这​​​​​​​个​​​​​​​命​​​​​​​令​​​​​​​使​​​​​​​用​​​​​​​ VG_00050.vg 中​​​​​​​的​​​​​​​元​​​​​​​数​​​​​​​据​​​​​​​信​​​​​​​息​​​​​​​,即​​​​​​​卷​​​​​​​组​​​​​​​ 最​​​​​​​新​​​​​​​的​​​​​​​归​​​​​​​档​​​​​​​元​​​​​​​数​​​​​​​据​​​​​​​恢​​​​​​​复​​​​​​​了​​​​​​​物​​​​​​​理​​​​​​​卷​​​​​​​标​​​​​​​签​​​​​​​。​​​​​​​restorefile 参​​​​​​​数​​​​​​​让​​​​​​​ pvcreate 生​​​​​​​成​​​​​​​一​​​​​​​个​​​​​​​与​​​​​​​卷​​​​​​​组​​​​​​​中​​​​​​​久​​​​​​​的​​​​​​​物​​​​​​​理​​​​​​​卷​​​​​​​兼​​​​​​​容​​​​​​​的​​​​​​​新​​​​​​​物​​​​​​​理​​​​​​​卷​​​​​​​,确​​​​​​​保​​​​​​​新​​​​​​​的​​​​​​​元​​​​​​​数​​​​​​​据​​​​​​​不​​​​​​​会​​​​​​​被​​​​​​​放​​​​​​​在​​​​​​​久​​​​​​​的​​​​​​​物​​​​​​​理​​​​​​​卷​​​​​​​所​​​​​​​做​​​​​​​的​​​​​​​数​​​​​​​据​​​​​​​区​​​​​​​域​​​​​​​(这​​​​​​​有​​​​​​​可​​​​​​​能​​​​​​​发​​​​​​​生​​​​​​​。​​​​​​​例​​​​​​​如​​​​​​​:如​​​​​​​果​​​​​​​原​​​​​​​来​​​​​​​的​​​​​​​ pvcreate 命​​​​​​​令​​​​​​​使​​​​​​​用​​​​​​​了​​​​​​​控​​​​​​​制​​​​​​​元​​​​​​​数​​​​​​​据​​​​​​​放​​​​​​​置​​​​​​​位​​​​​​​置​​​​​​​的​​​​​​​参​​​​​​​数​​​​​​​,或​​​​​​​者​​​​​​​使​​​​​​​用​​​​​​​了​​​​​​​应​​​​​​​用​​​​​​​不​​​​​​​同​​​​​​​默​​​​​​​认​​​​​​​选​​​​​​​项​​​​​​​的​​​​​​​软​​​​​​​件​​​​​​​版​​​​​​​本​​​​​​​创​​​​​​​建​​​​​​​物​​​​​​​理​​​​​​​卷​​​​​​​时​​​​​​​,就​​​​​​​会​​​​​​​发​​​​​​​生​​​​​​​这​​​​​​​种​​​​​​​情​​​​​​​况​​​​​​​)。​​​​​​​pvcreate 命​​​​​​​令​​​​​​​仅​​​​​​​覆​​​​​​​盖​​​​​​​ LVM 元​​​​​​​数​​​​​​​据​​​​​​​区​​​​​​​域​​​​​​​,不​​​​​​​会​​​​​​​影​​​​​​​响​​​​​​​现​​​​​​​有​​​​​​​的​​​​​​​数​​​​​​​据​​​​​​​区​​​​​​​域​​​​​​​。​​​​​​​
[root@link-07 backup]# pvcreate --uuid "FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk" --restorefile /etc/lvm/archive/VG_00050.vg /dev/sdh1
  Physical volume "/dev/sdh1" successfully created
You can then use the vgcfgrestore command to restore the volume group's metadata.
[root@link-07 backup]# vgcfgrestore VG
  Restored volume group VG
现​​​​​​​在​​​​​​​您​​​​​​​可​​​​​​​以​​​​​​​显​​​​​​​示​​​​​​​逻​​​​​​​辑​​​​​​​卷​​​​​​​。​​​​​​​
[root@link-07 backup]# lvs -a -o +devices
  LV     VG   Attr   LSize   Origin Snap%  Move Log Copy%  Devices
  stripe VG   -wi--- 300.00G                               /dev/sdh1 (0),/dev/sda1(0)
  stripe VG   -wi--- 300.00G                               /dev/sdh1 (34728),/dev/sdb1(0)
下​​​​​​​面​​​​​​​的​​​​​​​命​​​​​​​令​​​​​​​激​​​​​​​活​​​​​​​卷​​​​​​​并​​​​​​​显​​​​​​​示​​​​​​​激​​​​​​​活​​​​​​​的​​​​​​​卷​​​​​​​。​​​​​​​
[root@link-07 backup]# lvchange -ay /dev/VG/stripe
[root@link-07 backup]# lvs -a -o +devices
  LV     VG   Attr   LSize   Origin Snap%  Move Log Copy%  Devices
  stripe VG   -wi-a- 300.00G                               /dev/sdh1 (0),/dev/sda1(0)
  stripe VG   -wi-a- 300.00G                               /dev/sdh1 (34728),/dev/sdb1(0)
如​​​​​​​果​​​​​​​磁​​​​​​​盘​​​​​​​中​​​​​​​的​​​​​​​ LVM 元​​​​​​​数​​​​​​​据​​​​​​​使​​​​​​​用​​​​​​​至​​​​​​​少​​​​​​​覆​​​​​​​盖​​​​​​​了​​​​​​​它​​​​​​​的​​​​​​​数​​​​​​​据​​​​​​​的​​​​​​​空​​​​​​​间​​​​​​​大​​​​​​​小​​​​​​​,这​​​​​​​个​​​​​​​命​​​​​​​令​​​​​​​可​​​​​​​以​​​​​​​恢​​​​​​​复​​​​​​​物​​​​​​​理​​​​​​​卷​​​​​​​。​​​​​​​如​​​​​​​果​​​​​​​覆​​​​​​​盖​​​​​​​元​​​​​​​数​​​​​​​据​​​​​​​的​​​​​​​数​​​​​​​据​​​​​​​超​​​​​​​过​​​​​​​了​​​​​​​元​​​​​​​数​​​​​​​据​​​​​​​区​​​​​​​域​​​​​​​,那​​​​​​​么​​​​​​​就​​​​​​​有​​​​​​​可​​​​​​​能​​​​​​​损​​​​​​​害​​​​​​​到​​​​​​​卷​​​​​​​中​​​​​​​的​​​​​​​数​​​​​​​据​​​​​​​。​​​​​​​您​​​​​​​可​​​​​​​能​​​​​​​可​​​​​​​以​​​​​​​使​​​​​​​用​​​​​​​ fsck 命​​​​​​​令​​​​​​​修​​​​​​​复​​​​​​​那​​​​​​​些​​​​​​​数​​​​​​​据​​​​​​​。​​​​​​​
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.