[dm-devel] creating two device mapper files for an underline blockdevice

Sanjana Shari sanjana.linux at gmail.com
Tue Nov 1 06:10:43 UTC 2011


Please do put me in cc list while replying.

On Tue, Nov 1, 2011 at 11:38 AM, Sanjana Shari <sanjana.linux at gmail.com>wrote:

> Hello,
>
> I am trying to create two device mapper files for an underline
> blockdevice. One file( half1) will be mapped to the first half of the
> block-device. and the second half (half2) will be mapped to the rest of the
> space in the same block device.
>
> 1.Using dd command I have created a 100 MB file.
>
> # dd if=/dev/zero of=dm_test bs=512 count=204800
>
> 2. associated it with loop device:
> # losetup /dev/loop0 /tmp/dm_test
>
> # blockdev --getsize /dev/loop0
> 204800
>
> using dmsetup to create dm file.
> # dmsetup create half --table "0 102400 linear /dev/loop0 0"
>
> [root at bladelinux01 root]# dmsetup table half
> 0 102400 linear 7:0 0
> [root at bladelinux01 root]# dmsetup info half
> Name:              half
> State:             ACTIVE
> Read Ahead:        256
> Tables present:    LIVE
> Open count:        0
> Event number:      0
> Major, minor:      253, 6
> Number of targets: 1
>
>
> [root at bladelinux01 root]# ls -l /dev/mapper/half
> lrwxrwxrwx. 1 root root 7 Nov  1 01:44 /dev/mapper/half -> ../dm-6
>
> But if I use the other part of the disk to map. The command is not
> successful
>
> [root at bladelinux01 root]#  dmsetup create half1 --table "102401 102399
> linear /dev/loop0 102400"
> device-mapper: reload ioctl failed: Invalid argument
> Command failed
>
> [root at bladelinux01 root]#  dmsetup create half1 --table "102401 102399
> linear /dev/loop0 0"
> device-mapper: reload ioctl failed: Invalid argument
> Command failed
>
> The format used seems to be correct according to the man page of dmsetup.
> Please guide me. I am not sure what am I missing.
>
> -- sanjana
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/dm-devel/attachments/20111101/4fdd67cd/attachment.htm>


More information about the dm-devel mailing list