66be6b344d3b9c6026283e69e5855115e83565df
[platform/upstream/btrfs-progs.git] / Documentation / btrfs-device.txt
1 btrfs-device(8)
2 ===============
3
4 NAME
5 ----
6 btrfs-device - control btrfs devices
7
8 SYNOPSIS
9 --------
10 *btrfs device* <subcommand> <args>
11
12 DESCRIPTION
13 -----------
14 *btrfs device* is used to control the btrfs devices, since btrfs can be used
15 across several devices, *btrfs device* is used for multiple device management.
16
17 DEVICE MANAGEMENT
18 -----------------
19 Btrfs filesystem is capable to manage multiple devices.
20
21 Btrfs filesystem uses different profiles to manage different RAID level, and
22 use balance to rebuild chunks, also devices can be added/removed/replace
23 online.
24
25 Profile::
26 Btrfs filesystem uses data/metadata profiles to manage allocation/duplication
27 mechanism. +
28 Profiles like RAID level can be assigned to data and metadata separately.
29 +
30 See `mkfs.btrfs`(8) for more details.
31
32 RAID level::
33 Btrfs filesystem supports most of the standard RAID level: 0/1/5/6/10. +
34 RAID levels can be assigned at mkfs time or online.
35 +
36 See `mkfs.btrfs`(8) for mkfs time RAID level assign and `btrfs-balance`(8) for
37 online RAID level assign.
38 +
39 NOTE: Since btrfs is under heavy development especially the RAID5/6 support,
40 it is *highly* recommended to read the follow btrfs wiki page to get more
41 updated details on RAID5/6: +
42 https://btrfs.wiki.kernel.org/index.php/RAID56
43
44 Balance::
45 `btrfs-balance`(8) subcommand can be used to balance or rebuild chunks to the
46 desired profile.
47 +
48 Due to the fact that balance can rebuild/recovery chunks according to its RAID
49 duplication if possible, so when using RAID1/5/6/10 with some devices failed
50 and you just added a new device to btrfs using `btrfs-device`(8), you should
51 run `btrfs-balance`(8) to rebuild the chunks.
52 +
53 See `btrfs-balance`(8) for more details.
54
55 Device add/remove/replace::
56 Device can be added/removed using `btrfs-replace`(8) subcommand and replaced
57 using `btrfs-replace`(8).
58 +
59 When device is removed or replaced, btrfs will do the chunk rebuild if needed.
60 +
61 See `btrfs-replace`(8) and this man page for more details.
62
63 SUBCOMMAND
64 ----------
65 *add* [-Kf] <dev> [<dev>...] <path>::
66 Add device(s) to the filesystem identified by <path>.
67 +
68 If applicable, a whole device discard (TRIM) operation is performed.
69 +
70 `Options`
71 +
72 -K|--nodiscard::::
73 do not perform discard by default
74 -f|--force::::
75 force overwrite of existing filesystem on the given disk(s)
76
77 *delete* <dev> [<dev>...] <path>::
78 Remove device(s) from a filesystem identified by <path>.
79
80 *ready* <device>::
81 Check device to see if it has all of it's devices in cache for mounting.
82
83 *scan* [(--all-devices|-d)|<device> [<device>...]]::
84 Scan devices for a btrfs filesystem.
85 +
86 If one or more devices are passed, these are scanned for a btrfs filesystem. 
87 If no devices are passed, btrfs uses block devices containing btrfs
88 filesystem as listed by blkid.
89 Finally, if '--all-devices' or '-d' is passed, all the devices under /dev are 
90 scanned.
91
92 *stats* [-z] <path>|<device>::
93 Read and print the device IO stats for all devices of the filesystem
94 identified by <path> or for a single <device>.
95 +
96 `Options`
97 +
98 -z::::
99 Reset stats to zero after reading them.
100
101 *usage* [options] <path> [<path>...]::
102 Show detailed information about internal allocations in devices.
103 +
104 `Options`
105 +
106 -b|--raw::::
107 raw numbers in bytes, without the 'B' suffix
108 -h|--human-readable::::
109 print human friendly numbers, base 1024, this is the default
110 -H::::
111 print human friendly numbers, base 1000
112 --iec::::
113 select the 1024 base for the following options, according to the IEC standard
114 --si::::
115 select the 1000 base for the following options, according to the SI standard
116 -k|--kbytes::::
117 show sizes in KiB, or kB with --si
118 -m|--mbytes::::
119 show sizes in MiB, or MB with --si
120 -g|--gbytes::::
121 show sizes in GiB, or GB with --si
122 -t|--tbytes::::
123 show sizes in TiB, or TB with --si
124
125 If conflicting options are passed, the last one takes precedence.
126
127 EXIT STATUS
128 -----------
129 *btrfs device* returns a zero exit status if it succeeds. Non zero is
130 returned in case of failure.
131
132 AVAILABILITY
133 ------------
134 *btrfs* is part of btrfs-progs.
135 Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for
136 further details.
137
138 SEE ALSO
139 --------
140 `mkfs.btrfs`(8),
141 `btrfs-replace`(8),
142 `btrfs-balance`(8)