Estou desenvolvendo uma ferramenta de particionamento, para fins de teste tenho que executar configurações de particionamento e LVM repetidamente em um dispositivo de loopback
- Partição
/dev/loop0
com 3 partições/dev/loop0p1 /dev/loop0p2 /dev/loop0p3
- Criar LVMs
pvcreate /dev/loop0p2 /dev/loop0p3
vgcreate test_vg /dev/loop0p2 /dev/loop0p3
lvcreate -L 1GB test_vg -n vol1 --wipesignature y --zero y
lvcreate -L 1GB test_vg -n vol2 --wipesignature y --zero y
partprobe /dev/loop0
Após tal execução gostaria de retornar tudo novamente no mesmo dispositivo, porém, ao executar o particionamento estou recebendo o erro
Partition(s) 2, 3 on /dev/loop0 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes.
Agora estou ciente de que uma solução é reiniciar, mas não é razoável fazer isso continuamente durante o desenvolvimento. Existe uma maneira de corrigir o problema sem precisar reiniciar o tempo todo?