Re-partition disk into 2 filesystems



I'm trying to write a recipe to unmount an existing /mnt filesystem (~ 50 Gbytes), wipe the partition (it's empty) and use parted to create 2 new partitions. Then I want it to mount the 2 new partitions as /newone (2 GBytes) and /mnt (~48 GBytes). I would also like this to be idempotent, so that if it's already been completed it doesn't try to do it again. I'm thinking I'll need to specify the device as part of my attributes as this could potentially be different on each VM.

I would also like to test this first using test kitchen, so that I don't accidentally wipe my VM and have to get it rebuilt. (we have a seperate provisioning team for this unfortunately).

I'm thinking the best approach will be a script resource to umount and re-partition, and then a mount resource to create the 2 new filesystems.

Does this seem like a sensible approach, and are there any gotchas that I should be aware of?

I see there are some mentions after searching about creating extra disks in kitchen, however I tried adding those lines to my kitchen.yml and nothing changed.

Many thanks,

Steve Button