Why does pvremove have a duplicate "force" in the man page?

It's a safety switch, kind of like the --please-destroy-my-drive option in hdparm. By default the program will refuse to do such a thing (as it will likely result in something broken) but it has an option to override, for people who really really really know what they are doing (at least, in their imagination).

Explanation as provided by the program itself (in addition to the manpage you already quoted)

# pvremove /dev/loop0
  PV /dev/loop0 is used by VG foobar so please use vgreduce first.
  (If you are certain you need pvremove, then confirm by using --force twice.)

# pvremove --force /dev/loop0
  PV /dev/loop0 is used by VG foobar so please use vgreduce first.
  (If you are certain you need pvremove, then confirm by using --force twice.)

# pvremove --force --force /dev/loop0
  WARNING: PV /dev/loop0 is used by VG foobar
Really WIPE LABELS from physical volume 
    "/dev/loop0" of volume group "foobar" [y/n]? y
  WARNING: Wiping physical volume label from /dev/loop0 of volume group "foobar"
  Labels on physical volume "/dev/loop0" successfully wiped.

It really doesn't want to do it and even asks for confirmation after using -ff (if ran in interactive mode).

As to why --force twice, wouldn't once be enough? LVM uses --force in other places for slightly less critical actions, so it's probably to catch people who are already in the habit of using a single --force with other LVM commands.


The second f and --force are optional:

pvremove -f

is not the same as

pvremove -ff

(and the respective equivalents pvremove --force and pvremove --force --force).

Error handling differs depending on the number of --force options. For example, by default pvremove won't remove a volume which isn't already a PV; a single --force is sufficient to disable that check. A single --force also disables prompting (for basic cases). Removing a PV which is actually in use requires two --force options.

Tags:

Linux

Rhel

Lvm