Ignore:
Timestamp:
May 2, 2009, 6:53:34 PM (16 years ago)
Author:
price
Message:

pv-fixup, lvmanip: last tweaks

This is from the very beginning of April, at the close of the LVM saga.
Somehow I never pushed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/scripts/pv-fixup/lvmanip

    r2285 r2321  
    22exit 1
    33
    4 DISK=/dev/mapper/36090a028407d6e2b2589a45cdb971489
     4SOURCE=/dev/mapper/36090a028407d6e2b2589a45cdb971489
    55
    66# The name of the LVM archive to get data from
     
    1212lvmextractint () {
    1313  perl -lne 'print $1 if (/'"$1"' = ([0-9]+)/)'
     14}
     15
     16# Extract the first block of an lv to a file named part-$lv
     17getfirstblock () {
     18  lvname="$1"
     19  offset=$(grep -A16 $'\t'$lvname $ARCHIVE  | grep pv0 | cut -f 2 -d ,);
     20  if [ -z "$offset" ]; then echo "WARNING: LV not found";
     21  else
     22    echo "Extracting $lvname from offset $offset"
     23    dd if=$SOURCE of=part-$lvname bs=1M skip=$(( $offset * 8192 + 384 )) bs=512 count=1;
     24  fi
    1425}
    1526
     
    7081  else
    7182    echo "# Extracting $lvname from offset $offset PEs with length $length PEs"
    72     echo dd if=$DISK of=/dev/xenvg/$lvname \
     83    echo dd if=$SOURCE of=/dev/xenvg/$lvname \
    7384      skip=$(( $offset * 64 + 3 )) bs=64K count=$(( $length * 64 ))
    7485  fi
     
    90101  else
    91102    echo "# Extracting $lvname segment 2 from offset $offset PEs with length $length PEs"
    92     echo dd if=$DISK of=/dev/xenvg/$lvname bs=64K \
     103    echo dd if=$SOURCE of=/dev/xenvg/$lvname bs=64K \
    93104      skip=$(($offset*64 + 3)) count=$(($length*64)) seek=$(($seek*64))
    94105  fi
Note: See TracChangeset for help on using the changeset viewer.