linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] Use lvcreart -m to make a mirror
@ 2006-01-05  3:05 Fang,Dongyu
  2006-01-05  8:43 ` Patrick Caulfield
  0 siblings, 1 reply; 5+ messages in thread
From: Fang,Dongyu @ 2006-01-05  3:05 UTC (permalink / raw)
  To: LVM general discussion and development; +Cc: yshao

[-- Attachment #1: Type: text/plain, Size: 586 bytes --]

When I use `lvcreate -l 4 --mirrors 1 -n mirror1 /dev/vg1` want to 
create  mirror LV, I got four LV:
  ACTIVE            '/dev/vg1/mirror1' [16.00 MB] inherit
  ACTIVE            '/dev/vg1/mirror1_mlog' [4.00 MB] inherit
  ACTIVE            '/dev/vg1/mirror1_mimage_0' [16.00 MB] inherit
  ACTIVE            '/dev/vg1/mirror1_mimage_1' [16.00 MB] inherit
I think the LV mirror1 is the origin LV, mirror1_mlog is log, the two 
others should be images LV, so why there are two images(in my opinion, 
it should be only one), and I how to use then? Can I mount it?
Thanks.
    Fang,Dongyu

[-- Attachment #2: dfang.vcf --]
[-- Type: text/x-vcard, Size: 64 bytes --]

begin:vcard
fn:Dongyu Fang
n:Fang;Dongyu
version:2.1
end:vcard


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-lvm] Use lvcreart -m to make a mirror
  2006-01-05  3:05 [linux-lvm] Use lvcreart -m to make a mirror Fang,Dongyu
@ 2006-01-05  8:43 ` Patrick Caulfield
  2006-01-05  9:27   ` Fang,Dongyu
  0 siblings, 1 reply; 5+ messages in thread
From: Patrick Caulfield @ 2006-01-05  8:43 UTC (permalink / raw)
  To: LVM general discussion and development

Fang,Dongyu wrote:
> When I use `lvcreate -l 4 --mirrors 1 -n mirror1 /dev/vg1` want to
> create  mirror LV, I got four LV:
>  ACTIVE            '/dev/vg1/mirror1' [16.00 MB] inherit
>  ACTIVE            '/dev/vg1/mirror1_mlog' [4.00 MB] inherit
>  ACTIVE            '/dev/vg1/mirror1_mimage_0' [16.00 MB] inherit
>  ACTIVE            '/dev/vg1/mirror1_mimage_1' [16.00 MB] inherit
> I think the LV mirror1 is the origin LV, mirror1_mlog is log, the two
> others should be images LV, so why there are two images(in my opinion,
> it should be only one), and I how to use then? Can I mount it?

/dev/vg1/mirror1 is the device you mount, the _mimage_ are internal devices
for LVM. You have the "original" (mimage_0) and the mirror (mimage_1).

The later revisions of LVM will hide these from the lvscan & lvs commands.
-- 

patrick

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-lvm] Use lvcreart -m to make a mirror
  2006-01-05  8:43 ` Patrick Caulfield
@ 2006-01-05  9:27   ` Fang,Dongyu
  2006-01-05  9:47     ` Patrick Caulfield
  0 siblings, 1 reply; 5+ messages in thread
From: Fang,Dongyu @ 2006-01-05  9:27 UTC (permalink / raw)
  To: LVM general discussion and development; +Cc: yshao

[-- Attachment #1: Type: text/plain, Size: 1226 bytes --]

Thanks your replay.
How can I mount the "original" (mimage_0) or the "mirror" (mimage_1) 
single?
Because I want to verify it write/read data in both LV indeed.
And how can I remove the mirror relation between the two LV(let the 
"original" and "mirror" become two singe LV)?   (I use `lvconvert -m 0 
vg1/mirror1`  then LVs become one.)
    Fang,Dongyu

Patrick Caulfield wrote:

>Fang,Dongyu wrote:
>  
>
>>When I use `lvcreate -l 4 --mirrors 1 -n mirror1 /dev/vg1` want to
>>create  mirror LV, I got four LV:
>> ACTIVE            '/dev/vg1/mirror1' [16.00 MB] inherit
>> ACTIVE            '/dev/vg1/mirror1_mlog' [4.00 MB] inherit
>> ACTIVE            '/dev/vg1/mirror1_mimage_0' [16.00 MB] inherit
>> ACTIVE            '/dev/vg1/mirror1_mimage_1' [16.00 MB] inherit
>>I think the LV mirror1 is the origin LV, mirror1_mlog is log, the two
>>others should be images LV, so why there are two images(in my opinion,
>>it should be only one), and I how to use then? Can I mount it?
>>    
>>
>
>/dev/vg1/mirror1 is the device you mount, the _mimage_ are internal devices
>for LVM. You have the "original" (mimage_0) and the mirror (mimage_1).
>
>The later revisions of LVM will hide these from the lvscan & lvs commands.
>  
>


[-- Attachment #2: dfang.vcf --]
[-- Type: text/x-vcard, Size: 64 bytes --]

begin:vcard
fn:Dongyu Fang
n:Fang;Dongyu
version:2.1
end:vcard


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-lvm] Use lvcreart -m to make a mirror
  2006-01-05  9:27   ` Fang,Dongyu
@ 2006-01-05  9:47     ` Patrick Caulfield
  2006-01-09 23:39       ` Jonathan E Brassow
  0 siblings, 1 reply; 5+ messages in thread
From: Patrick Caulfield @ 2006-01-05  9:47 UTC (permalink / raw)
  To: LVM general discussion and development

Fang,Dongyu wrote:
> Thanks your replay.
> How can I mount the "original" (mimage_0) or the "mirror" (mimage_1)
> single?
> Because I want to verify it write/read data in both LV indeed.

Because of internal cacheing I don't know whether that's a sensible thing to do.

> And how can I remove the mirror relation between the two LV(let the
> "original" and "mirror" become two singe LV)?   (I use `lvconvert -m 0
> vg1/mirror1`  then LVs become one.)

With current RPMs you currently can't. The code is in CVS but it needs lots of
testing.
-- 

patrick

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-lvm] Use lvcreart -m to make a mirror
  2006-01-05  9:47     ` Patrick Caulfield
@ 2006-01-09 23:39       ` Jonathan E Brassow
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan E Brassow @ 2006-01-09 23:39 UTC (permalink / raw)
  To: LVM general discussion and development

[-- Attachment #1: Type: text/plain, Size: 245 bytes --]

The attached script (originally from Jun'ichi Nomura) is what I've been 
using to validate mirror volumes.  You might be able to pull out things 
for use in your tests.  It uses device mapper and is design to attack a 
specific bug.

  brassow


[-- Attachment #2: mirror_177067.sh --]
[-- Type: application/octet-stream, Size: 4337 bytes --]

#!/bin/sh
#####################################################
# This test ensures that the contents of each side
# of a mirror are the same.
#
# Todo:
#   Extend to include mirrors with more sides
#
# Exits values
#   0 if test succeeds
#   1 if test failed
#   2 if problem running test
#####################################################

#####################################################
# Globals
#####################################################

vgname=vg
lvname=mtest1
M=1
SIZE=500M

VOL=${vgname}/${lvname}
MAP=${vgname}-${lvname}

mount_point=/tmp/tmp_mnt
mkdir -p ${mount_point}

#####################################################
# Functions
#####################################################

function write_data {
    mkfs.ext3 /dev/${VOL} >& /dev/null
# following should be removed if PVs are too fast
    mount /dev/${VOL} ${mount_point}
    cp -ar /usr/include/linux ${mount_point}/
    umount $mount_point
}

function show_log {
    echo "# dirty log dump: $1"
    blockdev --flushbufs /dev/mapper/${MAP}*
    od -Ax -x /dev/mapper/${MAP}_mlog
}

function wait_sync {
    dmsetup wait ${MAP}
}

function usage
{
    echo "Usage: $0 [options]"
    echo "Options:"
    echo " -h           Print this message."
    echo " -m <string>  Temporary mount point. (default = /tmp/tmp_mnt)"
    echo " -s <number>  Number of sides to the mirror. (default = 2)"
    echo " -v <string>  Volume group used for tests. (default = vg)"
}

#####################################################
# Main
#####################################################

while getopts :hm:s:v: opt; do
    case $opt in
	m) mount_point=$OPTARG;;
	s) M=$(($OPTARG - 1));;
	v) vgname=$OPTARG;;
	:) echo "$0: $OPTARG requires a value:"; usage ; exit 2;;
        \?) echo "$0: unknown option $OPTARG"; usage ; exit 2;;
        *) usage; exit 0 ;;
    esac
done

if [ $M -lt 1 ] || [ $M -gt 8 ]; then
    echo "Bad number of sides, $(($M + 1))"
    echo "Should be 2 - 8"
    exit 2
fi

echo -n "Creating volume ${VOL} ($(($M + 1))-sided mirror)::  "

if !(lvcreate -m ${M} --size ${SIZE} --name ${lvname} ${vgname} >& /dev/null); then
    echo "[FAILED]"
    echo "please check the followings:"
    echo "  * make sure volume group ${vgname} exists"
    echo "  * make sure ${VOL} doesn't exist yet"
    echo "  * ${vgname} contains $(($M + 2)) or more PVs"
    echo "  * ${vgname} has capacity larger than $SIZE x $(($M + 1))"
    exit 2
fi
echo "[  OK  ]"
echo "  Dirty log location:"
logtable=$(dmsetup table ${MAP}_mlog)
echo "  $logtable"
echo "  Current status:"
output=$(dmsetup status ${MAP})
echo "  $output"

#show_log "just-after-volume-creation"

echo -n "Writing data on the volume::  "
if write_data; then
    echo "[  OK  ]"
else
    echo "[FAILED]"
    exit 2
fi

echo "  Current status:"
output=$(dmsetup status ${MAP})
echo "  $output"

echo -n "Deactivating the volume::  "
if lvchange -an ${VOL} >& /dev/null; then
    echo "[  OK  ]"
else
    echo "[FAILED]"
    exit 2
fi

#echo $logtable | dmsetup create ${MAP}_mlog
#show_log "after-writing-data, sync-not-completed"
#dmsetup remove ${MAP}_mlog

echo -n "Re-activating the volume::  "
if lvchange -ay ${VOL} >& /dev/null; then
    echo "[  OK  ]"
else
    echo "[FAILED]"
    exit 2
fi

echo -n "Waiting for sync completion::  "
wait_sync &
wait
echo "[  OK  ]"
#show_log "sync-completed"

echo "  Image locations:  "
for i in $(seq 0 $M); do
    imgtable[$i]=$(dmsetup table ${MAP}_mimage_$i)
done
for i in $(seq 0 $M); do
    echo "  ${imgtable[$i]}"
done

echo -n "Deactivating the volume::  "
if lvchange -an ${VOL} >& /dev/null; then
    echo "[  OK  ]"
else
    echo "[FAILED]"
    exit 2
fi

echo "Comparing raw images."
for i in $(seq 0 $M); do
    echo ${imgtable[$i]} | dmsetup create ${MAP}_mimage_$i
done
blockdev --flushbufs /dev/mapper/${MAP}*

for i in $(seq $M); do
    echo -n "  Image 0 vs Image $i::  "
    if !(cmp /dev/mapper/${MAP}_mimage_0 /dev/mapper/${MAP}_mimage_$i > /dev/null); then
	# Should we leave the device-mapper images for examination?
	# I say no, because we'll leave the LV
	for j in $(seq 0 $M); do
	    dmsetup remove ${MAP}_mimage_$j
	done
	echo "[FAILED (bug 177067)]"
	exit 1
    else
	echo "[  OK  ]"
    fi
done

for j in $(seq 0 $M); do
    dmsetup remove ${MAP}_mimage_$j
done
lvremove -ff ${VOL} >& /dev/null

exit 0

[-- Attachment #3: Type: text/plain, Size: 850 bytes --]



On Jan 5, 2006, at 3:47 AM, Patrick Caulfield wrote:

> Fang,Dongyu wrote:
>> Thanks your replay.
>> How can I mount the "original" (mimage_0) or the "mirror" (mimage_1)
>> single?
>> Because I want to verify it write/read data in both LV indeed.
>
> Because of internal cacheing I don't know whether that's a sensible 
> thing to do.
>
>> And how can I remove the mirror relation between the two LV(let the
>> "original" and "mirror" become two singe LV)?   (I use `lvconvert -m 0
>> vg1/mirror1`  then LVs become one.)
>
> With current RPMs you currently can't. The code is in CVS but it needs 
> lots of
> testing.
> -- 
>
> patrick
>
> _______________________________________________
> linux-lvm mailing list
> linux-lvm@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-01-09 23:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-05  3:05 [linux-lvm] Use lvcreart -m to make a mirror Fang,Dongyu
2006-01-05  8:43 ` Patrick Caulfield
2006-01-05  9:27   ` Fang,Dongyu
2006-01-05  9:47     ` Patrick Caulfield
2006-01-09 23:39       ` Jonathan E Brassow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).