Difference between revisions of "Btrfs"

from 90% to 80%
(better worded warning)
(from 90% to 80%)
Line 111: Line 111:


== snapshot ==
== snapshot ==
A snapshot looks nearly the same as a subvolume. But snapshots really are "read-only 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 looks nearly the same as a subvolume. But snapshots really are "read-only 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 read-only. Therefore it is guaranteed not to change. In a snapshot you will find all files of the subvolume frozen in time. {{BoxWarning|Where to place snapshots|When creating snapshots you have to watch out for the volume layout in use}}
A snapshot is read-only. Therefore it is guaranteed not to change. In a snapshot you will find all files of the subvolume frozen in time. {{BoxWarning|Where to place snapshots|When creating snapshots you have to watch out for the volume 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 additionaly 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. To free some space, Btrfs has to test for every file in the snapshot, whether 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 snapshot 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:
Snapshots (if regularly made) may be used for:
Line 127: Line 124:
* ''What do you use snapshots for ?''
* ''What do you use snapshots for ?''


Don´t forget to remove snapshots, or you will get in '''"out of space" -trouble soon'''. Btrfs needs some free space to manage its work. If your volume is more then 90% full you have to think(fast) what to do.
Making and deleting snapshots is best done automatically:
* snapper
* timeshift
 
=== Taking snapshots ===
 
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 additionaly 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)
 
=== Releasing snapshots ===
 
Deleting a snapshot does not delete any files that are actually in use by other snapshots or the subvolume they where taken from. To free some space, Btrfs has to test for every file in the snapshot, whether 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 snapshot there will be '''no immediate gain in freed space'''. After a while you will notice that some space was freed.
 
Don´t forget to remove snapshots, or you will get in '''"out of space" -trouble soon'''. Btrfs needs some free space to manage its work. If your volume is more then 80% full you have to think(fast) what to do.
* ++++ '''Add''' some partition/device to the volume
* ++++ '''Add''' some partition/device to the volume
* +++ '''Remove''' some snapshots you don't need
* +++ '''Remove''' some snapshots you don't need
* + '''Delete''' some files (this does only help if they are not part of any snapshot)
* + '''Delete''' some files (this does only help if they are not part of any snapshot)


Making and deleting snapshots is best done automatically:
=== Rollback to a snapshot ===
* snapper
* timeshift


If you need to roll back into a snapshot you have to replace the actual subvolume by the chosen snapshot.
If you need to roll back into a snapshot you have to replace the actual subvolume by the chosen snapshot.
Line 143: Line 150:
# '''Don't forget''' to remove the snapshot you made in a few days
# '''Don't forget''' to remove the snapshot you made in a few days


{{BoxWarning|Don't forget to remove snapshots before you run out of space|Every time you take a snapshot you only use the "rest of the volume" for storing everything you change from this time on. At some point in time you have to release the snapshot. Don´t use your space up. Btrfs needs '''space to breath.''' Don't use more then 90% or you will get into trouble."}}
{{BoxWarning|Don't forget to remove snapshots before you run out of space|Every time you take a snapshot you only use the "rest of the volume" for storing everything you change from this time on. At some point in time you have to release the snapshot. Don´t use your space up. Btrfs needs '''space to breath.''' Don't use more then 80% or you will get into trouble."}}


{{BoxDanger|NO Snapshots together with quotas|There are reports about massive problems when using '''quotas''' together with snapshots (snapper, timeshift). Please have a look at: [https://btrfs.wiki.kernel.org/index.php/Quota_support#Known_issues Known_issues@btrfs.kernel.org]}}
{{BoxDanger|NO Snapshots together with quotas|There are reports about massive problems when using '''quotas''' together with snapshots (snapper, timeshift). Please have a look at: [https://btrfs.wiki.kernel.org/index.php/Quota_support#Known_issues Known_issues@btrfs.kernel.org]}}
translator
1,001

edits