I am trying understand what the difference is between two ways of creating a loop
mount point. Now I can create this with:
sudo mount -o loop /file_to_use /mntpoint
, andsudo losetup /dev/loop1 /file_to_use
and then mountsudo mount /dev/loop1 /mntpoint
Question:
Are these the two processes the same as I have tested them and there both result in the same mount points as seen here, but I could be wrong?
NAME FSTYPE LABEL UUID MOUNTPOINT
sda
├─sda1 ext4 7af461fe-8d2d-4499-a12a-72ff586ff5d6 /boot
├─sda2 swap 44744c25-8797-4cd2-b83e-f129e97efc85 [SWAP]
├─sda3 ext4 3d39068d-96da-4f90-be42-b0921fb7278e /
└─sda4 ext4 643c8738-9823-43cd-b2b2-efe0b81b7611 /home
sr0
loop0 ext4 ac7deda8-7f3b-4835-8308-e4020ffe5302 /mnt/vfs
loop1 ext4 68a0676b-ad59-4dff-9c50-eca5d972c1c7 /mnt/tempdir
Yes, both are essentially doing the same thing. Refer to man page of mount: https://linux.die.net/man/8/mount
Bonus:
sudo mount /file_to_use /mntpoint
will work too. mount will automatically setup a loop device for you!