Lentes, Bernd
2021-Jan-13 13:58 UTC
[Ocfs2-users] how to find out the real size of a reflink ?
----- On Jan 13, 2021, at 3:42 AM, Gang He ghe at suse.com wrote:> Hi Lentes, > > you can use "o2info --filestat yourfile" to identify how many data > clusters for a cloned file are shared with the original file. > Of course, the cloned file does not share meta-data blocks with the > original file, only shares the data clusters. > e.g. > ghe-nd1:/rear/test # o2info --filestat dd.1.ref > File: dd.1.ref > Size: 8589934592 Blocks: 16777216 IO Block: 4096 regular file > Device: fe00h/65024d Inode: 355844 Links: 1 > Frag%: 0.01 Clusters: 2097152 Extents: 157 Score: 2 > Shared: 2097152 Unwritten: 0 Holes: 0 Xattr: 0 > Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) > Access: 2021-01-13 10:08:06.561968304 +0800 > Modify: 2021-01-13 10:07:52.74642661 > Change: 2021-01-13 10:07:52.77958163 > > Please refer to "Shared: 2097152" item. >Hi Gang, thanks for your information. i did it: ha-idg-1:/mnt/ocfs2 # o2info --filestat reflink/vm_amok.raw File: reflink/vm_amok.raw Size: 880469343744 Blocks: 1719666688 IO Block: 4096 regular file Device: fe13h/65043d Inode: 583953 Links: 1 Frag%: 6.60 Clusters: 839681 Extents: 55431 Score: 7 Shared: 839681 Unwritten: 0 Holes: 0 Xattr: 0 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2021-01-12 23:18:07.920405221 +0100 Modify: 2021-01-12 22:40:07.806758460 +0100 Change: 2021-01-12 22:40:08.404660948 +0100 ha-idg-1:/mnt/ocfs2 # ha-idg-1:/mnt/ocfs2 # o2info --filestat vm_amok.raw File: vm_amok.raw Size: 880469343744 Blocks: 1719666688 IO Block: 4096 regular file Device: fe13h/65043d Inode: 8257821 Links: 1 Frag%: 6.60 Clusters: 839681 Extents: 55421 Score: 7 Shared: 836667 Unwritten: 0 Holes: 0 Xattr: 0 Access: (0644/-rw-r--r--) Uid: ( 488/srvGeoClue) Gid: ( 487/ ntp) Access: 2021-01-13 14:29:43.496432144 +0100 Modify: 2021-01-13 14:48:02.745794317 +0100 Change: 2021-01-13 14:48:02.745794317 +0100 Some questions: What is a cluster ? What is an extent ? Shouldn't the number of the shared clusters be the same for both files ? During runtime, the number of shared clusters for the reflink stays the same, for the original file it's reducing. Is that expected behaviour ? Bernd Helmholtz Zentrum M?nchen Helmholtz Zentrum Muenchen Deutsches Forschungszentrum fuer Gesundheit und Umwelt (GmbH) Ingolstaedter Landstr. 1 85764 Neuherberg www.helmholtz-muenchen.de Aufsichtsratsvorsitzende: MinDir.in Prof. Dr. Veronika von Messling Geschaeftsfuehrung: Prof. Dr. med. Dr. h.c. Matthias Tschoep, Kerstin Guenther Registergericht: Amtsgericht Muenchen HRB 6466 USt-IdNr: DE 129521671
Hi Lentes, see my comments inline. On 2021/1/13 21:58, Lentes, Bernd wrote:> > ----- On Jan 13, 2021, at 3:42 AM, Gang He ghe at suse.com wrote: > >> Hi Lentes, >> >> you can use "o2info --filestat yourfile" to identify how many data >> clusters for a cloned file are shared with the original file. >> Of course, the cloned file does not share meta-data blocks with the >> original file, only shares the data clusters. >> e.g. >> ghe-nd1:/rear/test # o2info --filestat dd.1.ref >> File: dd.1.ref >> Size: 8589934592 Blocks: 16777216 IO Block: 4096 regular file >> Device: fe00h/65024d Inode: 355844 Links: 1 >> Frag%: 0.01 Clusters: 2097152 Extents: 157 Score: 2 >> Shared: 2097152 Unwritten: 0 Holes: 0 Xattr: 0 >> Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) >> Access: 2021-01-13 10:08:06.561968304 +0800 >> Modify: 2021-01-13 10:07:52.74642661 >> Change: 2021-01-13 10:07:52.77958163 >> >> Please refer to "Shared: 2097152" item. >> > > Hi Gang, > > thanks for your information. > > i did it: > > ha-idg-1:/mnt/ocfs2 # o2info --filestat reflink/vm_amok.raw > File: reflink/vm_amok.raw > Size: 880469343744 Blocks: 1719666688 IO Block: 4096 regular file > Device: fe13h/65043d Inode: 583953 Links: 1 > Frag%: 6.60 Clusters: 839681 Extents: 55431 Score: 7 > Shared: 839681 Unwritten: 0 Holes: 0 Xattr: 0 > Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) > Access: 2021-01-12 23:18:07.920405221 +0100 > Modify: 2021-01-12 22:40:07.806758460 +0100 > Change: 2021-01-12 22:40:08.404660948 +0100 > ha-idg-1:/mnt/ocfs2 # > > ha-idg-1:/mnt/ocfs2 # o2info --filestat vm_amok.raw > File: vm_amok.raw > Size: 880469343744 Blocks: 1719666688 IO Block: 4096 regular file > Device: fe13h/65043d Inode: 8257821 Links: 1 > Frag%: 6.60 Clusters: 839681 Extents: 55421 Score: 7 > Shared: 836667 Unwritten: 0 Holes: 0 Xattr: 0 > Access: (0644/-rw-r--r--) Uid: ( 488/srvGeoClue) Gid: ( 487/ ntp) > Access: 2021-01-13 14:29:43.496432144 +0100 > Modify: 2021-01-13 14:48:02.745794317 +0100 > Change: 2021-01-13 14:48:02.745794317 +0100 > > Some questions: > > What is a cluster ? > What is an extent ?In the traditional file system, a file consists of meta-data blocks and data blocks, but for ocfs2 file system, a file consists of meta-data blocks and data clusters, the cluster size can greater than the block size to save meta-data block consumption. The file data is contained by clusters, the file meta data is contained by blocks, there are few kind of meta-data blocks, e.g. extent blocks looks like to store cluster pointers.> Shouldn't the number of the shared clusters be the same for both files ?Yes, when a file is cloned from the original file, both files usually own the same number of shared clusters. But one of files is written again, it's shared clusters should be reduced, since the file system have allocated some new clusters for these over-write. Thanks Gang> During runtime, the number of shared clusters for the reflink stays the same, > for the original file it's reducing. Is that expected behaviour ? > > Bernd > Helmholtz Zentrum M?nchen > > Helmholtz Zentrum Muenchen > Deutsches Forschungszentrum fuer Gesundheit und Umwelt (GmbH) > Ingolstaedter Landstr. 1 > 85764 Neuherberg > www.helmholtz-muenchen.de > Aufsichtsratsvorsitzende: MinDir.in Prof. Dr. Veronika von Messling > Geschaeftsfuehrung: Prof. Dr. med. Dr. h.c. Matthias Tschoep, Kerstin Guenther > Registergericht: Amtsgericht Muenchen HRB 6466 > USt-IdNr: DE 129521671 >