---
title: "Linux cp command with reflink"
date: "2023-07-11T09:36:53Z"
lastmod: "2023-07-11T09:36:53Z"
authors:
  - "utzer"
tags:
  - "BTRFS"
  - "CIFS"
  - "copy"
  - "cp"
  - "linux"
  - "NFS"
  - "XFS"
categories:
  - "Linux"
canonical_url: "https://newblog.utzer.de/2023/07/11/linux-cp-command-with-reflink/"
---

```
cp -pRv --reflink=auto /source/folder /destination/folder
```

copy files and directories  
-p same as --preserve=mode,ownership,timestamps  
-R, -r, --recursive  
copy directories recursively  
-v verbose, show what is going on.

--reflink\[=WHEN\]  
control clone/CoW copies.

This just copied 169GB of files in 20 seconds. This only works on supported filesystems, so for example by "#Btrfs, #CIFS, #NFS 4.2, #OCFS2, #overlayfs, and #XFS". See [here](https://unix.stackexchange.com/a/631238).

Explainshell tells you [this](https://explainshell.com/explain?cmd=cp+-pRv+--reflink%3Dauto+%2Fsource%2Ffolder%2Ffile+%2Fdestination%2Ffolder%2Ffile).

