Score:0

Is devicemapper linear not just passthrough?

ma flag

I'm trying to follow the script in https://jvns.ca/blog/2021/01/27/day-47--using-device-mapper-to-manage-firecracker-images/?hmsr=joyk.com&utm_source=joyk.com&utm_medium=referral but getting an error. To diagnose my understanding of devicemapper, I tried to construct a plain passthrough, but it's not working.

BASEIMAGE=hello-rootfs.ext4
LOOP=$(sudo losetup --find --show --read-only $BASEIMAGE)

$ # mounting the loop device works correctly
$ mkdir -p mnt
$ sudo mount "$LOOP" mnt

$ # prints  "bar", as expected for this filesystem
$ sudo ls mnt/root
> bar
$ sudo umount mnt

$ # try creating a passthrough via devicemapper
$ printf "0 `sudo blockdev --getsz $LOOP` linear $LOOP 0" | sudo dmsetup create mybase
$ sudo mount /dev/mapper/mybase mnt
> mount: /home/od/vm1/mnt: can't read superblock on /dev/mapper/mybase.

as you can see, the loopback device mounts normally, but when it goes through the devicemapper, suddenly the superblock can't be read.

Why is that? The devicemapper setup should be mapping 0 -> sizeof(loop device) to 0 -> sizeof(loop device) on the loop device. That seems like it should be a passthrough.

Is devicemapper doing something else in between?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.