salt
salt copied to clipboard
Format entire device with Blockdev.formatted does not work
Hi,
on a centos 7 machine the salt-state blockdev.formatted can't force-format an entire device. It results in an error telling that the device can't be formatted.
ID: /dev/sdc
Function: blockdev.formatted
Result: False
Comment: Failed to format /dev/sdc
Started: 09:48:27.500593
Duration: 30205.33 ms
I'm using this snippet:
format_datadisk:
blockdev.formatted:
- name: /dev/sdc
- fs_type: ext4
The Salt-Minion is logging this:
[INFO ] Executing command 'mkfs -t ext4 /dev/sdc' in directory '/root'
Feb 08 13:56:59 bench1 salt-minion[13659]: [ERROR ] Command 'mkfs -t ext4 /dev/sdc' failed with return code: 1
Feb 08 13:56:59 bench1 salt-minion[13659]: [ERROR ] output: mke2fs 1.42.9 (28-Dec-2013)
Feb 08 13:56:59 bench1 salt-minion[13659]: /dev/sdc is entire device, not just one partition!
Feb 08 13:56:59 bench1 salt-minion[13659]: Proceed anyway? (y,n)
Feb 08 13:56:59 bench1 salt-minion[13659]: [INFO ] Check blk fstype attempt 1 of 10
Feb 08 13:56:59 bench1 salt-minion[13659]: [INFO ] Executing command 'lsblk -o fstype /dev/sdc' in directory '/root
The reason why its asking to proceed is, that the mkfs-command has no -F flag that forces the formatting with ext4 like following command does:
mkfs.ext4 -F /dev/sdc
The issue is coming out of this post on google group (see https://groups.google.com/forum/#!topic/salt-users/78MxegPD4H0).
@mikethebeer, thanks for the report.