As Jean-Yves has already responded to (1), I'll limit myself to (2) and (3) until the grown ups from RENCI arrive!
(2)
One way to do this to disambiguate file names vs contents would be to generate a list of checksums for all the data objects in the first resource and then look for matches;
For example
$ iquest --no-page "%s %s/%s" "SELECT DATA_CHECKSUM, COLL_NAME, DATA_NAME WHERE DATA_RESC_NAME = 'demoResc'" | grep example
bf870b64a3009de48b144189f4dda31e /training/home/jc18/examplefile.txt
To build on that, you could use the first command to generate a test file of commands to check the other resource, for example;
$ iquest --no-page 'iquest --no-page " SELECT COLL_NAME, DATA_NAME WHERE DATA_CHECKSUM = "%s" AND DATA_RESC_NAME = 'other_demoResc'"' "SELECT DATA_CHECKSUM WHERE DATA_RESC_NAME = 'demoResc'" > other_demoResc_checksum.sh
$ head other_demoResc_checksum.sh
iquest --no-page " SELECT COLL_NAME, DATA_NAME WHERE DATA_CHECKSUM = "660d082d3a6975693f08e508ad53f4a9" AND DATA_RESC_NAME = other_demoResc"
iquest --no-page " SELECT COLL_NAME, DATA_NAME WHERE DATA_CHECKSUM = "835c46ecf2ad9365c79194d0d724c920" AND DATA_RESC_NAME = other_demoResc""
So you pipe the output into a file and then run that, and it should produce a list of all the files in 'other_demoResc' that match a checksum in demoResc...
However at this point it starts getting tricky managing the bash escaping, so I would reach for the python iRODS client. ChatGPT gave me something that looked workable, so I'd suggest starting there if you went that way!
(3)
As long as both resources are in the same Zone, and the replicas are part of the same in object, then there will be one set of metadata in the catalog for that data object
For example, both replica 0 and 1 for jc18_irods_test_5 are on different resources, but are the same 'file'
$ ils -L jc18_irods_test_5
jc18 0 root;replicate;sanger;sanger-random;sanger-blueroom;sanger-blueroom-random;irods-seq-sb24-sdd 0 2022-11-09.15:06 & jc18_irods_test_5
d41d8cd98f00b204e9800998ecf8427e generic /irods-seq-sb24-sdd/home/jc18#Sanger1/jc18_irods_test_5
jc18 1 root;replicate;remote;remote-random;arke;arke-random;irods-seq-i31-sdf 0 2022-11-09.15:06 & jc18_irods_test_5
d41d8cd98f00b204e9800998ecf8427e generic /irods-seq-i31-sdf/home/jc18#Sanger1/jc18_irods_test_5
The Docs have an overview here; https://docs.irods.org/4.3.4/system_overview/data_objects/#data-objects-and-replicas
Hope that helps?
John