Debian Codegraph @

upstream/opensuse-leap-16-1/man8/btrfs-replace.8

raw
1 .\" Man page generated from reStructuredText.
2 .
3 .
4 .nr rst2man-indent-level 0
5 .
6 .de1 rstReportMargin
7 \\$1 \\n[an-margin]
8 level \\n[rst2man-indent-level]
9 level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
10 -
11 \\n[rst2man-indent0]
12 \\n[rst2man-indent1]
13 \\n[rst2man-indent2]
14 ..
15 .de1 INDENT
16 .\" .rstReportMargin pre:
17 . RS \\$1
18 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
19 . nr rst2man-indent-level +1
20 .\" .rstReportMargin post:
21 ..
22 .de UNINDENT
23 . RE
24 .\" indent \\n[an-margin]
25 .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
26 .nr rst2man-indent-level -1
27 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
28 .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
29 ..
30 .TH "BTRFS-REPLACE" "8" "Mar 26, 2025" "6.14" "BTRFS"
31 .SH NAME
32 btrfs-replace \- replace devices managed by btrfs with other device
33 .SH SYNOPSIS
34 .sp
35 \fBbtrfs replace\fP <subcommand> <args>
36 .SH DESCRIPTION
37 .sp
38 \fBbtrfs replace\fP is used to replace btrfs managed devices with other device.
39 .SH SUBCOMMAND
40 .INDENT 0.0
41 .TP
42 .B cancel <mount_point>
43 Cancel a running device replace operation.
44 .TP
45 .B start [options] <srcdev>|<devid> <targetdev> <path>
46 Replace device of a btrfs filesystem.
47 .sp
48 On a live filesystem, duplicate the data to the target device which
49 is currently stored on the source device.
50 If the source device is not available anymore, or if the \-r option is set,
51 the data is built only using the RAID redundancy mechanisms.
52 After completion of the operation, the source device is removed from the
53 filesystem.
54 If the \fIsrcdev\fP is a numerical value, it is assumed to be the device id
55 of the filesystem which is mounted at \fIpath\fP, otherwise it is
56 the path to the source device. If the source device is disconnected,
57 from the system, you have to use the devid parameter format.
58 The \fItargetdev\fP needs to be same size or larger than the \fIsrcdev\fP\&.
59 .sp
60 \fBNOTE:\fP
61 .INDENT 7.0
62 .INDENT 3.5
63 The filesystem has to be resized to fully take advantage of a
64 larger target device; this can be achieved with
65 \fBbtrfs filesystem resize <devid>:max /path\fP
66 .UNINDENT
67 .UNINDENT
68 .sp
69 \fBOptions\fP
70 .INDENT 7.0
71 .TP
72 .B \-r
73 only read from \fIsrcdev\fP if no other zero\-defect mirror exists.
74 (enable this if your drive has lots of read errors, the access would be very
75 slow)
76 .TP
77 .B \-f
78 force using and overwriting \fItargetdev\fP even if it looks like
79 it contains a valid btrfs filesystem.
80 .sp
81 A valid filesystem is assumed if a btrfs superblock is found which contains a
82 correct checksum. Devices that are currently mounted are
83 never allowed to be used as the \fItargetdev\fP\&.
84 .TP
85 .B \-B
86 no background replace.
87 .TP
88 .B \-\-enqueue
89 wait if there\(aqs another exclusive operation running, otherwise continue
90 .UNINDENT
91 .INDENT 7.0
92 .TP
93 .B \-K|\-\-nodiscard
94 Do not perform whole device TRIM operation on devices that are capable of that.
95 This does not affect discard/trim operation when the filesystem is mounted.
96 Please see the mount option \fIdiscard\fP for that in \fI\%btrfs(5)\fP\&.
97 .UNINDENT
98 .TP
99 .B status [\-1] <mount_point>
100 Print status and progress information of a running device replace operation.
101 .sp
102 \fBOptions\fP
103 .INDENT 7.0
104 .TP
105 .B \-1
106 print once instead of print continuously until the replace
107 operation finishes (or is cancelled)
108 .UNINDENT
109 .UNINDENT
110 .SH EXAMPLES
111 .SS Replacing an online drive with a bigger one
112 .sp
113 Given the following filesystem mounted at \fB/mnt/my\-vault\fP
114 .INDENT 0.0
115 .INDENT 3.5
116 .sp
117 .EX
118 Label: \(aqMyVault\(aq uuid: ae20903e\-b72d\-49ba\-b944\-901fc6d888a1
119 Total devices 2 FS bytes used 1TiB
120 devid 1 size 1TiB used 500.00GiB path /dev/sda
121 devid 2 size 1TiB used 500.00GiB path /dev/sdb
122 .EE
123 .UNINDENT
124 .UNINDENT
125 .sp
126 In order to replace \fB/dev/sda\fP (\fIdevid 1\fP) with a bigger drive located at
127 \fB/dev/sdc\fP you would run the following:
128 .INDENT 0.0
129 .INDENT 3.5
130 .sp
131 .EX
132 btrfs replace start 1 /dev/sdc /mnt/my\-vault/
133 .EE
134 .UNINDENT
135 .UNINDENT
136 .sp
137 You can monitor progress via:
138 .INDENT 0.0
139 .INDENT 3.5
140 .sp
141 .EX
142 btrfs replace status /mnt/my\-vault/
143 .EE
144 .UNINDENT
145 .UNINDENT
146 .sp
147 After the replacement is complete, as per the docs at \fI\%btrfs\-filesystem(8)\fP in
148 order to use the entire storage space of the new drive you need to run:
149 .INDENT 0.0
150 .INDENT 3.5
151 .sp
152 .EX
153 btrfs filesystem resize 1:max /mnt/my\-vault/
154 .EE
155 .UNINDENT
156 .UNINDENT
157 .SH EXIT STATUS
158 .sp
159 \fBbtrfs replace\fP returns a zero exit status if it succeeds. Non zero is
160 returned in case of failure.
161 .SH AVAILABILITY
162 .sp
163 \fBbtrfs\fP is part of btrfs\-progs. Please refer to the documentation at
164 \X'tty: link https://btrfs.readthedocs.io'\fI\%https://btrfs.readthedocs.io\fP\X'tty: link'\&.
165 .SH SEE ALSO
166 .sp
167 \fI\%btrfs\-device(8)\fP,
168 \fI\%btrfs\-filesystem(8)\fP,
169 \fI\%mkfs.btrfs(8)\fP
170 .\" Generated by docutils manpage writer.
171 .