Skip to main content

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).

Filter by
Sorted by
Tagged with
0 votes
0 answers
24 views

Coldsnap download disk.img not getting mounted on linux machine

I am trying to mount an image file which has been downloaded by coldsnap for a snapshot of AWS, but I am unable to mount it in Amazon Linux 2. I Tried multiple commands as mount -o loop disk.img /mnt/...
Jayesh Desai's user avatar
4 votes
0 answers
147 views

Why is a loop device called a "loop" device?

As far as I understand, a loop device is a regular file that acts as a block device. It's used for various things like isolation in snap packages and installing ISOs over an existing filesystem. But ...
raul's user avatar
  • 41
1 vote
1 answer
42 views

Is it safe to write to file's extents directly while the FS is r/w?

Given any file on an ext4 filesystem, it is possible (using filefrag -v) to get the list of real offsets+lengths where that file is located on the underlying block device. Is it safe to open the ...
melonfsck's user avatar
3 votes
1 answer
59 views

Loop partitions disappear on rebind

When I create a 400MB file called /tmp/foo, then call losetup -f /tmp/foo, this creates a loop device /dev/loop15. If I then partition the loopdevice and format it to contain ext4,ntfs, and fat32 ...
mo FEAR's user avatar
  • 192
1 vote
1 answer
443 views

How to modify (add files or directories) to the qemu-img created raw disk file?

How to add files or directories to the qemu-img created raw disk file. For example. I use qemu-img create -f raw disk.raw 1G to generate a disk.raw file. I want to copy some /bin, /usr directories to ...
Zhaoyang's user avatar
0 votes
0 answers
92 views

parted not recognizing loop device

I created a loop device with $ truncate -s 20G test.img $ losetup -fP ./test.img $ losetup -a /dev/loop0: [0032]:4051 (/tmp/test/test.img) lsblk is able to see it just fine $ test]# lsblk NAME ...
wasp256's user avatar
  • 209
1 vote
2 answers
378 views

mount paritions manually without a partition table in linux

I am trying to programmatically mount partition tables in linux with a partition table. Heres what I did so far to see if I can mount a partition in backup with a damaged drive (deleted partition ...
CarriMegrabyan's user avatar
0 votes
0 answers
30 views

sdm says the device is already mounted

Ubuntu 23.04, sdm v8.6, after rebooting the system I issue: sdm --customize \ --L10n \ --apt-dist-upgrade \ --autologin \ --hdmi-force-hotplug \ --journal none \ --nowait-...
Mark's user avatar
  • 733
5 votes
1 answer
552 views

Can loop devices be automatically cleaned up when a process exits?

I'm trying to figure out a clean and safe way to use loop devices inside of a build script. To the best of my knowledge loop devices are required if you want to (GPT) partition and (FAT32, EXT3) ...
Philip Couling's user avatar
-1 votes
1 answer
172 views

What are these empty 0B SIZE read-write loop devices?

What are these empty (0B SIZE) read-write loop devices? sudo lsblk --all NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS loop0 7:0 0 0B 0 loop loop1 7:1 0 0B 0 loop loop2 7:2 ...
adrelanos's user avatar
  • 1,886
1 vote
1 answer
147 views

How to loop-mount Ubuntu boot drive backup LVM with duplicate UUID

I created a backup of my LUKS-encrypted Ubuntu installation's entire boot drive as a squashfs file. The backup was performed by using Streaming Compression into a pseudo file, resulting in a ...
localhost's user avatar
  • 243
1 vote
1 answer
243 views

Does loopback-device-backed-LVM operations such as lvextend need call sync afterward?

There is an os image file say test.dd, and an LVM managed partition inside. Enlarge the os image file size, then enlarge the partition size to full. Create a loopback device for test.dd, then get the ...
osexp2000's user avatar
  • 532
0 votes
1 answer
299 views

Why does 'mount' fails when trying to mount partitions of a virtual disk that has two parititons?

I am trying to make a virtual disk with two partitions. First a 100M FAT (type 0xC) and second a 2G Linux partition (type 83). I have a process that does this correctly with a real USB device. But I ...
Ryan Buton's user avatar
0 votes
1 answer
90 views

Strange behavior of the mount dir when mount an EFI partition in a virtual block device (loop device)

In my WSL2 Debian distro, I created an image file named VirtDisk.img and set it as a virtual block device: dd if=/dev/zero of=VirtBlock.img bs=1G count=16 16+0 ...
Color Glass's user avatar
0 votes
1 answer
167 views

EXT partition seen as unpartitioned space in loop device on Ubuntu 22.04.1

I am trying to create a disk image file with an EXT2 partition, however the partition is not found and entire loop device is seen as free/unpartitioned space. My computer can read Ext2 formatted disks,...
PerkyElixir22's user avatar
2 votes
1 answer
360 views

Create writable file system using udisksctl

To be able to test out of disk situations I tried to set up a file-based size-limited file system like this: $ dd if=/dev/zero of=file.fs bs=1MiB count=1 $ mkfs.ext4 file.fs $ udisksctl loop-setup -f ...
Zitrax's user avatar
  • 274
3 votes
1 answer
5k views

Can't remove or unmount loop device on Debian

I have a loop device which shows up when I do losetup --all that I have been unable to remove. So, I basically got myself into this issue because a created a raw image of a microSD card and then I ...
AeroMaxx's user avatar
  • 199
6 votes
1 answer
1k views

kpartx: cannot unmount disk after mappings have been deleted

I cannot unmount a partition on which I created and then deleted mappings with kpartx: # mount /dev/sdb1 usb/ # cd usb/ # kpartx -a -p sda -r -s -v sda.img add map loop0sda1 (254:5): 0 16777216 ...
Martin Vegter's user avatar
0 votes
2 answers
733 views

Boot loop device as root file system

I created an ext4-filesystem on a loop device with all necessary files to boot with, e.g.: /bin /boot /dev /lib /mnt /etc ... Now I want to boot from the loop device as an image (let's say ...
User100700's user avatar
1 vote
1 answer
3k views

No loop device in container even with loop module loaded

I am trying to make it possible to make and mount loop devices from within a container. This happens to work on my own development system, but is failing to work on our build server where it must be ...
Andrew Falanga's user avatar
0 votes
1 answer
837 views

How to recover an iSCSI disk

I run an iSCSI disk on a Linux server (RHEL7). The disk has a normal ext4 partition containing a loop device called disk01.img, which is mapped to a virtual disk with a Windows NTFS file system. All ...
roelvdh's user avatar
0 votes
1 answer
777 views

Partitions for loop device not found from script, visible elsewhere

I'm currently trying to partition and then format a disk image using parted, by first mounting a blank disk image onto a loop, creating the appropriate partitions, and then formatting these partitions ...
Larry's user avatar
  • 101
0 votes
1 answer
326 views

Why do we need to set loop devices when mounting ddrescue images?

In various tutorials I see the following command: mount -o ro,loop,offset=123 harddrive.img /mnt/loop but from reading the documentation I can't understand what are loop devices. Why would harddrive....
Fractale's user avatar
  • 123
1 vote
2 answers
2k views

loop-device performance issue

I am trying to work with dm-mapper and it doesnt accept files. so i need a device. So i have created a 1500M file on ram(ramfs filesystem) at /dev/shm/f and mapped it to /dev/loop0(by losetup). But i ...
14f6A21's user avatar
  • 11
4 votes
1 answer
4k views

losetup: How to use the -f option?

For example, I would like to setup mydata.img to /dev/loop5, I would expect using the command below. However it gives the error losetp: unexpected arguments. losetup --show -Pvf /dev/loop5 mydata.img ...
midnite's user avatar
  • 443
1 vote
0 answers
3k views

"failed to setup loop device" when mounting an Ubuntu iso image on Ubuntu

I downloaded an iso image of Ubuntu server, ubuntu-20.04.3-live-server-amd64.iso. Then I tried to mount this iso as a folder, using the usual command mount ubuntu-20.04.3-live-server-amd64.iso ./iso ,...
zzzhhh's user avatar
  • 155
1 vote
0 answers
22 views

How to mount partition of .img as loop back device Ubuntu 20.04 [duplicate]

I need to create a bootable disk image on a remote computer but keep getting errors trying to mount partitions created on the .img file I have tried many different utilities but the basic steps I am ...
wadesalazar's user avatar
0 votes
1 answer
164 views

.img file mounted, want to see file updates without having to remount

I have a raspberry pi that is emulating a mass storage device, while having the backing .img file mounted. Once the pi is powered up and the .img is mounted, I turn on the mass storage emulation. I'm ...
David's user avatar
  • 131
3 votes
2 answers
1k views

Why is it possible to "loop" a filesystem by mounting it to one of its folders?

/dev/sda5 is mounted at / and it's my filesystem piotr@thinkpad:~$ sudo mkdir /home/mpoint piotr@thinkpad:~$ sudo mount /dev/sda5 /home/mpoint so now I can do: piotr@thinkpad:~$ cd /home/mpoint/home/...
pjk's user avatar
  • 323
0 votes
0 answers
191 views

Can loop device slots be reserved at boot for later use?

I'm working with a mounted root file system image in chroot that requires specific loop device numbers, and I need /dev/loop1 through /dev/loopN to be available for use after boot is completed, but ...
seamux's user avatar
  • 148
0 votes
1 answer
3k views

A lot of loop devices in the system

I have the following picture: $ sudo lsblk -f NAME FSTYPE LABEL UUID MOUNTPOINT loop0 squashfs /snap/code/58 loop1 ...
Dims's user avatar
  • 3,285
1 vote
0 answers
550 views

I accidentally wrote to a deleted file (loop device)

I accidentally wrote to a delete file through the loop device. OS: Ubuntu 20.04 Here is my scenario: 1 - I created a RAW image file: # qemu-img create -f raw sda.img 10G 2 - I created partiton with ...
Laura's user avatar
  • 11
0 votes
0 answers
51 views

Filesystem image made with dd sometimes fails--How to Analyze? [duplicate]

I've googled this extensively and can't quite come up with an answer. Overview I created two image files of a filesystem I'm actively using (/) and it sometimes is ok, and othertimes is not. What I do ...
tgm1024--Monica was mistreated's user avatar
1 vote
2 answers
661 views

mount: mydir: cannot mount my.iso read-only

I am trying to mount an ISO file: $ sudo mount isodir/my.iso mydir mount: mydir: cannot mount isodir/my.iso read-only. Why?
Ole Tange's user avatar
  • 35.8k
0 votes
0 answers
559 views

How to sync a loop device when the backing file is changed

The data being displayed on a loop device mount is incorrect when the data in the underlying file is changed. Example: $ mkdir drv $ dd if=/dev/zero of=data.ext4 bs=1M count=10 $ mkfs.ext4 data.ext4 $ ...
Michael Mullin's user avatar
-1 votes
1 answer
1k views

WRITE_ZEROES not supported on loop devices

I ran into a strange problem where mkfs.ext4 won't work on loop devices backed by a temp file. tmp_file="$(mktemp)" fallocate -l 8M "$tmp_file" loop="$(losetup --show -f "...
user avatar
2 votes
1 answer
5k views

How to shrink a file image, produced with dd?

I tried the process from this post resize partition on an image file. I didn't succeed in understanding why it goes wrong in my case. I produced a 8GB image using dd. The image contains two partitions....
sugarman's user avatar
  • 193
4 votes
2 answers
9k views

How to increase the size of a loop virtual disk?

I have generated an image file with dd. The image contains two partitions. I created a loop virtual disk: losetup -P /dev/loop0 $image_file. I mounted the two loop created partitions (loop0p1, loop0p2)...
sugarman's user avatar
  • 193
2 votes
1 answer
1k views

Mounting as <user>, a loop still assigns root ownership

I am trying to set up a virtual drive from a file. This file will then be written to a flash device (not relevant). Because creating and manipulating the virtual drive will be in a script, I need to ...
Sean Walton's user avatar
3 votes
2 answers
5k views

Why does mount -o loop return "No such device"?

I want to mount the contents of an iso9600 (CD) image via a loop to access its contents. To do so I execute mount -r -t iso9600 -o loop file.iso mountpoint/ and would expect the contents in the (...
stefanct's user avatar
  • 636
0 votes
1 answer
439 views

how to mount and read from the .img file used by usb_gadget/g_multi/mass_storage?

the pocket beagle, using debian9.9, shows up as a mass storage device on my windows machine. I have found the backing file (i'll call it a drive) used by the mass storage device. I would like to mount ...
bat's user avatar
  • 148
4 votes
0 answers
402 views

Is it safe to enable Direct I/O for a loop device backed by a sparse file?

I'd like to have a sparse file, and mount it as a filesystem. It'd be great if the performance overhead is negligible, but only if that doesn't come with a data-loss risk! Is it safe to mount the ...
semekh's user avatar
  • 141
7 votes
2 answers
2k views

Mount a PV image as a readonly loop device (again - it used to work)

A couple of years ago I upgraded my netbook with a larger hard drive. I wanted to retain the contents of the old hard drive in case there was anything I still wanted off it. So I copied the the old ...
Adrian Pronk's user avatar
1 vote
1 answer
3k views

Cannot mount dislocker-file loop: wrong fs type, bad option, bad superblock

I am trying to mount a bitlocker encrypted drive with dislocker. Here are the exact commands I ran: sudo dislocker -r -V /dev/sdb7 -u -- /media/bitlocker sudo mount -r -o loop /media/bitlocker/...
Anonymous Guy's user avatar
2 votes
0 answers
433 views

A microSD card backup (Raspberry Pi) has always a corrupt ext4 filesystem although the original seems to be fine

Every backup image of my Raspberry Pi microSD card seems to be corrupt. It doesn't make a difference if I create an image file or if I backup the microSD card directly to some other microSD card. I'...
kurcze's user avatar
  • 331
1 vote
0 answers
973 views

How to properly boot ISO9660 looped image with latest GRUB versions?

I'm trying to boot Ubuntu live ISO9660 image with GRUB 2.04 using these instructions. It is failing to boot with GRUB error error: unknown filesystem, even though I can browse as well the boot ...
drws's user avatar
  • 421
0 votes
0 answers
407 views

OSX: how to mount raspberry pi image file?

BACKGROUND The loop device is available in Ubuntu and is the first step to processing the rPi image with zerofree. The goal is to reproduce the UBUNTU example with OSX High-Sierra: UBUNTU example ...
gatorback's user avatar
  • 1,384
2 votes
1 answer
339 views

Creating a grow-on-demand loop filesystem without sparse files

I wish to create a file to loop mount as a root filesystem that grows dynamically as required (up to a limit). The commonly quoted solution to this is to use a sparse file, which would do exactly ...
KaelanDuck's user avatar
2 votes
2 answers
4k views

Why is mount mounting the directory to /dev/loop0 instead of the device? Can't write all my files to the directory as a result (since it's too small)

I want to write about 38 MB of files to a partition that is 100 MB large. However, when I mount that partition to the directory, it mounts to /dev/loop0 instead of /dev/sdc1 (in my example). This ...
sakana-boy's user avatar
2 votes
2 answers
3k views

Mounting a Luks partition

I have backed up a drive with all its partitions using the command dd if=/dev/sda of=/media/oshirowanen/external-drive/backups-2019/full_drive_backup.img /dev/sda is an ssd which has a Linux OS ...
oshirowanen's user avatar
  • 2,631