Line | |
---|
1 | # The name of the LVM archive to get data from |
---|
2 | ARCHIVE=/etc/lvm/archive/xenvg_00685.vg |
---|
3 | |
---|
4 | # Extract the first block of an lv to a file named part-$lv |
---|
5 | getfirstblock () { |
---|
6 | lvname="$1" |
---|
7 | offset=$(grep -A16 $'\t'$lvname $ARCHIVE | grep pv0 | cut -f 2 -d ,); |
---|
8 | if [ -z "$offset" ]; then echo "WARNING: LV not found"; |
---|
9 | else |
---|
10 | echo "Extracting $lvname from offset $offset" |
---|
11 | dd if=/dev/mapper/36090a028407d6e2b2589a45cdb971489 of=part-$lvname bs=1M skip=$(( $offset * 8192 + 384 )) bs=512 count=1; |
---|
12 | fi |
---|
13 | } |
---|
14 | |
---|
15 | # Generate a dd command to copy the lv data to /dev/xenvg/$lv |
---|
16 | ddlv () { |
---|
17 | lvname="$1" |
---|
18 | offset=$(grep -A16 $'\t'$lvname $ARCHIVE | grep pv0 | cut -f 2 -d ,); |
---|
19 | length=$(( $(grep -A16 $'\t'$lvname $ARCHIVE | grep extent_count | cut -f 2 -d = | cut -f 1 -d '#') )); |
---|
20 | if [ -z "$offset" ]; then echo "# WARNING: LV $lvname not found"; |
---|
21 | else |
---|
22 | echo "#Extracting $lvname from offset $offset with length $length" |
---|
23 | echo dd if=/dev/mapper/36090a028407d6e2b2589a45cdb971489 of=/dev/xenvg/$lvname bs=1M skip=$(( $offset * 8192 + 384 )) ibs=512 obs=4194304 count=$length |
---|
24 | fi |
---|
25 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.