<span style="font-family: courier new,monospace;">Hello,</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">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.</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">1.Using dd command I have created a 100 MB file.</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"># dd if=/dev/zero of=dm_test bs=512 count=204800</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">2. associated it with loop device:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"># losetup /dev/loop0 /tmp/dm_test</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"># blockdev --getsize /dev/loop0</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">204800</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">using dmsetup to create dm file.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"># dmsetup create half --table "0 102400 linear /dev/loop0 0"</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[root@bladelinux01 root]# dmsetup table half</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">0 102400 linear 7:0 0</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[root@bladelinux01 root]# dmsetup info half</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Name: half</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">State: ACTIVE</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Read Ahead: 256</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Tables present: LIVE</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Open count: 0</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Event number: 0</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Major, minor: 253, 6</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Number of targets: 1</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[root@bladelinux01 root]# ls -l /dev/mapper/half</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">lrwxrwxrwx. 1 root root 7 Nov 1 01:44 /dev/mapper/half -> ../dm-6</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">But if I use the other part of the disk to map. The command is not successful</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[root@bladelinux01 root]# dmsetup create half1 --table "102401 102399 linear /dev/loop0 102400"</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">device-mapper: reload ioctl failed: Invalid argument</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Command failed</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[root@bladelinux01 root]# dmsetup create half1 --table "102401 102399 linear /dev/loop0 0"</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">device-mapper: reload ioctl failed: Invalid argument</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Command failed</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">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</span>.<br>
<br>-- sanjana<br><br>