Questions tagged [copy-on-write]
23 questions
25
votes
4 answers
Does any file system implement Copy on Write mechanism for CP?
We have seen OS doing Copy on Write optimisation when forking a process. Reason being that most of the time fork is preceded by exec, so we don't want to incur the cost of page allocations and copying the data from the caller address space…
Mridul Verma
- 353
- 1
- 3
- 5
20
votes
1 answer
Why does "cp -R --reflink=always" perform a standard copy on a Btrfs filesystem?
Btrfs support Copy-On-Write. I tried to use that feature to clone a directory:
cp -R --reflink=always foo_directory foo_directory.mirror
I expected the command to finish almost instantly (like a btrfs subvolume snapshot), but the cp command seems…
Philipp Claßen
- 4,689
- 7
- 29
- 41
12
votes
2 answers
btrfs — Is it dangerous to defragment subvolume which has readonly snapshots?
If you open the defragment section of btrfs-filesystem(8), you will see the following ominous inscription left by the developers:
Warning: Defragmenting with Linux kernel versions < 3.9 or ≥ 3.14-rc2 as well as with Linux stable kernel versions ≥…
firegurafiku
- 463
- 1
- 4
- 8
9
votes
2 answers
How does ZFS copy on write work for large files
Let's say I have a large file (8GB) called example.log on ZFS.
I do cp example.log example.bak to make a copy. Then I add or modify a few bytes in original file. What will happen?
Will ZFS copy the entire 8GB file or only the blocks that changed…
HubertNNN
- 193
- 1
- 4
4
votes
4 answers
How to check disk usage for folders containing reflinked files on XFS?
XFS supports copy on write (CoW), so it is not entirely clear what du will say if some of the bytes are shared across files. I'd like to find a way to check how much disk space a folder uses, not counting shared bytes multiple times, i.e. the real…
lumbric
- 339
- 5
- 15
4
votes
2 answers
Will writing identical data to blocks of a file under ZFS use space in snapshots?
I have a 16M file.
I take a snapshot of the ZFS filesystem which contains it.
If I overwrite the file with the same data, will ZFS need to store two copies of all of the blocks of the file?
fadedbee
- 797
- 1
- 5
- 23
4
votes
2 answers
BTRFS inside a KVM-VM on a qcow2 formatted image
I have a Ubuntu 14.04 application appliance that makes heavy use of BTRFS snapshots. The application is meant to be hypervisor agnostic and the snapshots need to be stored with the virtual machine image in case we need to troubleshoot an issue.…
AlexV
- 41
- 1
- 2
3
votes
1 answer
In what ways is the COW filesystem an improvement over the Journaling Filesystem?
I don't think an informative answer exists on u&l or otherwise, which mentions why COW filesystems are a leg-up over any of the three modes of journaling. How does the former provide both superior safety and performance while the latter provides one…
computronium
- 778
- 6
- 15
3
votes
1 answer
Does anyone know the way to undelete file on ZFS?
Is there any way to undelete file on ZFS.
I overwrote JPG file with the scanned image.
Unfortunately, I didn't take snapshot.
But ZFS uses the CoW mechanism, overwritten data may still alive, I think.
Does anyone know the way to undelete file on…
kou
- 31
- 2
2
votes
1 answer
Copy on write for directories?
Some file-systems notably XFS and btrfs support Copy on Write at block level for files.
This is done by reflinking where the underlying blocks are shared between files until they are modified.
Since a directory is essentially an associative array…
Bruce Adams
- 612
- 1
- 9
- 21
1
vote
0 answers
Btrfs : compress and nodatacow priority + automation
I have a btrfs partition mounted on / with compression enabled:
mount -o subvol=@,defaults,noatime,nodiratime,compress=zstd,space_cache=v2 /dev/mapper/archlinux /mnt
I want to disable the CoW mecanism on some folders such as:
The folder which…
ShellCode
- 223
- 2
- 9
1
vote
0 answers
Is the stack of a forked process shared with its parent?
Is the stack of a forked process shared with its parent?
If so, does this happen via shared copy-on-write pages?
HappyFace
- 1,493
- 9
- 21
1
vote
1 answer
How to disable BTRFS copy-on-write updates for a subvolume using btrfs-property instead of chattr
I want to disable BTRFS copy-on-write updates for a subvolume using the newer method btrfs property instead of the old method chattr.
I found the man page here:
Manpage/btrfs-property - btrfs Wiki
This quote leads me to believe it has the…
MountainX
- 17,168
- 59
- 155
- 264
1
vote
1 answer
A good way how to backup user data in CentOS?
I need to back up my data and I have not found a good way so far.
Just say I have 1 TB of a non-system disk with 50-100 GB of user data (binary files, source code, images, etc.). And another big disk, where I could save backups. I could use rsync or…
Radek Uhlíř
- 39
- 3
1
vote
1 answer
fork() and COW behavior after exec()
We understand the COW behavior after a fork (as for example described here) as follows: fork creates a copy of the parent's page table for the child and marks the physical pages read only, so if any of the two processes tries to write it will…
js84
- 113
- 4