开发者

mounting without -o loop

开发者 https://www.devze.com 2022-12-23 00:20 出处:网络
I have written a dummy (ram disk) block device driver for linux kernel. When the driver is loaded, I can see it as /dev/mybd.

I have written a dummy (ram disk) block device driver for linux kernel. When the driver is loaded, I can see it as /dev/mybd.

I can successfully transfer data onto it using dd command, compare the copie开发者_如何学God data successfully.

The problem is that when I create ext2/3 filesystem on it, I have to use -o loop option with the mount command. Otherwise mount fails with following result:

mount: wrong fs type, bad option, bad superblock on mybd, missing codepage or helper program, or other error

What could be the problem? Please help.

Thanks.


Hmm, if it works with -o loop and doesn't work without, then I have bad news for you: your "device" is actually just a plain file in /dev. What does ls -l /dev/mybd show? If its filesize is non-zero, it's a regular file, and has nothing to do with your driver.

Use mknod to create the device file yourself if needed.


I see you're starting over again. As a quick note about your previous attempt, did you make sure your device appeared in /dev as a block device and not a character one?


Create a filesytem on the device before mounting it:

mkfs -t ext2 /dev/mybd

or

mke2fs /dev/mybd


The loop device is used to mount block special files on the linux filesystem emulating them as block devices. Hence, the mount throws error.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号