Timeline for How to run mkfs on file image partitions without mounting?
Current License: CC BY-SA 3.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 12, 2020 at 14:28 | comment | added | cas |
BTW, the OP said nothing about not wanting to run any commands as root, that's entirely your imagination - which isn't really much use as justification for declaring "this should not be the accepted answer". Your other imaginary criterion, performing multiple parallel builds, is also not relevant...and isn't even a problem - the kernel's loop driver defaults to 8 devices, but its max_loop option can override that (up to, IIRC, a maximum of 256 loop devices).
|
|
| Apr 12, 2020 at 14:25 | comment | added | cas |
@Étienne you're missing the obvious. again. The advantage of using losetup rather than mount is that it doesn't mount anything, which is exactly what the OP asked for. mount -o loop is effectively just a short-cut for losetup ...; mount ....
|
|
| Apr 12, 2020 at 9:18 | comment | added | Étienne | @cas what I meant is that a typical use-case for wanting to avoid a mount-loop is to perform parallel builds which don't interfere with each others when using loop devices, and also to avoid running as root. The reply below with mformat allows both things. Using losetup allows neither, so while it is working I wonder what the advantage of losetup vs loop mount is. | |
| Apr 11, 2020 at 2:31 | comment | added | cas |
@Étienne you are mistaken, and you have misunderstood the Q you linked to - it is asking if one command (mount -o loop ...) is basically the same as two (losetup ...; mount ...). losetup is not the same as mounting a filesystem. It tells the kernel to assign one of the loopback devices to a file so it can be treated as if it were a block device, including partitioning it and formatting one or more of the partitions with mkfs. The partitioning can be done without losetup, but the formatting can not because mkfs has no option to use an offset.
|
|
| Apr 10, 2020 at 15:43 | comment | added | Étienne | This should not be the accepted answer. The question is how to do this "without mounting", and losetup is the same thing as doing a loop mount of the file: askubuntu.com/questions/1073467/… | |
| Aug 30, 2019 at 18:47 | comment | added | PF4Public |
Note that mounting / partitioning loopback devices does not always cause kernel to re-read partition table, therefore one should either run partprobe afterwards or initially invoke losetup with -P, --partscan option. See this answer for details: unix.stackexchange.com/a/425641/30230
|
|
| May 10, 2018 at 17:02 | vote | accept | Paul Knopf | ||
| May 7, 2016 at 2:31 | history | edited | cas | CC BY-SA 3.0 |
deleted 10 characters in body
|
| May 7, 2016 at 2:23 | history | answered | cas | CC BY-SA 3.0 |