Questions tagged [loop-device]

A loop device allows any file to be mounted as a filesystem image. Not to be confused with a loopback interface in networking. Don't use this tag for questions regarding "for-loops" (use the "for" tag instead).

A loop device is a pseudo-device that makes any file accessible through a block device. This way, a file containing a filesystem image can be mounted.

Not to be confused with , which is a network interface, or -loop, which is a looping construct for performing iterations in code.

177 questions
79
votes
3 answers

What is a "loop device" when mounting?

I am mounting an ISO file, and looking at this tutorial. They use the command: $ mount -o loop disk1.iso /mnt/disk I'm trying to understand the use of -o loop. I have two questions: When I look at the long man page for mount, it takes time to find…
Vass
  • 5,271
  • 9
  • 38
  • 45
44
votes
3 answers

What is the difference between mount and mount -o loop

I have a iso file named ubuntu.iso. I can mount it with the command: mount ubuntu.iso /mnt. After mounting it, I can see it from the outout of the command df -h: /dev/loop0 825M 825M 0 100% /mnt. However, if I execute the command mount -o…
Yves
  • 3,161
  • 7
  • 26
  • 54
42
votes
5 answers

How to mount qcow2 image

I've read that with qemu-nbd and the network block device kernel module, I can mount a qcow2 image. I haven't seen any tutorials on mounting a qcow2 via a loop device. Is it possible? If not, why? I don't really understand the difference between a…
onlyanegg
  • 975
  • 2
  • 8
  • 9
26
votes
3 answers

How to setup a growable loopback device?

I know I can create and use a loopback device like this: # Create the file truncate disk.img --size 2G # Create a filesystem mkfs.ext4 disk.img # Mount to use mount disk.img /mnt # Clean up umount /mnt However in this case the disk image is fixed…
phunehehe
  • 20,030
  • 27
  • 99
  • 151
21
votes
2 answers

When mounting, when should I use a loop device?

According to the following question: What is a "loop device" when mounting? A loop device is a file that acts as a block-based device. While I can understand that conceptually, how is this different from mounting any other file? For example, if I…
Suchipi
  • 1,229
  • 3
  • 10
  • 21
21
votes
5 answers

Mounting multiple img files as single loop device

Is there a way to take a disk img file that is broken up into parts and mount it as a single loop device?
Tegra Detra
  • 4,908
  • 11
  • 39
  • 53
20
votes
4 answers

Why does one need a loop device at all?

I previously used to create image files using dd, set up a filesystem on them using mkfsand mount them to access them as mounted partitions. Later on, I have seen on the internet that many examples use losetup beforehand to make a loop device entry…
corsel
  • 403
  • 4
  • 13
18
votes
4 answers

How to create a formatted partition image file from scratch?

I need to create filesystem with just one partition from nothing (/dev/zero). I tried this sequence of commands: dd if=/dev/zero of=mountedImage.img bs=512 count=131072 fdisk mountedImage.img n p 2048 131072 Basically, I need to…
user35443
  • 429
  • 1
  • 7
  • 15
17
votes
3 answers

How to add more /dev/loop* devices on Fedora 19

How to add more /dev/loop* devices on Fedora 19? I do: # uname -r 3.11.2-201.fc19.x86_64 # lsmod |grep loop # ls /dev/loop* /dev/loop0 /dev/loop1 /dev/loop2 /dev/loop3 /dev/loop4 /dev/loop5 /dev/loop6 /dev/loop7 /dev/loop-control # modprobe…
user219372
  • 173
  • 1
  • 1
  • 4
17
votes
1 answer

GNU/Linux: overlay block device / stackable block device

GNU/Linux has union mount that overlays dirs. So you can mount a writeable dir on top of a read-only dir. When the writeable dir is unmounted the read-only dir is untouched. I am looking for the same functionality for block devices - preferably with…
Ole Tange
  • 33,591
  • 31
  • 102
  • 198
17
votes
3 answers

How to mount multiple partitions from disk image simultaneously?

I am trying to mount root and boot partition of Raspbian image: mount -v -o offset="70254592" -t ext4 /mnt/X/raspbian-jessie.img /tmp/raspbian mount -v -o offset="4194304" -t vfat /mnt/X/raspbian-jessie.img /tmp/boot mounting boot, when root is…
Grzegorz Wierzowiecki
  • 13,865
  • 23
  • 89
  • 137
17
votes
2 answers

How to find which images belong to which /dev/loop?

I work a lot with imaged drives, meaning a do a dd-copy of the drive in question and then work on the image instead of the drive itself. For most work, I use kpartx to map the drive's partitions to a device under /dev/mapper/. What I'm wondering…
bos
  • 867
  • 2
  • 9
  • 14
15
votes
1 answer

losetup: cannot find an unused loop device

I'm trying to create a loop device, and getting an error I don't understand: # losetup -f /media/2TB/sdb2-fix-file losetup: cannot find an unused loop device I have no loop devices setup. The output from losetup -a is null, and: # ls -l…
Tom Hale
  • 28,728
  • 32
  • 139
  • 229
14
votes
4 answers

How to atomically allocate a loop device?

I am writing some shell scripts to handle some disk image stuff, and I need to use loop devices to access some disk images. However, I am not sure how to properly allocate a loop device without exposing my program to a race condition. I know that I…
AJMansfield
  • 834
  • 1
  • 10
  • 20
11
votes
3 answers

Source path of loop-device

Out of curiosity, I would like to know is there a way to find out the source of mounted partition? For example, output of df -h is: /dev/loop1 3M 3M 0 100% /media/loop From this output, I know a loop device of 3M is mounted at /media/loop, but I…
SHW
  • 14,454
  • 14
  • 63
  • 101
1
2 3
11 12