[dm-devel] Error writing to linear mapped device...

Manu Tayal manut at mindtree.com
Fri May 20 05:58:44 UTC 2005


Hi All,
I tried the following steps:
1) Set up a loopback device
	# dd if=/dev/zero of=/tmp/store1 bs=1024 seek=2047 count=1
	# losetup /dev/loop1 /tmp/store1
	# mke2fs /dev/loop1
	# mount /dev/loop1 /mnt/loopdev

2) Create a linearly mapped device for the loopback device
	# echo 0 $(blockdev --getsize /dev/loop1) linear /dev/loop1 0 |
dmsetup create new
	# mount /dev/mapper/new /mnt/new

Both the devices created and mounted now refer to the same physical device.

3) Write to both the devices separately:
      # touch /mnt/loopdev/a.txt
      # touch /mnt/new/b.txt

OBSERVATION:
===========
1) The file created in /mnt/loopdev is not visible under /mnt/new and
vice-versa. Thought, it might be due to the buffers maintained by devices.
"sync" did not help in flushing.
2) On unmounting the devices and mounting it again gives unpredictable
results:
	a. Sometimes, a.txt is visible at both the places, with b.txt missing
at both places.
	b. Sometimes, b.txt is visible at both the places, with a.txt missing
at both places.
	c. Sometimes, I get "Input/output" error in one of the mount points.

Questions:
=========
1) Can somebody explain the behavior?
2) Once a linear mapping is created for /dev/loop1 as /dev/mapper/new, how
can I prevent the user from using /dev/loop1 and always use /dev/mapper/new
for all the reads and writes? 
3) What happens to all the open connections to files being used for
/dev/loop1 after I have mapped it to /dev/mapper/new?


Thanks and Regards,
Manu.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: disclaimer.txt
URL: <http://listman.redhat.com/archives/dm-devel/attachments/20050520/7cf175b1/attachment.txt>


More information about the dm-devel mailing list