Nemo uses copy-on-write :-D

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
Level 1
Level 1
Posts: 24
Joined: Mon Sep 22, 2014 4:08 pm

Nemo uses copy-on-write :-D

Post by dg1727 » Sun Feb 12, 2017 3:11 pm

I've found comments on the Web stating that in order for the command-line "cp" utility to use the copy-on-write feature of Btrfs (and other CoW filesystems), the user is supposed to give the

Code: Select all

parameter explicitly. :-(
In other words, there isn't a "copy files" function in the kernel that automatically makes a "copy on write" copy for all userland tools that copy files.

BTW, some articles on the Web suggest --reflink=always (or just --reflink, which is equivalent to it), but this seems like a bad idea because, according to the "cp" manpage, if you make a mistake (or are calling "cp" programmatically) and use "cp" on a non-CoW filesystem such as ext4 or FAT, then "cp --reflink=always" will fail. The --reflink=auto parameter seems better, since the manpage says it will succeed (making a non-CoW copy) on non-CoW filesystems.

Anyway, I wondered whether Nemo (I'm using version 3.2.2) does CoW copying. I searched in this forum and in the Nemo issue tracker, and didn't find an answer. So here are my test results:

I used the "Duplicate" option in Nemo's right-click menu to copy a folder, containing 100+GB in 50k+ files, to the same 300+GB Btrfs filesystem on a mechanical (spinner) HDD on 6Gbps SATA.
  • The copy seemed to go at a speed close to 1GB/second (I didn't actually measure it); to read & write all the data by brute force at 1 gigabyte/s would be more than 16 gigabits/s, which is more than the 6Gbps SATA link.
  • The HDD light was off almost the whole time.
  • The command-line "df" utility (version 8.23), run before & after the folder duplication, reported the partition as having gained less than 1 percentage point in usage. If the folder had been copied by brute force, the usage would have gone up by some 33 percentage points.
So Nemo does use copy-on-write automatically. Hooray!

Post Reply

Return to “Software & Applications”