I'm trying to create a script that formats an Amazon EC2 EBS volume, so I can mount it.
From the command-line, it looks like this:
> mkfs -q -t ext4 /dev/sdf
/dev/sdf is entire device, not just one partition!
Proceed anyway? (y,n)
(The command is correct; no need to create a partition table for my purpose)
My problem: because this command is supposed to be run in an automated script, I can't have that question on the terminal; nobody will be answering and the script will hang. How do I avoid this?
I tried:
> echo y | mkfs -q -t ext4 /dev/sdf
but that doesn't do the trick. The -q option makes no difference either.
From the manpage:
So call
mkfs.ext4
directly instead of viamkfs
, and add the-F
parameter to ignore this warning.expect
is what you're looking for. Try something like this: