1

I have created a loop device and added it to /etc/fstab

I got its UUID from the output of the blkid command (it does print a UUID for the particular device after running mkfs.ext4 /path/to/loop)

However despite the fact that after editing /etc/fstab the command mount -a was successful, the system after the reboot halted.

Insted the following entry in /etc/fstab seems to do the job:

/path/to/loop    /mountpoint    ext4 loop 0 0

Why replacing /path/to/loop with UUID breaks things?

1

Only block devices have UUIDs (that can be found).

A file is not a block device, the loop device turns it into one.

So for the UUID of an image file to be found, the loop device must exist first.

However, your fstab entry is a loop mount, i.e. the loop device is only created when you mount it (and immediately removed on umount), so it does not exist before you mount it (and after you umount it), and so... the UUID is not found because the loop device does not exist.

For loop mounts, it's completely fine to specify the file by path.

Otherwise you'd need an init script that sets up loop devices before attempting to mount them (and then get rid of the loop mount option).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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