[Linux-cluster] sparse-file clone breaks on GFS2

Pierre-Philipp Braun pbraun at nethence.com
Sat Sep 19 16:57:08 UTC 2020


On 19.09.2020 14:14, Gionatan Danti wrote:
> cp --sparse=never

Hello neighbor (ciao from France).

I am not sure what you mean, as there **was both** the original and the 
copied file sums in my message.

Anyhow, thank you and good idea about --sparse=never.  I applied the 
checksum multiple times -- at at each step -- just to make sure the 
results are consistent.

cp --sparse=never dummy.ext4 dummy-never.ext4
cp --sparse=auto dummy.ext4 dummy-auto.ext4
cp --sparse=always dummy.ext4 dummy-clone.ext4

And the sums always remain the same.  So I only print the output only 
once here below.

ce2b843692051a2f4f81366f9680b675  dummy.ext4
33e84fdf0a328a64c4edd00342dd433d  dummy-never.ext4
33e84fdf0a328a64c4edd00342dd433d  dummy-auto.ext4
33e84fdf0a328a64c4edd00342dd433d  dummy-clone.ext4

Although the GFS2 sparse-file is fine and usable as-is, it cannot be 
copied with `cp` nor packed with GNU tar, and it does not matter if our 
aim is to actually keep the sparse.

I also attempted to copy a GFS2 sparse file to some EXT4 file-system.

cp --sparse=always dummy.ext4 /root/dummy-clone-on-ext4.ext4

And same happens.

33e84fdf0a328a64c4edd00342dd433d  /root/dummy-clone-on-ext4.ext4

While with the inverse, namely copying an EXT4 sparse-file on GFS2.

cd /root/
dd if=/dev/zero of=dummy-on-ext4.ext4 bs=1G count=0 seek=1
mkfs.ext4 dummy-on-ext4.ext4
cp --sparse=always dummy-on-ext4.ext4 /data2/dummy-clone-from-ext4.ext4

delivers the sparse-file intact.  No problem there.


cd573cfaace07e7949bc0c46028904ff  /root/dummy-on-ext4.ext4
cd573cfaace07e7949bc0c46028904ff  /data2/dummy-clone-from-ext4.ext4

and... WOW!  Cloning it yet again, it finally remains intact!

cd573cfaace07e7949bc0c46028904ff  dummy-clone-from-ext4-and-clone.ext4
cd573cfaace07e7949bc0c46028904ff  dummy-clone-from-ext4.ext4

It's strange.  Anyone?

In case it matters, I am using vanilla Linux 4.18.20 and not the RHEL 
nor CentOS with patches.

-- 
Pierre-Philipp




More information about the Linux-cluster mailing list