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).
189 questions
2
votes
1
answer
2k
views
Creating dual-partition SD card image by a script
I have a system that generates embedded Linux systems. The system outputs three files:
a tarball containing rootfs excluding the kernel modules
a tarball containing the kernel modules
uImage
The ...
3
votes
1
answer
942
views
Why does kpartx use a new loop device each time?
I'm running kpartx from within a python script as part of a custom OS build I'm trying to do. I'm using python sh module to run bash commands.
sh.kpartx("-as", image) is how I attach my image.
Then ...
3
votes
0
answers
4k
views
loop devices don't go away properly
I have a script that I use to mount diskimages that are LVM images. it does:
x=`losetup -f` #create a loop device
echo $x > loopdev #echo that device to a file for later use
losetup $x ...
0
votes
1
answer
386
views
umount -l: Kernel is referring to removed, non-existent device
I am getting messages such as:
kernel: Buffer I/O error on dev sdb1, logical block 107390598, async page read
In actuality, the USB HDD sdb has been removed: lsblk also shows no mention of sdb.
I ...
4
votes
2
answers
25k
views
Can't mount disk image
I have a disk image file I'm trying to mount locally using a loop device. Using parted I can see the image has two partitions, however, I'm not able to mount the first partition and losetup thinks the ...
7
votes
2
answers
5k
views
Mounting a file system image inside an unshared namespace
I'm using unshare to perform things like bind mounts local to a certain process without requiring root access, e.g.:
unshare -mr bash mount --bind a b
(Yes, this seems kinda dumb; in my actual use ...
3
votes
2
answers
3k
views
How to calculate the correct size of a loopback device filesystem image for debootstrap?
I'm using debootstrap to create a rootfs for a device that I want to then write to an image file. To calculate the size needed from my rootfs, I do the following:
local SIZE_NEEDED=$(du -sb $...
1
vote
0
answers
1k
views
How to create and mount a loop-device with guestmount?
The goal is to test the out of disk space condition.
Creating an image:
dd if=/dev/zero of=test bs=1024 count=10000
Mountpoint:
mkdir mountpoint
Mounting fails:
guestmount -a test -m/dev/sda ...
2
votes
1
answer
1k
views
loopback file system is slow
I created a virtual file system as follows:
dd if=/dev/zero of=/home/tmpfs/fs.img bs=4096 count=600000
mke2fs -F -t ext4 -q /home/tmpfs/fs.img
mount -o loop=/dev/loop6 /home/tmpfs/fs.img /home/test
...
18
votes
4
answers
29k
views
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-...
5
votes
2
answers
8k
views
Loop mounting files vs mounting directories [duplicate]
I was reading Trouble with understanding the concept of mounting and came across this explanation:
By using mount -t iso9660 /dev/cdrom /media/cdrom, you tell the system: "take this very long string ...
2
votes
1
answer
6k
views
how to add a loop device on fedora 23 with losetup?
in an attempt to access a truecrypt container, I stumbled about the prerequisite of setting up a loop device...
ncoghlan suggested in an earlier answer
When you run it as root, losetup -f will ...
8
votes
1
answer
5k
views
Overhead of using loop-mounted images under Linux
Is there a CPU/RAM overhead associated with using loop-mounted images versus using a physical partition under Linux?
64
votes
6
answers
112k
views
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 ...
2
votes
1
answer
3k
views
Using Device mapper thin provisioning on loop devices
I have several KVM raw files that are read only (about 100gb).
I am adding these raw files as loopback devices.
I then create a snap file to allow the VM to have read/write access to its disk. This ...
3
votes
0
answers
2k
views
Creating a sparse (automatically expanding and contracting) swap file with hole-punching support
I have this crazy idea, and want to know the pitfalls of such an approach (or whether it can even work with no deadlocks.. etc).
The goal is to create an automatically expanding and contracting ...
1
vote
0
answers
98
views
Is it safe to modify underlying file if it's mounted by losetup?
I've got a raw binary file and I need to access it (read-only) as a block device, for compatibility reasons. I mount this file through losetup eg. losetup /dev/loop0 file.bin. The block device is only ...
2
votes
0
answers
684
views
Unable to mount secondary HDD on CentOS 6.7 (Must specify file system?)
I have a secondary HDD that worked fine in Ubuntu 13.04. I had mounted in to /media/user/<some UUID>/. I could read and write files without problem. My Ubuntu installation was on a primary SSD.
...
2
votes
1
answer
5k
views
What is the difference between loop device and block device? [closed]
I want to create a loop device myself, I want it to have a special name, say /dev/loop-test-0. I want it to be up after I reboot the machine. I though that I can use mknod for this, but this doesn't ...
1
vote
2
answers
4k
views
How do users mount .bin/.cue or .iso with loopback device as read only?
Can users mount any of the following image files as read-only using a
loopback device?
If it is possible then can anyone give me examples?
1
vote
1
answer
2k
views
BASH: looping through ls [duplicate]
I'm having trouble with this piece of code:
22 for filename in "$( ls "$1" | grep ".*\.flac$" )"; do
23 file_path="$1${filename}"
24 ffmpeg -i "${file_path}" -f ...
3
votes
3
answers
681
views
Create Linux distro with minimal number of files
I'm thinking about designing a system for a project using some single-board computer (RaspberryPi, CubieTruck etc) that runs Linux.
My main requirement is keeping the complexity of the booted SD card ...
1
vote
0
answers
945
views
Loopback (bind) mount automatically mounting additional ext4 USB drive
I have a USB (ext4) drive connected and it's registered in /etc/fstab. It mounts at /media/Backup fine. I want to mount a specific directory on that drive using a bind / loopback mount (this is ...
9
votes
2
answers
27k
views
Mount an ISO virtually using /dev/sr0 device
I'm doing a study about how CD-ROM can be mounted virtually and all I could find out was mounting using loop devices.
mount -o loop disk1.iso /mount-point
This is fairly easy.
I understand that /dev/...
1
vote
3
answers
916
views
How does cfdisk fix my disk image?
I'm working on a huge complex application. You connect a disk, press a button, and it partitions and formats the disk, mounts it, and copies some files onto it.
To test this application, we have a ...