NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
fb2k6
Jun 14, 2015Aspirant
What does cp --reflink command actually do?
I've read about moving files more quickly within subvolumes in OS6 using the "cp -a --reflink" command in the thread shown on the bottom of this post.
I have a few questions about this command.
1) Is a physical copy actually made of the original files/folders when I use this command? I see 2 identical copies via explorer but are they independent or actually pointing to the same data on the disk?
- Reason I'm asking this is because the copy procedure was very fast on a large amount of data so I tested a txt file that was copied. I modified both with different content and I opened both and they show different content.
2) How important is it to delete the original files/folders after issuing the command?
3) If I forget to delete the original source files/folders before issuing the command, do I need to worry about data integrity when I modify the same files from each of those folders?
Thanks for any help or clarification on what "cp --reflink" actually do.
http://www.readynas.com/forum/viewtopic.php?f=21&t=76079
I have a few questions about this command.
1) Is a physical copy actually made of the original files/folders when I use this command? I see 2 identical copies via explorer but are they independent or actually pointing to the same data on the disk?
- Reason I'm asking this is because the copy procedure was very fast on a large amount of data so I tested a txt file that was copied. I modified both with different content and I opened both and they show different content.
2) How important is it to delete the original files/folders after issuing the command?
3) If I forget to delete the original source files/folders before issuing the command, do I need to worry about data integrity when I modify the same files from each of those folders?
Thanks for any help or clarification on what "cp --reflink" actually do.
http://www.readynas.com/forum/viewtopic.php?f=21&t=76079
3 Replies
Replies have been turned off for this discussion
- StephenBGuru - Experienced User
No. The metadata (directory information) in the source and destination folders both initially point to a single copy of the data. Note this is not the same as a symlink. A symlink is a way to have two different folders share the same file. cp --reflink creates two files that initially share the same data blocks.fb2k6 wrote: 1) Is a physical copy actually made of the original files/folders when I use this command?
No. "Copy on write" means that when you modify copy A, then new data blocks are written for the parts you changed. Copy B will remain as it was. If you then change part of Copy B, new data blocks are written for them also. So from user perspective, they are two different copies.fb2k6 wrote: 3) If I forget to delete the original source files/folders before issuing the command, do I need to worry about data integrity when I modify the same files from each of those folders
From a system perspective, when you change copy A it becomes fragmented, and defrag cannot fix it until copy B is deleted. Also, since A and B share the same disk space, when you back up A and B the backup will take up more space than the two on-disk copies. So if you do a lot of this, you'd need a bigger backup drive than the NAS volume size. Both of these issues also apply to snapshots.
Deleting the originals eliminates the two system implications above.fb2k6 wrote: 2) How important is it to delete the original files/folders after issuing the command? - fb2k6AspirantThanks StephenB for the clarification and quick response. For question 3, I actually wrote "before" instead of "after" but you answered the question I had in mind.
Also, if I delete the source files/folder via explorer instead of using the SSH rm command, will it provide the same result? - StephenBGuru - Experienced User
Yes.fb2k6 wrote: Also, if I delete the source files/folder via explorer instead of using the SSH rm command, will it provide the same result?
Related Content
NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!