Author vstinner
Recipients giampaolo.rodola, pablogsal, vstinner
Date 2019-06-05.11:58:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1559735917.61.0.464346525501.issue37157@roundup.psfhosted.org>
In-reply-to
Content
I'm curious: is it possible to query the filesystem to check if a copied is copied using CoW? I guess that it's possible, it will be non portable. So I guess that it's better to avoid checking that in unit tests.

vstinner@apu$ dd if=/dev/urandom of=urandom bs=1k count=1k
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.0309671 s, 33.9 MB/s
vstinner@apu$ cp --reflink urandom urandom2
'urandom' -> 'urandom2'

vstinner@apu$ stat urandom
  File: urandom
  Size: 1048576   	Blocks: 2048       IO Block: 4096   regular file
Device: 31h/49d	Inode: 16265363    Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/vstinner)   Gid: ( 1000/vstinner)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2019-06-05 13:56:21.381196972 +0200
Modify: 2019-06-05 13:56:21.412197007 +0200
Change: 2019-06-05 13:56:21.412197007 +0200
 Birth: 2019-06-05 13:56:21.381196972 +0200

vstinner@apu$ stat urandom2
  File: urandom2
  Size: 1048576   	Blocks: 2048       IO Block: 4096   regular file
Device: 31h/49d	Inode: 16265364    Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/vstinner)   Gid: ( 1000/vstinner)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2019-06-05 13:56:24.487200453 +0200
Modify: 2019-06-05 13:56:24.496200463 +0200
Change: 2019-06-05 13:56:24.496200463 +0200
 Birth: 2019-06-05 13:56:24.487200453 +0200

Using stat command line tool, I don't see anything obvious saying that the two files share the same data on disk.
History
Date User Action Args
2019-06-05 11:58:37vstinnersetrecipients: + vstinner, giampaolo.rodola, pablogsal
2019-06-05 11:58:37vstinnersetmessageid: <1559735917.61.0.464346525501.issue37157@roundup.psfhosted.org>
2019-06-05 11:58:37vstinnerlinkissue37157 messages
2019-06-05 11:58:37vstinnercreate