LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Want to create loop devices (https://www.linuxquestions.org/questions/linux-kernel-70/want-to-create-loop-devices-689517/)

kauuttt 12-10-2008 03:25 AM

Want to create loop devices
 
Hi,

I have one iso image.When I am trying to mount (trying to mount it on /cdrom) it I get the following error:
[root@betty swd]# mount -o loop image.iso /cdrom/
mount: could not find any device /dev/loop#

ls –Rl /dev/loop* shows nothing. So the loop devices are not being created in /dev. While ideally it should be:
[root@betty swd]# ls -lR /dev/loop*
lrwxrwxrwx 1 root root 6 Dec 9 13:41 /dev/loop0 -> loop/0
lrwxrwxrwx 1 root root 6 Dec 9 13:41 /dev/loop1 -> loop/1
lrwxrwxrwx 1 root root 6 Dec 9 13:41 /dev/loop2 -> loop/2
lrwxrwxrwx 1 root root 6 Dec 9 13:41 /dev/loop3 -> loop/3
lrwxrwxrwx 1 root root 6 Dec 9 13:41 /dev/loop4 -> loop/4
lrwxrwxrwx 1 root root 6 Dec 9 13:41 /dev/loop5 -> loop/5
lrwxrwxrwx 1 root root 6 Dec 9 13:41 /dev/loop6 -> loop/6
lrwxrwxrwx 1 root root 6 Dec 9 13:41 /dev/loop7 -> loop/7

/dev/loop:
total 0
brw-rw---- 1 root disk 7, 0 Dec 9 13:41 0
brw-rw---- 1 root disk 7, 1 Dec 9 13:41 1
brw-rw---- 1 root disk 7, 2 Dec 9 13:41 2
brw-rw---- 1 root disk 7, 3 Dec 9 13:41 3
brw-rw---- 1 root disk 7, 4 Dec 9 13:41 4
brw-rw---- 1 root disk 7, 5 Dec 9 13:41 5
brw-rw---- 1 root disk 7, 6 Dec 9 13:41 6
brw-rw---- 1 root disk 7, 7 Dec 9 13:41 7

As a workaround I am able to create the loop devices by modprobe loop and then I am able to mount the image successfully.

But where (I mean in which file/script) I need to change in kernel level to get a permanent solution, so the loop devices are created during booting.
I did some sort of googling, but I didn’t get any such satisfactory permanent solution or may be they are tedious.

Will the addition of ‘loop’ in /etc/modules help? So that if I compile the kernel (with the appropriate changes) and NUKE my system with the image, I can mount the image without any workaround (like modprobe or mknod etc..).

I am really in hurry and fast responses will be highly appreciated.
Thanks in advance.

-KD

pinniped 12-10-2008 03:46 AM

Quote:

Originally Posted by kauuttt (Post 3370156)
Will the addition of ‘loop’ in /etc/modules help?

Yes.

Since you don't mention what distribution you are using, it is difficult for people to assess why your loop module is not being loaded at startup (except for the obvious 'it wasn't in /etc/modules'). If you know how to unpack an initrd (actually probably initramfs) image, have a look at your initrd and see if 'loop' is included there; if it is not, then that is one possible reason why 'loop' isn't loaded at boot time.

kauuttt 12-10-2008 03:59 AM

I need to know how to compile a new kernel with loop support built-in.
Actually I use the kernel rpms for the smooth running of my application part(related to SIP and VOIP).
I use kernel version of 2.6.14.

Anyways I faced this problem, when we tried to change system to 64 bit and changed the file system to ext3 from xfs type.

i checked the earlier version of my image and found that I dont have 'loop' enlisted in /etc/modules files.
So I ma wondering about the problem and need to know where exactly i need to change in kernel level to get a permanent solution.

Please help me to get rid of this issue.

-KD

kauuttt 12-10-2008 04:04 AM

Do I need to build-in loop modules in the kernel; and need to compile it?
if that helps, then please share the steps:)

And then if I create an image with the compiled kernel packages and my application codes, will that help me to avoid this issue?

Thanks

syg00 12-10-2008 04:43 AM

If you can modprobe loop, it is already built.
Simply add it to /etc/modules should suffice - no need to compile a kernel just for that. Especially if it's supposedly so urgent.

kauuttt 12-10-2008 05:32 AM

Hey Thanks for your suggestions!!

But if I do that, then I think I will face the same issue when I will mount and install a new image or during the reboot. Actually in my system I need to change the image.iso quite frequently.So I want a permanent solution.

syg00 12-10-2008 05:35 AM

It is a permanent solution. Just do the edit and reboot - see what happens.

kauuttt 12-10-2008 05:38 AM

To add-on:-
in my previous images, where I can mount the image successfully, I dont see the 'loop' in /etc/modules.Thats why I am still wondering.as i can do a modprobe loop, so loop module is built in the kernel.

Basiccally my image.iso contains kernel packages + my application C++ codes.So as I change (it may be upgrade or fresh installation) my image.iso very frequently, so I need some thing permanently, so that I dont need this work-around again and again.

Thanks--KD

kauuttt 12-10-2008 05:45 AM

Will i go and change my /etc/modules file and compile the kernel to get updated kernel packages.
And if I use this packages for my application code to build a new image.iso, I hope I will not see this issue.
please lemme know
-KD

syg00 12-10-2008 05:46 AM

In that case just ensure CONFIG_BLK_DEV_LOOP=Y to ensure the support is built in.

kauuttt 12-10-2008 06:04 AM

Thanks a lot for your sincere suggestion !!

I think i am not able to bring out my issue or about my system clearly.Here it (overview of my system and my issue) goes :
1)I compile my kernel with some changes, if neccessary and create some packages.
2)I use those packages for/with my application codes ,compile and create a image.iso.
3)then I put it on my system (hardware).and at this step I generally do mount -o loop /image.iso /cdrom
4)here I faced this issue.

As I change my image (kernel codes+application codes)quite frequently, I need some changes at the kernel levels.

So what I need to check or do?
As I am not that much experienced in Linux, so it will be good if you can go into bit details.

kauuttt 12-10-2008 07:33 AM

I did a modprobe loop and was able to create the lopping devices temporarily.I added 'loop' in /etc/modules and gave reboot.

When my system comes up I faced the same issue again;I mean la -Rl /dev/loop* gives nothing.

Please help me out
--KD

kauuttt 12-10-2008 07:34 AM

Typing mistake***

ls -Rl /dev/loop* gives nothing.


All times are GMT -5. The time now is 06:18 PM.