How to create ext3 filesystem on regular file?

After doing something like:

dd if=/dev/zero of=ext3.img bs=1024 count=1048576

I'd like to put an ext3 filesystem on ext3.img. What should I run? Thanks

Either

mkfs -t ext3 ext3.img

, or

mkfs -t ext3 $( losetup -sf ext3.img )

The second version will bind the image file to a loopback device which can be used like any other device.

1 Like

EDIT: Alright nevermind though I still had a problem but I didn't. Thanks