]> www.infradead.org Git - users/sagi/nvme-cli.git/commit
nvme-cli: Warn and delay before formatting
authorKeith Busch <kbusch@kernel.org>
Wed, 21 Aug 2019 22:28:19 +0000 (16:28 -0600)
committerKeith Busch <keith.busch@intel.com>
Thu, 22 Aug 2019 16:07:35 +0000 (10:07 -0600)
commitf7cc36996969c5c594e68ce1b1baef09322d2350
tree7fe4398f63aa3f105a72e62986cf1ae8e422e679
parent995b62d3ba7a360926cceb09020afc3dd631d8d4
nvme-cli: Warn and delay before formatting

By popular demand, have format print a warning that shows the relatives of
the device the format was sent to.

  If this command was issued to a block device, its relative are the
  parent controllers.

  If this command was issued to a controller device, its relative children
  are namespace block devices.

This provides a visual clue that /dev/nvme0 may or may not be the parent
controller to namespace /dev/nvme0n1, and provides ample time for the
user to abort the operation if they didn't mean to do this.

Here are some examples of what this change provides sending this command
to a controller first, then to a multipathed namespace:

  # nvme format /dev/nvme0 -n 1
  You are about to format nvme0, namespace 0x1.
  Controller nvme0 has child namespace(s):nvme2n1

  # nvme format /dev/nvme4n1
  You are about to format nvme4n1, namespace 0x1.
  Namespace nvme4n1 has parent controller(s):nvme4, nvme5

Link: https://github.com/linux-nvme/nvme-cli/issues/501
Signed-off-by: Keith Busch <kbusch@kernel.org>
Documentation/nvme-format.txt
nvme.c