Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to make a 40GB ext3 local loopback file system. This loopback filesystem is stored on my NAS which is mounted on a Ubuntu Precise 12.04 x64 machine using NFS. The machine has both read and write permissions on the NAS.

I've created a 40GB file for use by running dd if=/dev/zero of=/media/vps/Ironman.ext3 bs=1024 count=40000000. The file was successfully created, so I mounted is as a loopback system in /dev/loop0 by running sudo losetup /dev/loop0 /media/vps/Ironman.ext3.

I'm now trying to format this as a ext3 file system by running sudo mkfs -t ext3 -q /media/vps/Ironman.ext3. However, whenever I run this command I get the following output:

mke2fs 1.42 (29-Nov-2011)
/media/vps/Ironman.ext3 is not a block special device.
Proceed anyway? (y,n) y
/media/vps/Ironman.ext3: Permission denied while setting up superblock

How can I get around this, and format the loopback device as ext3?

Update 1

I've just tried to format it using the loopback device, as seen below. I am still, however, getting permission denied. You can see in the first set the file was already mounted.

danielsgroves@precise64:/dev$ sudo losetup /dev/loop0
/dev/loop0: [0015]:26378243 (/media/vps/Ironman.ext3)
danielsgroves@precise64:/dev$ sudo mkfs -t ext3 -q /dev/loop0
/dev/loop0: Operation not permitted while setting up superblock

Update 2

With verbose output

danielsgroves@precise64:/dev$ sudo mkfs -t ext3 -v /dev/loop0
mke2fs 1.42 (29-Nov-2011)
fs_types for mke2fs.conf resolution: 'ext3'
/dev/loop0: Operation not permitted while setting up superblock
share|improve this question
Try using -v rather than -q, to hopefully get more details about what's failing. – Michael Kjörling Oct 1 '13 at 9:22
OK, the only thing I can think of is to use mke2fs directly rather than going through mkfs. sudo mke2fs -j -v /dev/loop0 will give you an ext3 file system with defaults otherwise. I just tried it myself (except I used a much smaller image file) and it seems to be working fine for me on Debian Wheezy, which shouldn't be that different. – Michael Kjörling Oct 1 '13 at 9:29
Output is line-for-line the same as using mkfs. I don't recall having these issues last time I did this a few months back. – Daniel Groves Oct 1 '13 at 9:31
This is really weird. Sorry, but I'm running out of immediate ideas to try. Hopefully someone else will be able to take this and provide some insight! – Michael Kjörling Oct 1 '13 at 9:38
Thanks, I appreciate your help :) – Daniel Groves Oct 1 '13 at 13:06

You need to create the file system on the loop device, not the file that backs the loop device. (This is what the "not a block special device" warning from mke2fs is about.) The backing file is only a matter of consideration for the "loop device" code in the kernel, and you won't be using it directly except in the losetup command. The "permission denied" error may very well be because you are trying to directly modify the backing file of a currently active loop device; doing so could conceivably easily wreak all kinds of havoc, so the kernel likely (sanely) prevents you from doing it even as root.

After running losetup, use sudo mkfs -t ext3 -q /dev/loop0 instead and it should work just fine. Then mount /dev/loop0 wherever you prefer (like, say, sudo mount /dev/loop0 /media/ironman).

This might become more clear if you consider the other options available to losetup, including --offset and --sizelimit (check the man page for more examples).

share|improve this answer
Even trying to format the loopback directly I get the same error. I've just added details showing the output the the question. – Daniel Groves Oct 1 '13 at 9:21
@DanielGroves Yes, I saw. I'll leave this answer around for now though, as it's an important (and perhaps not completely obvious) point to remember about loop devices. – Michael Kjörling Oct 1 '13 at 9:22

Okay, this message is very old, but has no answer.

I just had the same problem. The issue for me was that over NFS the root user has no special ability to read & write to a file.

One thing you can do is change the owner of the file to root, or you can put it in the root group and make it group writable.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .