I dont think i follow what you meant by "parse the output for the warning and answer yes".
Example: $ echo "1,1000,L" | sudo sfdisk /dev/vdb $ grep "vdb" /proc/partitions 253 16 20971520 vdb 253 17 504000 vdb1 $ sudo mkfs /dev/vdb1 $ sudo mount /dev/vdb1 /mnt ## now /dev/vdb is busy (mounted) try to resizepart on it. $ sudo parted /dev/vdb resizepart 1 </dev/null Warning: Partition /dev/vdb1 is being used. Are you sure you want to continue? $ echo $? 1 # so that didn't resize (reading from /dev/null). Not surprising. # try with 'Yes' to stdin. echo "Yes" | sudo parted /dev/vdb resizepart 1; echo $? Warning: Partition /dev/vdb1 is being used. Are you sure you want to continue? 1 I also failed in an attempt with 'expect', but not sure thats relevant as I dont want to use expect anyway, and I might have done something wrong. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1212492 Title: cc_growpart broken if parted resizefs found To manage notifications about this bug go to: https://bugs.launchpad.net/cloud-init/+bug/1212492/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs