2017-06-25 20:41:09 +01:00
|
|
|
# losetup
|
|
|
|
|
|
|
|
> Set up and control loop devices.
|
2021-08-16 11:34:01 +01:00
|
|
|
> More information: <https://manned.org/losetup>.
|
2017-06-25 20:41:09 +01:00
|
|
|
|
|
|
|
- List loop devices with detailed info:
|
|
|
|
|
|
|
|
`losetup -a`
|
|
|
|
|
|
|
|
- Attach a file to a given loop device:
|
|
|
|
|
2024-06-11 05:47:57 +01:00
|
|
|
`sudo losetup {{/dev/loop}} /{{path/to/file}}`
|
2017-06-25 20:41:09 +01:00
|
|
|
|
2020-01-24 21:40:35 +00:00
|
|
|
- Attach a file to a new free loop device and scan the device for partitions:
|
|
|
|
|
|
|
|
`sudo losetup --show --partscan -f /{{path/to/file}}`
|
|
|
|
|
|
|
|
- Attach a file to a read-only loop device:
|
|
|
|
|
2024-06-11 05:47:57 +01:00
|
|
|
`sudo losetup --read-only {{/dev/loop}} /{{path/to/file}}`
|
2020-02-05 18:22:17 +00:00
|
|
|
|
|
|
|
- Detach all loop devices:
|
|
|
|
|
|
|
|
`sudo losetup -D`
|
|
|
|
|
|
|
|
- Detach a given loop device:
|
|
|
|
|
2024-06-11 05:47:57 +01:00
|
|
|
`sudo losetup -d {{/dev/loop}}`
|