I wanted to see what files are added on top of ISO 9660 when LiveUSB Linux is running. When booted with persistence
upper
and work
folders are on USB drive clearly seen. I run mount
on Linux booted from LiveUSB "usual way" (w/out persistence
) and saw /
is mounted via overlayfs
and upperdir=/cow/upper
. But sudo ls /cow
gives no such file or directory
.
Where is /cow
and how to see its contents?
Added 1:
I was able to extract contents of initrd
from liveUSB via unmkinitramfs
(see https://unix.stackexchange.com/a/495524/446998)
$ find . -type f -exec bash -c 'cat {} | grep "/cow/upper" && ls -l {}' \;
if [ ! -d /cow/upper ]; then
mkdir -p /cow/upper
/cow/lost+found|/cow/upper|/cow/log|/cow/crash|/cow/install-logs-*) continue ;;
mv "$cow_content" /cow/upper
mount -t overlay -o "upperdir=/cow/upper,lowerdir=$mounts,workdir=/cow/work" "/cow" "$rootmnt" || panic "overlay mount failed"
-rw-r--r-- 1 alex alex 33834 Jun 24 2020 ./main/scripts/casper
Next step I envision is to understand how /cow
is created because is not see in contents of initrd
pivot_root
it's/bin/init
(systemd) that unmounts "new_root". A working theory I'd like to test is to edit the grub boot entry to run/bin/bash
instead of/bin/init
... that may give you chance to see what's actually mounted there. – Philip Couling Dec 04 '21 at 00:33mount
does not show USB folders, it is same /cow/upper, so I guess it is under the hood. Mounting another overlay over /usb/writable/upper did not change a thing - the data continued to appear in original folder only, no changes observed in newupper
– Martian2020 Dec 04 '21 at 00:34/usb/writable/upper
as lowerdir – Martian2020 Dec 04 '21 at 00:36/cow
– Philip Couling Dec 04 '21 at 00:36/usb/writable/upper
with filesystem.squashfs but got broken links to libc.so and kernel panic. – Martian2020 Dec 04 '21 at 00:54cfdisk
? If I'm right then there will be writable (ext4?) partition that you can mount. – Philip Couling Dec 05 '21 at 10:50quiet splash
replaced withpersistent
– Martian2020 Dec 05 '21 at 11:49casper
script. In case you are interested. Cheers. – Martian2020 Jan 08 '23 at 05:16