@@ -68,13 +68,17 @@ Remove device(s) from a filesystem identified by <path>
Device removal must satisfy the profile constraints, otherwise the command
fails. The filesystem must be converted to profile(s) that would allow the
removal. This can typically happen when going down from 2 devices to 1 and
-using the RAID1 profile. See the example section below.
+using the RAID1 profile. See the *TYPICAL USECASES* section below.
+
The operation can take long as it needs to move all data from the device.
+
It is possible to delete the device that was used to mount the filesystem. The
device entry in mount table will be replaced by another device name with the
lowest device id.
++
+If device is mounted as degraded mode (-o degraded), special term "missing"
+can be used for <device>. In that case, the first device that is described by
+the filesystem metadata, but not preseted at the mount time will be removed.
*delete* <device>|<devid> [<device>|<devid>...] <path>::
Alias of remove kept for backward compatibility
@@ -206,6 +210,19 @@ data or the block groups occupy the whole first device.
The device size of '/dev/sdb' as seen by the filesystem remains unchanged, but
the logical space from 50-100GiB will be unused.
+==== REMOVE DEVICE ====
+
+Device removal must satisfy the profile constraints, otherwise the command
+fails. For example:
+
+ $ btrfs device remove /dev/sda /mnt
+ ERROR: error removing device '/dev/sda': unable to go below two devices on raid1
+
+In order to remove a device, you need to convert the profile in this case:
+
+ $ btrfs balance start -mconvert=dup -dconvert=single /mnt
+ $ btrfs device remove /dev/sda /mnt
+
DEVICE STATS
------------
@@ -224,9 +224,16 @@ static int _cmd_device_remove(int argc, char **argv,
return !!ret;
}
+#define COMMON_USAGE_REMOVE_DELETE \
+ "", \
+ "If 'missing' is specified for <device>, the first device that is", \
+ "described by the filesystem metadata, but not presented at the", \
+ "mount time will be removed."
+
static const char * const cmd_device_remove_usage[] = {
"btrfs device remove <device>|<devid> [<device>|<devid>...] <path>",
"Remove a device from a filesystem",
+ COMMON_USAGE_REMOVE_DELETE,
NULL
};
@@ -238,6 +245,7 @@ static int cmd_device_remove(int argc, char **argv)
static const char * const cmd_device_delete_usage[] = {
"btrfs device delete <device>|<devid> [<device>|<devid>...] <path>",
"Remove a device from a filesystem (alias of \"btrfs device remove\")",
+ COMMON_USAGE_REMOVE_DELETE,
NULL
};