I'm not aware of any way to access the initramfs root filesystem after the real root filesystem has been mounted. Are there specific files generated in the initramfs that you are trying to access? Since you mentioned casper I am assuming you are booting a live-cd image.
If you have access to the console then you can pause the boot process before the real root filesystem is mounted. For example, adding the kernel argument break=bottom
will pause the boot process before the real root filesystem is mounted and open a rescue shell in the initramfs environment.
If there are specific files you are interested in, (by default) contents of /run/initramfs
will persist between the initramfs environment and the booted environment. Certain log files are written there. You might be able to add a hook to copy files there. (edit I think the entire /run
filesystem is kept around)
edit - I found a couple articles by Rob Landley that add some more color to the process. They all suggest the contents of the initramfs root does get destroyed/deleted.
What switch_root does is delete all the files out of rootfs (to free up the memory) and then chroot into a new filesystem and exec a new init process out of the new filesystem.
initramfs is rootfs: you can neither pivot_root
rootfs, nor unmount it. Instead delete everything out of rootfs to
free up the space (find -xdev / -exec rm '{}' ';'), overmount rootfs
with the new root (cd /newmount; mount --move . /; chroot .), attach
stdin/stdout/stderr to the new /dev/console, and exec the new init
Since initramfs is a
ramfs, deleting its contents frees up the memory it uses.
Links