[Discuss] File systems that support file cloning
Dale R. Worley
worley at alum.mit.edu
Wed Nov 16 20:35:14 EST 2022
(My apologies, I've lost track of what responses people have sent about
this.)
I asked if there was any support in ext4 for file cloning a/k/a
copy-on-write a/k/a shared extents. The answer is no. My memory is
that people suggested btrfs as an alternative.
I checked the Wikipedia page "Comparison of file systems". The
filesystems that I'd heard of that support cloning are btrfs, xfs, and
zfs.
I tried out btrfs, and it has some management problems. "df" doesn't
report free space correctly. And apparently there is a need to run a
"rebalancing" program occasionally to keep free space accessible. Also,
later when I was researching xfs, there were comments suggesting that
though btrfs had been around for many years, it was still not fully
reliable and people had seen filesystem crashes that left the partition
readable.
I checked into zfs. zfs has an integral volume manager. I don't need
that, as I use LVM. But unfortunately zfs's volume manager can't be
ignored by default. So zfs has additional management overhead, like
btrfs.
I tried researching xfs online, and found references that said it was
just implementing xfs. But those references were old. Fortunately, I'm
running Fedora 34 with kernel 5.17.12 and it has newer xfs support. I
checked that out, and cloning is enabled by default. I also discovered
that the cp has "clone if you can" as the default mode. (MacOS (and
presumably BSD) cp uses -c to specify cloning, but Linux cp says -c is
deprecated for --preserve=context, so it uses --reflink.)
The only feature that I desire that xfs doesn't have is file system
shrinking. It does have file system expansion, and oddly, it is *only*
available when the file system is mounted. I'm a little surprised that
nobody has implemented shrinking yet.
Conveniently, I've been using xfs at work in VMs running Oracle Linux,
though a version that's old enough that it doesn't support cloning. And
I've found xfs to be quite reliable, including when a VM crashes. After
crashes the journal repairs the metadata and running xfs_repair never
discovers a problem.
Dale
More information about the Discuss
mailing list