# mkfs on loop device hangs

## Gentree

Hi,

I'm trying to make a ext3 fs inside a loopback device but it hangs. 

```
bash-4.0#dd if=/dev/zero of=/back/nfs bs=1M count=60

bash-4.0#du -h /back/nfs

60M     /back/nfs

bash-4.0#losetup -f

/dev/loop/0

bash-4.0#losetup /dev/loop0 /back/nfs

bash-4.0#mkfs.ext3 /dev/loop0 

mke2fs 1.41.9 (22-Aug-2009)

Filesystem label=

OS type: Linux

Block size=1024 (log=0)

Fragment size=1024 (log=0)

15360 inodes, 61440 blocks

3072 blocks (5.00%) reserved for the super user

First data block=1

Maximum filesystem blocks=62914560

8 block groups

8192 blocks per group, 8192 fragments per group

1920 inodes per group

Superblock backups stored on blocks: 

        8193, 24577, 40961, 57345

Writing inode tables: done                            

Creating journal (4096 blocks): done

Writing superblocks and filesystem accounting information:
```

No cpu load is just hangs and remains in ps. Seems to be unkillable IO so I have to reboot to clear it.

I did this for something else a while back and it was perfect. 

kernel has loopback builtin , no crypto.

Am I missing something?

TIA, Gentree.   :Cool: 

----------

## NeddySeagoon

Gentree,

I've always made the empty file then run mke2fs on the file, not the /dev/loop0 device.

Also, you should not use a journalled fs in a file on top of a journelled filesystem ... think about it.

Everything passes through the host jounal anyway.

----------

## Gentree

thanks Neddie.

in fact that's where I started using the file name but it hung on mount. I started googling and found several references using the loop device. Doing as you suggest succeeds in creating the fs but now I'm back to it hanging during mount.

```

8192 blocks per group, 8192 fragments per group

1920 inodes per group

Superblock backups stored on blocks: 

        8193, 24577, 40961, 57345

Writing inode tables: done                            

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 30 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

bash-4.0#

bash-4.0#mount -o loop /back/nfs /mnt/nfs

```

Something's screwed here it seems. 

 :Confused: 

----------

## NeddySeagoon

Gentree,

try 

```
mount -o loop -t ext3 /back/nfs /mnt/nfs
```

if its ext3

----------

## eccerr0r

Did it work for the particular kernel you're using before?

Are you still using 2.6.29 as in your signature?  What patches do you have?

Can't seem to reproduce the issue in 2.6.30-vanilla...

Also, does

dd if=/dev/loop0 of=/tmp/scratch bs=1k count=1

or some other attempt at reading the loopfs after it's configured, work?

----------

## Gentree

Thanks to you both.

```
dd if=/dev/loop0 of=/tmp/scratch bs=1k count=1 
```

works fine.

```
-su-4.0#mount -o loop -t ext3 /back/nfs /mnt/nfs
```

hangs as before.

2.6.29-hh1 is correct (well hh2 in fact). This is a reiser4 patched kernel and the underlying fs is R4. I'm now thinking this may be the cause of the problem.

I had some odd behaviour a year or so ago using a debian root fs via nfs on R4 , recurrence of nfs/r4 issues is the reason I'm into this now. I was able to get around it last time by doing just this technique and using ext3 inside a loopback on R4. 

It looks like since H.R. got a job breaking rocks the valiant Eduard Shuskin is having trouble keeping up with quicksand of the linux kernel changes.

I could try a more recent kernel but , for reasons I won't detail , that will imply a whole new development cycle in some otherwise tested code. I'd prefer to avoid that.

This lack of respect for backwards compatibility will be the end of linux as an installable OS. Corporate business seems to found a way to convert into an online  service. I don't like the way this is going.

Having satisfied myself it's not just me messing up, I'll conclude it's an R4 issue on 2.6.29

The bottom line seems to be shifting the nfs mount to a native ext3 space somewhere. 

Thanks to all for your help.   :Cool: 

----------

