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@bladelinux01 root]# dmsetup table half 0 102400 linear 7:0 0 [root@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@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