Why an extra mount point is needed to copy /overlay to ExtRoot?

In Transferring data of the ExtRoot configuration instructions there is an extra step to create a temporary mount point:

mkdir -p /tmp/cproot
mount --bind /overlay /tmp/cproot
mount ${DEVICE} /mnt
tar -C /tmp/cproot -cvf - . | tar -C /mnt -xf -	
umount /tmp/cproot /mnt
reboot

Is this step really necessary? What is the rational behind this? Could it be as simple as this?

tar -C /overlay -cvf - . | tar -C /mnt -xf -

my guess is that TAR creates temp files during archiving and therefore it protects the memory from excessive wear. Run your command too many times and it would probably toast your router's memory.

2 Likes

According to the man page for mount, using --bind does not include any submounts that might be in /overlay and so using the bind mount instead of /overlay directly prevents tar from recursing through the submounts. I'm guessing that's the reason.

1 Like

What are those submounts?