Difference between revisions of "Btrfs"

From wiki
(btrfs-tools => btrfs-progs)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Warning|msg = Btrfs is still a new filesystem. While many (including myself) find it stable enough for everyday use, don't use it for critical services and be prepared to use you backups.}}
+
{{Warning|msg = Btrfs is still a new filesystem. While many (including myself) find it stable enough for everyday use, don't use it for critical services and be prepared to use you backups.<br/>
 +
See [https://btrfs.wiki.kernel.org/index.php/Status status page] on Btrfs wiki for up-to-date info.}}
  
 
== Install ==
 
== Install ==
 
To create and manipulate Btrfs volumes, you will need to install<syntaxhighlight lang="console">
 
To create and manipulate Btrfs volumes, you will need to install<syntaxhighlight lang="console">
# apt install btrfs-progs
+
$ sudo apt install btrfs-progs
 
</syntaxhighlight>
 
</syntaxhighlight>
  
=== Debian Jessie ===
+
== Create a filesystem ==
Btrfs being still very young, it is recommended to use recent version of the kernel and  btrfs-progs
 
* [[Kernel from Jessie Backports]]
 
* <syntaxhighlight lang="console">
 
# apt install btrfs-progs/jessie-backports
 
</syntaxhighlight>
 
  
== Create a filesystem ==
+
=== mkfs ===
  
=== Single Disk ===
+
==== Single Disk ====
 
<syntaxhighlight lang="console">
 
<syntaxhighlight lang="console">
# mkfs.btrfs /dev/sdb
+
$ sudo mkfs.btrfs /dev/sdb
 
</syntaxhighlight>
 
</syntaxhighlight>
  
=== Raid 1 ===
+
==== Raid 1 ====
 
<syntaxhighlight lang="console">
 
<syntaxhighlight lang="console">
# mkfs.btrfs -mraid1 -draid1 /dev/sdb /dev/sdc
+
$ sudo mkfs.btrfs -mraid1 -draid1 /dev/sdb /dev/sdc
 
</syntaxhighlight>
 
</syntaxhighlight>
  
=== Raid 0 ===
+
==== Raid 0 ====
 
<syntaxhighlight lang="console">
 
<syntaxhighlight lang="console">
# mkfs.btrfs -mraid1 -draid0 /dev/sdb /dev/sdc
+
$ sudo mkfs.btrfs -mraid1 -draid0 /dev/sdb /dev/sdc
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
=== Mount ===
 +
<syntaxhighlight lang="console">
 +
$ sudo mount /dev/sdb /mnt
 +
</syntaxhighlight>When mounting raid disks, only one of the disks need to be specified in the command. Btrfs will find the other one automatically.
  
 
== Subvolumes ==
 
== Subvolumes ==
 
To create a subvolume just use the command<syntaxhighlight lang="console">
 
To create a subvolume just use the command<syntaxhighlight lang="console">
# btrfs subvolume create /<path>
+
$ sudo btrfs subvolume create /<path>
 +
</syntaxhighlight>To create a snapshot use<syntaxhighlight lang="console">
 +
$ sudo btrfs subvolume snapshot /<source-path> /<destination-path>
 
</syntaxhighlight>
 
</syntaxhighlight>
 
[[Category:Linux Desktop]]
 
[[Category:Linux Desktop]]
 
[[Category:Linux Server]]
 
[[Category:Linux Server]]
 
[[Category:Debian Release]]
 
[[Category:Debian Release]]

Latest revision as of 21:38, 12 November 2017

Warning Warning: Btrfs is still a new filesystem. While many (including myself) find it stable enough for everyday use, don't use it for critical services and be prepared to use you backups.
See status page on Btrfs wiki for up-to-date info.

Install

To create and manipulate Btrfs volumes, you will need to install

$ sudo apt install btrfs-progs

Create a filesystem

mkfs

Single Disk

$ sudo mkfs.btrfs /dev/sdb

Raid 1

$ sudo mkfs.btrfs -mraid1 -draid1 /dev/sdb /dev/sdc

Raid 0

$ sudo mkfs.btrfs -mraid1 -draid0 /dev/sdb /dev/sdc

Mount

$ sudo mount /dev/sdb /mnt

When mounting raid disks, only one of the disks need to be specified in the command. Btrfs will find the other one automatically.

Subvolumes

To create a subvolume just use the command

$ sudo btrfs subvolume create /<path>

To create a snapshot use

$ sudo btrfs subvolume snapshot /<source-path> /<destination-path>