xref: /netbsd-src/external/gpl2/lvm2/dist/scripts/vg_convert (revision 56a34939419542e88b386b2229be7565f4f45461)
1*56a34939Shaad#!/bin/sh -x
2*56a34939Shaad
3*56a34939Shaad# Original script used to convert a VG from LVM1 to LVM2 metadata format.
4*56a34939Shaad# Superceded by 'vgconvert', but left here to show how to do it step-by-step.
5*56a34939Shaad
6*56a34939Shaad# Takes vgname as parameter.  No error checking.  Uses temp file 'lvmbackup'.
7*56a34939Shaad
8*56a34939Shaadecho "Please use the 'vgconvert' tool instead"
9*56a34939Shaadexit 1
10*56a34939Shaad
11*56a34939Shaad./vgcfgbackup $1 || exit 1
12*56a34939Shaad./vgcfgbackup --file lvmbackup $1 || exit 1
13*56a34939Shaad
14*56a34939ShaadCMDS=`./pvscan -u | sed -ne "s/.*PV \(.*\) with UUID \(.*\) VG $1 .*/.\/pvcreate -ff -y -M lvm2 --restorefile lvmbackup -u \2 \1 ; /p"`
15*56a34939Shaad
16*56a34939Shaadsh -x -c "$CMDS" || exit 1
17*56a34939Shaad
18*56a34939Shaad./vgcfgrestore --file lvmbackup -M lvm2 $1 || exit 1
19