Difference between revisions of "Btrfs"

2,268 bytes added ,  3 years ago
snapshots extended
(links to reported problems 2021)
(snapshots extended)
Line 57: Line 57:


=== snapshot ===
=== snapshot ===
{{BoxDanger|Quotas together with snapshots|There are reports about massive problems when using quotas together with snapshots}}
A snapshot looks nearly the same as a subvolume. But snapshots really are "readonly photographs of a subvolume". While the subvolume changes with time. The snapshot is frozen in the state of the subvolume at the time you made it.
A snapshot is readonly. Therefore it is guaranteed not to change. In a snapshot you will find all files of the subvolume frozen in time. When creating snapshots you have to watch out for the Btrfs-layout in use.
 
Taking a snapshot is '''very fast''', and '''nearly priceless'''. After the snapshot is taken, all future writes will go as in CoW usual. But none of the space occupied by files in the snapshot will be reusable. As you write more and more new files the filesystem will grow because it can not reuse the files in the snapshot. A new snapshot will freeze additional all created or modified files since the last snapshot and so on. If you don´t release(delete) any snapshot you will eventually run out of space soon(disk full)
 
Deleting a snapshot does not delete any files that are actually in use by other snapshots or the subvolume they where taken from. But to free some space, Btrfs has to test for every file in the snapshot, wehter it is in use, or it is not. If it is not, the space of this file/version will be freed.(This is greatly simplified) Therefore it is '''costly to remove snapshots'''. And btrfs will do this work in the background. You may notice this, because when you delete a snaphot there will be '''no immediate gain in freed space'''. After a while you will notice that some space was freed.
 
Snapshots (if regularly made) may be used for:
* comparing config files from different "times"
* merging config files
* recovering accidentally deleted/overwritten files
* system roll back
* anchor for a backup with send/receive
* basis for a seed
* ''what do you use snapshots for ?''
 
Making and deleting snapshots is best done automatically:
* snapper
* timeshift
 
If you need to roll back into a snapshot you have to replace the actual subvolume by the chosen snapshot.
* Make a snapshot of the actual subvolume (for later reference)
* Move the subvolume out of its actual place
* Create a new subvolume from the snapshot chosen for roll back
* Make the new subvolume the default
 
 
{{BoxDanger|Quotas together with snapshots|There are reports about massive problems when using quotas together with snapshots (snapper, timeshift)}}


=== quotas ===
=== quotas ===
translator
1,001

edits