You can not mount a disk or partition without having a filesystem on that. As the file
disk contains all zeros there is not any filesystem on that.
First, to create a loop device on that file call
sudo losetup -f disk
which will create a loop device for the file 'disk'. With
sudo losetup you will get a list of loop devices; note the one that is connected with your disk. I assume
/dev/loop0from now on.
Next to create a valid filesystem, you have to call
sudo mkfs -t [type] /dev/loop0
where [type] means the filesystem type, e.g. ext4. For more options see
Now you are able to mount:
sudo mount /dev/loop0 /media/LFS
which should then be accessible as normal filesystem.
To disconnect, you have to unmount (
sudo umount /media/LFS) and detach the loop device (
sudo losetup -d /dev/loop0). From then on, you can mount the filesystem as you tried in your question (mounting with -o loop will create the loop device for you).
And no, you do not need to have the device partitioned. And you may of course mount a filesystem on a non-empty folder - but then you cannot access the previous contents of this folder before you unmount again.
If you want the image file to work like partitioned disks and be recognized by the kernel, you may follow the answer given in how to format.... In short:
Partition the image:
# fdisk disk which will run fdisk as usual and you may create partitions.
Create Filesystems: As mkfs does not work with
whole disks if they are partitioned (just may use the raw disk as one filesystem as stated above), you best use loop device with
kpartx to inform the kernel. The simplest way is to run
# sudo losetup -f -P disk, which will create partition devices as e.g.
/dev/loop0p2 etc. These may then be used by
gparted: As gparted calls the default tools like
mkfs, the points above hold true as well. You can call
# sudo gparted disk and then partition the disk, but you cannot format those partitions, as
mkfs then asks for distinct images like
disk2 etc. So you should use the loop device with gparted as well:
# sudo losetup --show -f -P disk
# sudo gparted /dev/loop0
--show here so
losetup will show which device is created).
Now you are able to work with gparted as usual. The partitions, when created/formatted, will then be available to other applications like filemanagers (maybe you have to issue
sudo partprobe /dev/loop0 for the kernel to recognize the partitions).
I did not manage to get the loop device shown in
gparted when called without directly passing the name of the loop device, even after issuing
kpartx, e.g. when starting from the system menu. It only shows /dev/sdx devices. Maybe someone else is able to solve this issue.