Created
August 7, 2016 14:58
-
-
Save harish2704/32c84105e0a117fb572bb85a8882b5f4 to your computer and use it in GitHub Desktop.
Mount / Unmount a Virtualbox vdi image in linux
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
# Mount command | |
sleep 1; modprobe nbd | |
sleep 1; qemu-nbd -c /dev/nbd0 /path/to/image.vdi | |
sleep 1; mount /dev/nbd0p1 ~/u | |
# Below command to compress the entire mounted dir tree into a squafs filesystem | |
# mksquashfs u/ /path/to/image.squashfs -no-recovery -wildcards -e 'var/cache/apt/archives/*.deb' -e "home/user/Downloads/*" -e home/user/.cache -e home/user/.config/chromium | |
# Unmount command | |
# sleep 1; umount ~/u | |
# sleep 1; qemu-nbd -d /dev/nbd0 | |
# sleep 1; modprobe -r nbd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment