old-www/HOWTO/LVM-HOWTO/recovermetadata.html

254 lines
4.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>Recover physical volume metadata</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="LVM HOWTO"
HREF="index.html"><LINK
REL="UP"
TITLE="Recipes"
HREF="recipes.html"><LINK
REL="PREVIOUS"
TITLE="Converting a root filesystem to
LVM 1"
HREF="upgraderoottolvm.html"><LINK
REL="NEXT"
TITLE="Dangerous Operations"
HREF="dangerousops.html"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>LVM HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="upgraderoottolvm.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 13. Recipes</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="dangerousops.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="recovermetadata"
></A
>13.9. Recover physical volume metadata</H1
><P
>&#13; If you get the warning "incorrect metadata area header checksum"
or something about not being able to find PV with UUID foo,
you probably toasted the volume group descriptor area and lvm
startup can't occur.
</P
><DIV
CLASS="warning"
><P
></P
><TABLE
CLASS="warning"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/warning.gif"
HSPACE="5"
ALT="Warning"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>Only run on non-functional VG</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>&#13; Don't do this on a properly working lvm.
You need to specify the correct physical volume to
<B
CLASS="command"
>pvcreate</B
> or you may lose your data.
</P
></TD
></TR
></TABLE
></DIV
><P
>&#13; Extract the exact uuid for the PV that was overwritten from the file
<TT
CLASS="filename"
>/etc/lvm/archive/VolumeGroupName_XXXXX.vg</TT
>.
(Where XXXXX represents the number of the last known good archived lvm
metadata).
</P
><P
>&#13; Use <B
CLASS="command"
>pvcreate</B
> to restore the metadata:
<B
CLASS="command"
>pvcreate --uuid "&#60;some_long_string&#62;" --restorefile /etc/lvm/archive/VolumeGroupName_XXXXX.vg &#60;PhysicalVolume&#62;</B
>
</P
><P
>&#13; If you are lucky you'll find that the on-disk lvm metadata takes
at least so much space as what it was overwritten with. The above
command has been know to recover a PV overwritten with mkswap. If
whatever overwrote the VGDA writes past that area, LVs may be affected.
In this case, fsck might be able to fix the filesystem on the LV, or
you may need more drastic measures to pull data off of it. Contact
your local friendly filesystem expert for help in that case.
</P
><DIV
CLASS="note"
><P
></P
><TABLE
CLASS="note"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
><B
CLASS="command"
>pvcreate</B
> only overwrites the lvm metadata
areas on disk and doesn't touch the data areas (the logical
volumes).
</P
></TD
></TR
></TABLE
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="upgraderoottolvm.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="dangerousops.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Converting a root filesystem to
LVM 1</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="recipes.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Dangerous Operations</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>