Skip to content

Instantly share code, notes, and snippets.

@tcheneau
Created April 4, 2013 17:55
Show Gist options
  • Save tcheneau/5312546 to your computer and use it in GitHub Desktop.
Save tcheneau/5312546 to your computer and use it in GitHub Desktop.
Chroot into a Cloonix virtual machine disk image.
#!/bin/sh
losetup /dev/loop1 $1
losetup -o 1048576 /dev/loop2 /dev/loop1
mount /dev/loop2 /media/vm
mount -t proc foo /media/vm/proc
mount -t sysfs foo /media/vm/sys
mount -o bind /dev /media/vm/dev
mount -o bind /selinux /media/vm/selinux
chroot /media/vm
umount /media/vm/dev
umount /media/vm/sys
umount /media/vm/proc
umount /media/vm/selinux
umount /media/vm
losetup -d /dev/loop2
losetup -d /dev/loop1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment