Difference between revisions of "Btrfs"

internal links inserted
(from 90% to 80%)
(internal links inserted)
Line 8: Line 8:


Because Btrfs is different, some things seem unfamiliar and strange. If you want to learn the details and the newest stuff, then [https://btrfs.wiki.kernel.org/index.php/Main_Page btrfs.wiki.kernel.org] is the place to go.
Because Btrfs is different, some things seem unfamiliar and strange. If you want to learn the details and the newest stuff, then [https://btrfs.wiki.kernel.org/index.php/Main_Page btrfs.wiki.kernel.org] is the place to go.
Development of Btrfs started in 2007. Since that time, Btrfs is a part of the Linux kernel and is under active development. The Btrfs code base is '''[https://btrfs.wiki.kernel.org/index.php/Status stable] .''' However, new features are still under development. Its main features and benefits are:
Development of Btrfs started in 2007. Since that time, Btrfs is a part of the Linux kernel and is under active development. The Btrfs code base and filesystem-layout is '''[https://btrfs.wiki.kernel.org/index.php/Status stable] .''' However, new features are still under development. Its main features and benefits are:
*'''Snapshots''' which do not make the full copy of files
*'''Snapshots''' which do not make the full copy of files
*'''RAID''' - support for software-based RAID 0, RAID 1, RAID 10
*'''RAID''' - support for software-based RAID 0, RAID 1, RAID 10
Line 18: Line 18:
Because Btrfs is different, you will find some words that do have a special meaning when used for btrfs. This may be a source of confusion.  
Because Btrfs is different, you will find some words that do have a special meaning when used for btrfs. This may be a source of confusion.  


<div class="mw-collapsible mw-collapsed"><div class="mw-collapsible-toggle" style="float:none;">▶ Btrfs '''volume'''</div><div class="mw-collapsible-content">A '''volume''' is a pool of raw storage and consists of one or more '''device'''s. The size of the volume will be the addition of all devices that are part of this volume. In most cases you will only use one volume. You are able to add/remove devices at any time. ''Usually you do '''not''' mount a Btrfs volume.''
<div class="mw-collapsible mw-collapsed"><div class="mw-collapsible-toggle" style="float:none;">▶ Btrfs '''volume'''</div><div class="mw-collapsible-content">A '''[[Btrfs#Btrfs_Volume|volume]]''' is a pool of raw storage and consists of one or more '''device'''s. The size of the volume will be the addition of all devices that are part of this volume. In most cases you will only use one volume. You are able to add/remove devices at any time. ''Usually you do '''not''' mount a Btrfs volume.''
</div></div>
</div></div>


<div class="mw-collapsible mw-collapsed"><div class="mw-collapsible-toggle" style="float:none;">▶ '''chunk'''</div><div class="mw-collapsible-content">A '''chunk''' is simply a piece of storage that Btrfs can use to put data on. Think of a chunk(usually 1GiB) as of a page in a book. The book is the volume, and the chunk is one page of it. When you start, all pages are empty. When you write data to the volume, one page (="chunk") after the other is written to.  
<div class="mw-collapsible mw-collapsed"><div class="mw-collapsible-toggle" style="float:none;">▶ '''chunk'''</div><div class="mw-collapsible-content">A '''chunk''' is simply a piece of storage that Btrfs can use to put data on. Think of a chunk (usually 1GiB) as of a page in a book. The book is the '''[[Btrfs#Btrfs_Volume|volume]]''', and the chunk is one page of it. When you start, all pages are empty. When you write data to the volume, one page (="chunk") after the other is written to.  
</div></div>
</div></div>


<div class="mw-collapsible mw-collapsed"><div class="mw-collapsible-toggle" style="float:none;">▶ '''device'''</div><div class="mw-collapsible-content">A '''device''' is some linux device. It may be '''a partition''' like '''/dev/sdz1''' or /dev/sdz2. Or it may be a raw disk device like /dev/sdz without any partitioning. A Btrfs volume consists of '''at least one device'''.
<div class="mw-collapsible mw-collapsed"><div class="mw-collapsible-toggle" style="float:none;">▶ '''device'''</div><div class="mw-collapsible-content">A '''device''' is some linux device. It may be '''a partition''' like '''/dev/sdz1''' or /dev/sdz2. Or it may be a raw disk device like /dev/sdz without any partitioning. A Btrfs '''[[Btrfs#Btrfs_Volume|volume]]''' consists of '''at least one device'''.
</div></div>
</div></div>


<div class="mw-collapsible mw-collapsed"><div class="mw-collapsible-toggle" style="float:none;">▶ '''subvolume'''</div><div class="mw-collapsible-content">A Btrfs subvolume is an independently mountable POSIX file-tree and '''not a block device'''. It is the part of a volume that will be '''mounted writeable''' into your Linux system. By convention the names of subvolumes start with @ ('''@''', '''@home''', '''@snapshots''' ...). All subvolumes share the space of the Btrfs volume. You may create subvolumes at will. (You may think of subvolumes ''as sort of "dynamic partitions" inside a Btrfs volume'')
<div class="mw-collapsible mw-collapsed"><div class="mw-collapsible-toggle" style="float:none;">▶ '''subvolume'''</div><div class="mw-collapsible-content">A Btrfs '''[[Btrfs#subvolume|subvolume]]''' is an independently mountable POSIX file-tree and '''not a block device'''. It is the part of a '''[[Btrfs#Btrfs_Volume|volume]]''' that will be '''mounted writeable''' into your Linux system. By convention the names of subvolumes start with @ ('''@''', '''@home''', '''@snapshots''' ...). All subvolumes share the space of the Btrfs volume. You may create subvolumes at will. (You may think of subvolumes ''as sort of "dynamic partitions" inside a Btrfs volume'')
</div></div>
</div></div>


<div class="mw-collapsible mw-collapsed"><div class="mw-collapsible-toggle" style="float:none;">▶ '''default subvolume''' </div><div class="mw-collapsible-content">The default subvolume of a Btrfs volume is special. When you mount, you normally have to name a subvolume to mount. When you don't name a subvolume, the default subvolume will be used. The default subvolume can be changed to any subvolume. It is advisable to set the subvolume as default, that is used for mounting linux '''"/"''' this is often the subvolume with name '''"@"'''
<div class="mw-collapsible mw-collapsed"><div class="mw-collapsible-toggle" style="float:none;">▶ '''default subvolume''' </div><div class="mw-collapsible-content">The default subvolume of a Btrfs '''[[Btrfs#Btrfs_Volume|volume]]''' is special. When you mount, you normally have to name a '''[[Btrfs#subvolume|subvolume]]''' to mount. When you don't name a subvolume, the default subvolume will be used. The default subvolume can be changed to any subvolume. It is advisable to set that subvolume as default, that is used for mounting linux '''"/"''' this is often the subvolume with the name '''"@"'''
</div></div>
</div></div>


<div class="mw-collapsible mw-collapsed"><div class="mw-collapsible-toggle" style="float:none;">▶ Btrfs '''volume-root''' "/", Btrfs '''layout''' </div><div class="mw-collapsible-content">A volume contains one ore more subvolumes. But they are not stored in form of a simple list. These subvolumes are stored in a tree-like structure like in a filesystem.  Sometimes called the "top-level subvolume" or "root of the volume". But be careful this is '''not linux-root "/"''', but Btrfs '''volume-root "/"'''. There are several basic schemas to '''layout''' subvolumes in a volume
<div class="mw-collapsible mw-collapsed"><div class="mw-collapsible-toggle" style="float:none;">▶ Btrfs '''volume-root''' "/", Btrfs '''layout''' </div><div class="mw-collapsible-content">A '''[[Btrfs#Btrfs_Volume|volume]]''' contains one ore more '''[[Btrfs#subvolume|subvolumes]]'''. But they are not stored in form of a simple list. These subvolumes are stored in a tree-like structure like in a filesystem.  Sometimes called the "top-level subvolume" or "root of the volume". But be careful this is '''not linux-root "/"''', but Btrfs '''volume-root "/"'''. There are several basic schemas to '''layout''' subvolumes in a volume
</div></div>
</div></div>


<div class="mw-collapsible mw-collapsed"><div class="mw-collapsible-toggle" style="float:none;">▶ '''snapshot'''</div><div class="mw-collapsible-content">A snapshot looks nearly the same as a subvolume. But don´t get confused. When we talk about snapshots we usually mean a "'''Read-Only (ro) photograph''' of a subvolume". While the subvolume changes with time. A snapshot stays in the state of the subvolume at the time we made it. You can mount snapshots into your linux system, but you only can read the content. And the content will never change while this snapshot exists. When creating '''snapshots''' you have to watch out for the Btrfs-'''layout''' in use.
<div class="mw-collapsible mw-collapsed"><div class="mw-collapsible-toggle" style="float:none;">▶ '''snapshot'''</div><div class="mw-collapsible-content">A '''[[Btrfs#snapshot|snapshot]]''' looks nearly the same as a  
It is possible to make a writeable(rw) subvolume out of a ro-snapshot. This is the way roll back does work.
'''[[Btrfs#snapshot|snapshot]]'''. But don´t get confused. When we talk about snapshots we usually mean a "'''Read-Only (ro) photograph''' of a subvolume". While the subvolume changes with time. A snapshot stays in the state of the subvolume at the time we made it. You can mount snapshots into your linux system, but you only can read the content. And the content will never change while this snapshot exists. When creating '''snapshots''' you have to watch out for the Btrfs-'''layout''' in use.
It is possible to make a writeable(rw) subvolume out of a ro-snapshot. This is the way '''[[Btrfs#Rollback_to_a_snapshot|roll back]]''' does work.
</div></div>
</div></div>


<div class="mw-collapsible mw-collapsed"><div class="mw-collapsible-toggle" style="float:none;">▶ Self-healing</div><div class="mw-collapsible-content">'''This is no magic.''' Because of the nature of Btrfs as CopyOnWrite filesystem and because of the checksums, it is possible to check the filesystem and repair some errors. This does happen silently.  
<div class="mw-collapsible mw-collapsed"><div class="mw-collapsible-toggle" style="float:none;">▶ Self-healing</div><div class="mw-collapsible-content">'''This is no magic.''' Because of the nature of Btrfs as '''[[Btrfs#What.27s_this_.22Copy_on_Write.22|CopyOnWrite]]''' filesystem and because of the checksums, it is possible to check the filesystem and repair some errors. This does happen silently.  


* Without raid it is possible to correct some faults that happen because of poweroutage. (when the filesystem is mounted)
* [[Btrfs#RAID_0_.28not_Just_a_Bunch_of_Disks.29|Without RAID]] it is possible to correct some small faults that happen because of power outage. (This is done when the filesystem is mounted again)
* With raid it is possible to repair some parts of files that were damaged by small faults on one device. (when the file is read)
* [[Btrfs#RAID_1_.28mirrored.29.2C_1C3.2C_1C4|With RAID1]] it is possible to repair some parts of files that where damaged by faults on one device. (This is done when the file is read the next time)
</div></div>
</div></div>


<div class="mw-collapsible mw-collapsed"><div class="mw-collapsible-toggle" style="float:none;">▶ '''scrub'''</div><div class="mw-collapsible-content">A scrub is like an inspection of your car. The mechanic will look at all parts, and will tell you if something is amiss. If he finds very small problems, he will repair this automatically without asking for permission, and with minimal extra cost.  
<div class="mw-collapsible mw-collapsed"><div class="mw-collapsible-toggle" style="float:none;">▶ '''scrub'''</div><div class="mw-collapsible-content">A '''[[Btrfs#scrub|scrub]]''' is like an inspection of your car. The mechanic will look at all parts, and will tell you if something is amiss. If he finds very small problems, he will repair this automatically without asking for permission, and with minimal extra cost.  
</div></div>
</div></div>


<div class="mw-collapsible mw-collapsed"><div class="mw-collapsible-toggle" style="float:none;">▶ '''balance'''</div><div class="mw-collapsible-content">A balance is like renovating your home. Sometimes it is necessary to renovate a room, sometimes you will renovate your home completely. But you don't do it once in every week ;-) With balance, the furniture is transported around and sorted. '''You need to do this when changing RAID-levels.'''
<div class="mw-collapsible mw-collapsed"><div class="mw-collapsible-toggle" style="float:none;">▶ '''balance'''</div><div class="mw-collapsible-content">A '''[[Btrfs#balance|balance]]''' is like renovating your home. Sometimes it is necessary to renovate a room, sometimes you will renovate your home completely. But you don't do it once in every week ;-) With balance, the furniture will be transported around and rearranged. '''You need to do this when changing RAID-levels.'''
</div></div>
</div></div>


translator
987

edits