To chroot into 'normal' installation requires just mount of common /, /proc, /sys and /dev to do normal administration tasks.
But how to proceed with so called 'persistent' installation (see here)? How to simulate 'persistent' parameter on boot process (how does the system handle this issue)?
This question is perhaps related to How do I recover my username and password on a persistent LiveUSB?
(I do not have a specific problem to solve, I am just interested in.)
Best Answer
The persistant usb drive uses a compressed read-only filesystem (squashfs) and overlays a writable filesystem layer on top that stores changed files. The writable filesystem is stored in a single file (like a zip file, but without the compression - it is actually ext3, but that is unimportant)
To put everything 'back together':
I am assuming the usb drive is mounted on
Change this to the directory that contains your persistant installation when you follow these instructions.
You need to be root, or prepend
sudo
to every command1. Creating stuff
Some directories need to be created:
/media/rootfs
- Location where we will put the read-only filesystem/media/cow
- The location of the writable overlay/media/persist_usb
- The location where the two filesystems will be joinedthis can be done with
mkdir /media/{rootfs,cow,persist_usb}
2. Make files look like filesystems
First the compressed filesystem
(Description: Mount the
filesystem.squashfs
file on/media/rootfs
using squashfs)Next the writable filesystem
(Description: Mount the file
casper-rw' on '/media/cow
using a loop device)3. Join the filesystems together
Now we are ready to join the two directories together
(Description: Mount the union of the two directories using aufs (see unionfs) onto
/media/persist_usb
with/media/cow
as writable and/media/rootfs
as readonly)4. Play around
I'll leave that step up to you.
5. Cleanup
Once you have finished having fun with the installation (like chrooting) you need to get rid of the stuff that was created.
First to undo step 3:
Next to undo step 2. We can do both filesystem together:
(Description: unmount
/media/rootfs
and/media/cow
)Finally, to undo step 1:
The changes you have made to the filesystem have been kept and you can now unmount the USB drive (if you want to).