Chroot notes

From Noah.org
Revision as of 13:25, 7 September 2010 by Root (Talk | contribs)

Jump to: navigation, search


Copy an existing root filesystem

This script copies an existing rootfs to one that is to be used in a chroot environment.

#!/bin/sh
## mount /dev/sda1 /media/adhoc
## debootstrap jaunty /media/adhoc/rootfs/ http://ports.ubuntu.com/
## cd /media/adhoc/rootfs
TARGET_DIR=$1
cd ${TARGET_DIR}
cp -a /bin .
cp -a /boot .
cp -a /dev .
cp -a /etc .
cp -a /home .
cp -a /lib .
cp --preserve=all --no-dereference /media .
cp --preserve=all --no-dereference /mnt .
cp -a /opt .
cp -a /root .
cp -a /sbin .
cp --preserve=all --no-dereference /srv .
cp -a /usr .
cp -a /var .
# chroot ${TARGET_DIR}