Hi Henry,

Thank you for help.

I tried the custom kernel with max_loop=255 on debian and all works without problem (no initrd). 

It seems that the issue is related to the use of the loop devices during initrd  to populate the unionfs root fs in a ramdisk. 

During initrd stage, it's possible to use all loop devices:

# df
Filesystem           1k-blocks      Used Available Use% Mounted on
tmpfs                    99936     26736     73200  27% /memory
unionfs                 186656    113456     73200  61% /union -> unionfs (will be the next root)
/mnt/cofs0            51199120  20149960  31049160  39% /union/boot -> cofs0 contains the squashfs modules  
/dev/loop0                2368      2368         0 100% /memory/images/01_kernel.mo -> squashfs module
/dev/loop1               30016     30016         0 100% /memory/images/02_core.mo
/dev/loop2               19456     19456         0 100% /memory/images/03_xwindow.mo
/dev/loop3               20032     20032         0 100% /memory/images/05_commo.mo
/dev/loop4               14848     14848         0 100% /memory/images/06_slax.mo
/dev/loop5                3883      1435      2448  37% /mnt/loop1 -> test
/dev/loop6                3883      1435      2448  37% /mnt/loop2 -> test
/dev/loop7                3883      1435      2448  37% /mnt/loop3 -> test
/dev/loop8                3883      1435      2448  37% /mnt/loop4 -> test
/dev/loop9                3883      1435      2448  37% /mnt/loop5 -> test
/dev/loop10               3883      1435      2448  37% /mnt/loop6 -> test

After initrd, loop devices are handled by udev and dynamically created form /sys/block/* at init time. 
I also tried with static devices but i had the same problem.

In fact, I'm unable to use any loop devices, even below loop7, but thoses initialised during initrd by squashfs and mounted in the union fs. 

Example: 5 squashfs modules loaded during initrd and used by unionfs 

root@slax:~# losetup /dev/loop0
/dev/loop0: [000c]:34 (/mnt/cofs0/base/01_kernel.mo)
root@slax:~# losetup /dev/loop1
/dev/loop1: [000c]:35 (/mnt/cofs0/base/02_core.mo)
oot@slax:~# losetup /dev/loop2
/dev/loop3: [000c]:36 (/mnt/cofs0/base/03_xwindow.mo)
root@slax:~# losetup /dev/loop3
/dev/loop2: [000c]:37 (/mnt/cofs0/base/05_common.mo)
root@slax:~# losetup /dev/loop4
/dev/loop3: [000c]:38 (/mnt/cofs0/base/06_slax.mo)

Loop device 5 seems to be free:

root@slax:~# losetup /dev/loop5
loop: can't get info on device /dev/loop5: No such device or address
root@slax:~# losetup -f
/dev/loop5

But i can't use it:
root@slax:/tmp# mount -o loop initrd initrdtmp/
ioctl: LOOP_SET_FD: Invalid argument


Sample of loop devices created by udev:

root@slax:~# ls -ali /dev/loop*
7565 lrwxrwxrwx  1 root root 6 Nov 22 12:23 /dev/loop0 -> loop/0
7568 lrwxrwxrwx  1 root root 6 Nov 22 12:23 /dev/loop1 -> loop/1
7571 lrwxrwxrwx  1 root root 7 Nov 22 12:23 /dev/loop10 -> loop/10
7574 lrwxrwxrwx  1 root root 8 Nov 22 12:23 /dev/loop100 -> loop/100
7577 lrwxrwxrwx  1 root root 8 Nov 22 12:23 /dev/loop101 -> loop/101
...
root@slax:~# ls -ali /dev/loop/*   
7564 brw-rw----  1 root disk 7,   0 Nov 22 12:23 /dev/loop/0
7567 brw-rw----  1 root disk 7,   1 Nov 22 12:23 /dev/loop/1
7570 brw-rw----  1 root disk 7,  10 Nov 22 12:23 /dev/loop/10
7573 brw-rw----  1 root disk 7, 100 Nov 22 12:23 /dev/loop/100
7576 brw-rw----  1 root disk 7, 101 Nov 22 12:23 /dev/loop/101
  
Le 21 nov. 05 à 18:57, Henry Nestler a écrit :

Eric Garrigues wrote:

Hi,
I'm trying to port SLAX distribution to colinux and i'm facing a problem with the maximum number of loopback devices i can use.
On slax, root mount point is populated with compressed files (squashfs) mounted as loop devices and merged into a single filesystem (unionfs).
I'm unable to use more than 8 loopback devices, even with kernel option "max_loop=255" and /dev populated with 255 loop devices.
Is there any configuration option or  known limitation in colinux ?
Thanks
Colinux-version : colinux-0.7.1 devel
Kernel : 2.6.12.5 with unionfs and squashfs patchs
dmesg :   ...
loop: loaded (max 255 devices)
...

Right, without kernel params have 8 devices.

With "max_loop=255" it works. Have testest on SuSE 9.0 dual boot, runs on colinux 2.6.12-co-0.7.1-hn6

Im my system was only installed /dev/loop0 to loop15, from 16 and above the script has created. See attachments.

This is the grep over mounts:
/root/loop-test/file.img on /root/loop-test/mnt0 type minix (ro,loop=/dev/loop0)
/root/loop-test/file.img on /root/loop-test/mnt1 type minix (ro,loop=/dev/loop1)
... then ends with ...
/root/loop-test/file.img on /root/loop-test/mnt254 type minix (ro,loop=/dev/loop254)

Check the right name, major and minor for your loop* devices.

-- 
Henry Nestler
#!/bin/sh

MAX_LOOPS=255
echo -n "Create image..."
dd if=/dev/zero of=file.img bs=1k count=200
mkfs.minix file.img
echo "done"

echo -n "mount all..."
let count=0
while [ $count -lt $MAX_LOOPS ]
do
    echo -n "$count "
    mkdir mnt$count
    if [ ! -b /dev/loop$count ]
    then
mknod /dev/loop$count b 7 $count
    fi
    mount file.img mnt$count -o loop,ro || rmdir mnt$count
    let count++
done
echo "done"

mount | grep "loop" > loops.lst

echo -n "umount all..."
let count=0
while [ $count -lt $MAX_LOOPS ]
do
    echo -n "$count "
    umount mnt$count && rmdir mnt$count
    let count++
done
echo "done"
hn-lt:~/loop-test # ./loops.sh
Create image...200+0 records in
200+0 records out
96 inodes
200 blocks
Firstdatazone=7 (7)
Zonesize=1024
Maxsize=268966912

done
mount all...0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 done
umount all...0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 done