How to run cryptsetup luksFormat non-interactively

When LUKS formatting a partition, I recieve the message

# cryptsetup luksFormat /dev/sdb

This will overwrite data on /dev/sdb irrevocably.

Are you sure? (Type uppercase yes): YES

Followed by Enter passphrase:.

How can I automatically answer YES to the question "Are you sure ?

  • I have updated the question – 1228693 Dec 11 '16 at 17:56

You could make use of the --batch-mode, -q option of cryptsetup to skip the question.

$ cryptsetup -q luksFormat /dev/sdb

This option also disables password verification, so one should use it with care or in an automated environment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.