Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How do I create a file of size 10M, format it with ext3 filesystem and then mount it in /media/fuse?

I tried with

mkfs -t ext3 file

then to mount it

mount -t ext3 file /media/fuse

It didn't work because it said that file wasn't a block device. Can anybody help me?

share|improve this question
5  
You just have to add -o loop to the mount command. –  enzotib Dec 7 '11 at 19:54
    
A great tutorial here: ibm.com/developerworks/linux/library/l-linux-filesystem –  arrange Dec 7 '11 at 20:07
    
To loop-mount a ISO file, I do this mount -o loop file.iso /media/iso. –  Anonymous Dec 7 '11 at 20:50
    
@enzotib Can you post that as an answer to be upvoted/accepted please? –  Tom Brossman Feb 28 '12 at 18:17
    
@TomBrossman: done –  enzotib Feb 28 '12 at 18:47
add comment

1 Answer

Your procedure is correct, but when mounting a file image as a filesystem you have to add the -o loop option to the mount command:

mount -t ext3 -o loop file /media/fuse

Also, the -t ext3 option is not strictly required, because mount can automatically determine the filesystem type.

share|improve this answer
    
he is right but forgot to add the way to create a file dd if=/dev/zero of=file bs=1024 count=10240 this is the way to create a 10Mb file... then you can format it with mkfs.ext3 –  maniat1k Feb 28 '12 at 19:20
2  
Now mount does not need the -o loop option anymore, it can understand by itself we it need it. –  enzotib Oct 3 '13 at 12:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.