.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "BTRFS-REPLACE" "8" "Jan 31, 2024" "6.6.3" "BTRFS" .SH NAME btrfs-replace \- replace devices managed by btrfs with other device .SH SYNOPSIS .sp \fBbtrfs replace\fP .SH DESCRIPTION .sp \fBbtrfs replace\fP is used to replace btrfs managed devices with other device. .SH SUBCOMMAND .INDENT 0.0 .TP .B cancel Cancel a running device replace operation. .TP .B start [options] | Replace device of a btrfs filesystem. .sp On a live filesystem, duplicate the data to the target device which is currently stored on the source device. If the source device is not available anymore, or if the \-r option is set, the data is built only using the RAID redundancy mechanisms. After completion of the operation, the source device is removed from the filesystem. If the \fIsrcdev\fP is a numerical value, it is assumed to be the device id of the filesystem which is mounted at \fIpath\fP, otherwise it is the path to the source device. If the source device is disconnected, from the system, you have to use the devid parameter format. The \fItargetdev\fP needs to be same size or larger than the \fIsrcdev\fP\&. .sp \fBNOTE:\fP .INDENT 7.0 .INDENT 3.5 The filesystem has to be resized to fully take advantage of a larger target device; this can be achieved with \fBbtrfs filesystem resize :max /path\fP .UNINDENT .UNINDENT .sp \fBOptions\fP .INDENT 7.0 .TP .B \-r only read from \fIsrcdev\fP if no other zero\-defect mirror exists. (enable this if your drive has lots of read errors, the access would be very slow) .TP .B \-f force using and overwriting \fItargetdev\fP even if it looks like it contains a valid btrfs filesystem. .sp A valid filesystem is assumed if a btrfs superblock is found which contains a correct checksum. Devices that are currently mounted are never allowed to be used as the \fItargetdev\fP\&. .TP .B \-B no background replace. .TP .B \-\-enqueue wait if there\(aqs another exclusive operation running, otherwise continue .UNINDENT .INDENT 7.0 .TP .B \-K|\-\-nodiscard Do not perform whole device TRIM operation on devices that are capable of that. This does not affect discard/trim operation when the filesystem is mounted. Please see the mount option \fIdiscard\fP for that in \fI\%btrfs(5)\fP\&. .UNINDENT .TP .B status [\-1] Print status and progress information of a running device replace operation. .sp \fBOptions\fP .INDENT 7.0 .TP .B \-1 print once instead of print continuously until the replace operation finishes (or is cancelled) .UNINDENT .UNINDENT .SH EXAMPLES .SS Replacing an online drive with a bigger one .sp Given the following filesystem mounted at \fB/mnt/my\-vault\fP .INDENT 0.0 .INDENT 3.5 .sp .EX Label: \(aqMyVault\(aq uuid: ae20903e\-b72d\-49ba\-b944\-901fc6d888a1 Total devices 2 FS bytes used 1TiB devid 1 size 1TiB used 500.00GiB path /dev/sda devid 2 size 1TiB used 500.00GiB path /dev/sdb .EE .UNINDENT .UNINDENT .sp In order to replace \fB/dev/sda\fP (\fIdevid 1\fP) with a bigger drive located at \fB/dev/sdc\fP you would run the following: .INDENT 0.0 .INDENT 3.5 .sp .EX btrfs replace start 1 /dev/sdc /mnt/my\-vault/ .EE .UNINDENT .UNINDENT .sp You can monitor progress via: .INDENT 0.0 .INDENT 3.5 .sp .EX btrfs replace status /mnt/my\-vault/ .EE .UNINDENT .UNINDENT .sp After the replacement is complete, as per the docs at \fI\%btrfs\-filesystem(8)\fP in order to use the entire storage space of the new drive you need to run: .INDENT 0.0 .INDENT 3.5 .sp .EX btrfs filesystem resize 1:max /mnt/my\-vault/ .EE .UNINDENT .UNINDENT .SH EXIT STATUS .sp \fBbtrfs replace\fP returns a zero exit status if it succeeds. Non zero is returned in case of failure. .SH AVAILABILITY .sp \fBbtrfs\fP is part of btrfs\-progs. Please refer to the documentation at \fI\%https://btrfs.readthedocs.io\fP\&. .SH SEE ALSO .sp \fI\%btrfs\-device(8)\fP, \fI\%btrfs\-filesystem(8)\fP, \fI\%mkfs.btrfs(8)\fP .\" Generated by docutils manpage writer. .