Search notes:

/dev/loopX

/dev/loopX (X being a number) is a loopback device.

Example

Create a file with a size of 1 GiB:
$ dd of=~/fs if=/dev/zero bs=GiB count=1
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 5.0458 s, 213 MB/s
Verify file size:
$ stat -c %s ~/fs
1073741824
Associate the file with a loopback device:
$ sudo losetup /dev/loop0 ~/fs
Create a filesystem:
$ sudo mkfs.ext4 /dev/loop0
…
Creating filesystem with 262144 4k blocks and 65536 inodes
…
Mount the new file system:
$ mkdir ~/mnt
$ sudo mount /dev/loop0 ~/mnt
Use the new file system:
$ ls /mnt
lost+found

See also

/dev

Index