lkml.org 
[lkml]   [2007]   [Jan]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH] dm-cow: copy-on-write stackable target for device-mapper
On 11/27/06, Eric Van Hensbergen <ericvh@hera.kernel.org> wrote:
> Subject: [RFC] [PATCH] dm-cow: copy-on-write stackable target for device-mapper
>
> +
> +A simple script file is included to format WB.
> +The way it works is the standard dmsetup calls for
> +the device mapper. The arguments are
> +

There have been several requests for the "simple" script file.
Portions of its implementation are somewhat specific to our
installation (like the use of the rc shell). I'm including it inline
here - not sure where else to put it -- perhaps in the Documentation:

#!/usr/bin/rc

tableboth ='0 devblksz cow devread 0 devwrite devbmapw 0'
devsize = `{sfdisk -s $1}

fn wipeoutdev{
bmapsize = `{echo $devsize / 512 /2 |bc}
echo dd 'if=/dev/zero' 'of='^$1 'count='^$bmapsize 'bs=512'
dd 'if=/dev/zero' 'of='^$1 'count='^$bmapsize 'bs=512'
}

fn escapedev{
echo $1|sed 's/\//\\\//g'
}


fn setcow{
devread = `{escapedev $1}
devwrite = `{escapedev $2}
devbmapw = `{escapedev $3}
tableset = `{echo $tableboth|sed -r 's/devread/'^$devread^'/'}
tableset = `{echo $tableset|sed -r 's/devwrite/'^$devwrite^'/'}
tableset = `{echo $tableset|sed -r 's/devbmapw/'^$devbmapw^'/'}
devblksz = `{expr $devsize '*' 2}
tableset = `{echo $tableset|sed -r 's/devblksz/'^$devblksz^'/'}
echo trying to set $tableset
echo $tableset > /tmp/tableset
echo trying to dmsetup create $4
dmsetup create $4 << EOF
$tableset
EOF
dmsetup table
}

if(! ~ $#* 4){
echo usage: newcow origdev destdev bmapdest namecow
exit 1
}

namecow=$4
origdev=$1
wipeoutdev $2
setcow $1 $2 $3 $namecow
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-01-26 18:11    [W:0.099 / U:0.616 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site