[FSO] losetup trouble

Alex Osborne ato at meshy.org
Sat Oct 4 04:24:35 CEST 2008


On 04/10/2008, at 2:51 AM, rhn wrote:

> root at om-gta02:/media/card# touch /dev/loop0
> root at om-gta02:/media/card# losetup /dev/loop0 bigfile
> losetup: /dev/loop0
> root at om-gta02:/media/card# ls -l /dev/loop0
> -rw-r--r--    1 root     root            0 Oct  3 16:31 /dev/loop0

I'm surprised losetup didn't complain. There's not much point in  
making loop0 a regular file.  I have not tried usb storage but:

pico:~# ls -la /dev/loop0
brw------- 1 root root 7, 0 Oct  4 12:08 /dev/loop0
pico:~# dd if=/dev/zero of=foo bs=1k count=1k
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB) copied, 0.208113 s, 5.0 MB/s
pico:~# mke2fs foo
mke2fs 1.41.1 (01-Sep-2008)
pico:~# mkdir /mnt/tmp
pico:~# mount -o loop foo /mnt/tmp/
pico:~# ls -la /mnt/tmp/
total 17
drwxr-xr-x 3 root root  1024 Oct  4 12:12 .
drwxr-xr-x 5 root root  4096 Oct  4 12:12 ..
drwx------ 2 root root 12288 Oct  4 12:12 lost+found
pico:~# mount | grep foo
/root/foo on /mnt/tmp type ext2 (rw,loop=/dev/loop0)

I imagine normally /dev/loop* should be created by udev.  The fact  
that it doesn't exist might indicate that you don't have loopback  
device support in your kernel.  Check this:

pico:~# grep loop /proc/devices
   7 loop

If it's not there try "modprobe loop".

If it is there, delete your bogus /dev/loop0 and recreate it like this:

mknod /dev/loop0 b 7 0



More information about the community mailing list