Skip to content
Make a quick mirror of your system to play around with.
Find file
New pull request
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This is a few scripts to build a quick chroot mirror of your whole system.
It allows you to build up a mirror, enter into it, and then break it down.

They all need to be run as root.


sudo build_mirror test.img
This makes a file called test.img.
It mounts it to /mnt/easy_mirror/test/cache.
Then it makes a union between that and / at /mnt/easy_mirror/test/union.
If test.img already existed, then it's used as is.
Otherwise a new, empty, one is created.

sudo enter_mirror
This logs you in to the new image.
If you have more than one mounted at a time, then you'll need to specify.
sudo enter_mirror test

sudo breakdown_mirror
This attempts to cleanly unmount the mirror
It does not delete the image file (test.img).
If you have more than one mounted at a time, then you'll need to specify.
sudo breakdown_mirror test

I've got a system in place for scripts that you want to be run every time 
a new mirror is setup.

The scripts are searched for in ~/.local/share/easy_mirror/
The '~' in this case is relative to the user who's running the scripts (Not root, even when under sudo)
Similarly, the scripts are run by that user, not root.

There are currently two:
	This one is run every time a new cache file was created.
	It is not run if you're just remounting an existing cache.
	This one is run every time a new mirror is built, whether or not the image file is new.

Both of these scripts are run with the name of the mirror as the first argument.
If either of these scripts don't exist, or aren't executable, then they just won't be run.

I use for adding
export PS1="$MIRROR_NAME-$PS1"
to ~/.bashrc, so I can tell the mirrors apart from each other, and the root system.

I use to make sure some state is removed so that the mirror is independent from the host.

Something went wrong with that request. Please try again.