Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.


  Search this Thread
Old 11-24-2006, 11:12 AM   #1
Vitalie Ciubotaru
Registered: Dec 2005
Location: Osaka, Japan
Distribution: Ubuntu Trinity
Posts: 153

Rep: Reputation: 30
Create loop devices?

Hi everybody,

I'm not sure it's a LFS-related question, but that's what I'm facing while trying to do with my BLFS-6.1 system.
I'm trying [and succeeded, but rather blindly] to build my own LiveCD per "Beginners Guide To Creating A Live CD With LFS 6.0". It requires to create an initrd file(?), create a filesistem on it(?) and mount it as a loop device
dd if=/dev/zero of=$LIVECD/boot/initrd bs=1024 count=6144
mke2fs -m 0 -i 1024 -F $LIVECD/boot/initrd
mount -o loop $LIVECD/boot/initrd $LIVECD/mnt
First of all, I am not quite able to imagine this (a filesystem on/in a file).
Secondly, my system says it hasn't got any loop devices. I just included loop device support into the kernel, recompiled and installed it, manually inserted loop.ko module, and just created a loop device with
mknod -b /dev/loop1 1 1
It worked!!!
Now someone explain what I've done after all!
"info" files can't explain what loop devices are.
"info" files can't explain what MAJOR and MINOR numbers are.
Is it generally safe to do what I did.

Old 11-25-2006, 05:05 PM   #2
Senior Member
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (
Posts: 1,900

Rep: Reputation: 69
Every device in many Unix-like systems has its number, constructed from major byte and minor byte. It is just a number in a list of all devices current kernel can handle.

Loop device is block device, which reads given file when it should return result of reading of its content. It is just a proxy, converting from file API into block device API.

Mounting sets up loop device - it opens loop device in /dev/ by name, and sets that it corresponds to given file. If there was no loop device files in /dev - it is called "out of luck"... And you created needed file...
Old 11-29-2006, 01:45 PM   #3
Vitalie Ciubotaru
Registered: Dec 2005
Location: Osaka, Japan
Distribution: Ubuntu Trinity
Posts: 153

Original Poster
Rep: Reputation: 30
1. Why do i have to re-create this /dev/loop* file each time I reboot?
2. What MAJOR and MINOR numbers should I use?
Old 11-30-2006, 04:45 PM   #4
Registered: Aug 2004
Distribution: LFS
Posts: 350

Rep: Reputation: 31
LFS 6.0 and later use udev to create device nodes during system startup. If you're manually inserting loop.ko after the udev scripts run then you need to rerun the udevstart program to create the device nodes.

A better way, is to add an entry for loop in the /etc/sysconfig/modules file or compile a new kernel with loop support built-in.



P.S. If you need to reference device node numbers look at Documentation/devices.txt in your kernel source tree

Last edited by madluther; 11-30-2006 at 04:50 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't get more than 8 loop devices going tommyrot Linux - Newbie 4 07-27-2006 10:17 PM
Maximum mounted loop devices? dplazz Linux - General 6 07-21-2005 05:52 PM
fstab and loop devices MBH Linux - Hardware 3 10-21-2004 08:58 AM
un/mounting loop devices box_l Linux - Software 4 08-05-2004 09:03 AM
new kernel installation & loop back devices? fbarre Linux - Newbie 5 10-21-2003 01:40 PM > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 04:38 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration