-
-
Save carepack/9e6857db3f4aa20cf5fc875e47778419 to your computer and use it in GitHub Desktop.
Mounting and unmounting raw disk images which have one partition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/dev/loop0 and /dev/loop1 are assumed to be free, otherwise use 'losetup -f' and store the result | |
losetup /dev/loop0 disk.img | |
kpartx -as /dev/loop0 | |
losetup /dev/loop1 /dev/mapper/loop0p1 | |
mkdir disk | |
mount /dev/loop1 disk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
umount disk | |
losetup -d /dev/loop1 | |
kpartx -ds /dev/loop0 | |
losetup -d /dev/loop0 | |
rmdir disk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment