summaryrefslogtreecommitdiff
path: root/Documentation/btrfs-device.txt
blob: 0f7917d894a09d84729a9a789754547c462dd080 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
btrfs-device(8)
===============

NAME
----
btrfs-device - control btrfs devices

SYNOPSIS
--------
*btrfs device* <subcommand> <args>

DESCRIPTION
-----------
*btrfs device* is used to control the btrfs devices, since btrfs can be used
across several devices, *btrfs device* is used for multiple device management.

DEVICE MANAGEMENT
-----------------
Btrfs filesystem is capable to manage multiple devices.

Btrfs filesystem uses different profiles to manage different RAID level, and
use balance to rebuild chunks, also devices can be added/removed/replace
online.

Profile::
Btrfs filesystem uses data/metadata profiles to manage allocation/duplication
mechanism. +
Profiles like RAID level can be assigned to data and metadata separately.
+
See `mkfs.btrfs`(8) for more details.

RAID level::
Btrfs filesystem supports most of the standard RAID level: 0/1/5/6/10. +
RAID levels can be assigned at mkfs time or online.
+
See `mkfs.btrfs`(8) for mkfs time RAID level assign and `btrfs-balance`(8) for
online RAID level assign.
+
NOTE: Since btrfs is under heavy development especially the RAID5/6 support,
it is *highly* recommended to read the follow btrfs wiki page to get more
updated details on RAID5/6: +
https://btrfs.wiki.kernel.org/index.php/RAID56

Balance::
`btrfs-balance`(8) subcommand can be used to balance or rebuild chunks to the
desired profile.
+
Due to the fact that balance can rebuild/recovery chunks according to its RAID
duplication if possible, so when using RAID1/5/6/10 with some devices failed
and you just added a new device to btrfs using `btrfs-device`(8), you should
run `btrfs-balance`(8) to rebuild the chunks.
+
See `btrfs-balance`(8) for more details.

Device add/remove/replace::
Device can be added/removed using `btrfs-replace`(8) subcommand and replaced
using `btrfs-replace`(8).
+
When device is removed or replaced, btrfs will do the chunk rebuild if needed.
+
See `btrfs-replace`(8) and this man page for more details.

SUBCOMMAND
----------
*add* [-Kf] <dev> [<dev>...] <path>::
Add device(s) to the filesystem identified by <path>.
+
If applicable, a whole device discard (TRIM) operation is performed.
+
`Options`
+
-K|--nodiscard::::
do not perform discard by default
-f|--force::::
force overwrite of existing filesystem on the given disk(s)

*delete* <dev> [<dev>...] <path>::
Remove device(s) from a filesystem identified by <path>.

*scan* [(--all-devices|-d)|<device> [<device>...]]::
Scan devices for a btrfs filesystem.
+
If one or more devices are passed, these are scanned for a btrfs filesystem. 
If no devices are passed, btrfs uses block devices containing btrfs
filesystem as listed by blkid.
Finally, if '--all-devices' or '-d' is passed, all the devices under /dev are 
scanned.

*ready* <device>::
Check device to see if it has all of it's devices in cache for mounting.

*stats* [-z] <path>|<device>::
Read and print the device IO stats for all devices of the filesystem
identified by <path> or for a single <device>.
+
`Options`
+
-z::::
Reset stats to zero after reading them.

EXIT STATUS
-----------
*btrfs device* returns a zero exist status if it succeeds. Non zero is
returned in case of failure.

AVAILABILITY
------------
*btrfs* is part of btrfs-progs.
Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for
further details.

SEE ALSO
--------
`mkfs.btrfs`(8),
`btrfs-replace`(8),
`btrfs-balance`(8)