In Linux, you can mount part of a file hierarchy at another directory by using the mount command with the --bind option. The --bind option allows you to make a part of the file system available at a different location, while still retaining the original file and directory structure.
Here’s an example of how to bind mount a directory /src to /dst:
sudo mount --bind /src /dst
To unmount the directory, use the umount command:
sudo umount /dst
If you need to modify the file hierarchy within /dst, you can remount it with the --bind option and the --remount option:
sudo mount --bind /src /dst
sudo mount --bind --remount /src /dst
The --remount option allows you to change the mount options for an existing mount point. For example, you could add the ro option to remount the directory as read-only:
sudo mount --bind --remount,ro /src /dst
Note that these mount options are persistent across reboots, so if you need to keep the bind mount after a reboot, you will need to add the appropriate mount command to your /etc/fstab file.