15.5.3. CLI を使用したストレージボリュームの削除
ホストシステムからストレージボリュームを削除するには、プールを停止して、その XML 定義を削除する必要があります。
前提条件
- 削除するストレージボリュームを使用する仮想マシンがすべてシャットダウンしている。
手順
virsh vol-listコマンドを使用して、指定したストレージプールにあるストレージボリュームをリスト表示します。# virsh vol-list --pool RHEL-SP Name Path --------------------------------------------------------------- .bash_history /home/VirtualMachines/.bash_history .bash_logout /home/VirtualMachines/.bash_logout .bash_profile /home/VirtualMachines/.bash_profile .bashrc /home/VirtualMachines/.bashrc .git-prompt.sh /home/VirtualMachines/.git-prompt.sh .gitconfig /home/VirtualMachines/.gitconfig vm-disk1 /home/VirtualMachines/vm-disk1オプション:
virsh vol-wipeコマンドを使用してストレージボリュームをワイプします。たとえば、ストレージプールRHEL-SPに関連付けられているvm-disk1という名前のストレージボリュームを削除する場合は、次のコマンドを実行します。# virsh vol-wipe --pool RHEL-SP vm-disk1 Vol vm-disk1 wipedvirsh vol-deleteコマンドを使用して、ストレージボリュームを削除します。たとえば、ストレージプールRHEL-SPに関連付けられているvm-disk1という名前のストレージボリュームを削除する場合は、次のコマンドを実行します。# virsh vol-delete --pool RHEL-SP vm-disk1 Vol vm-disk1 deleted
検証
virsh vol-listを再度実行して、ストレージボリュームが削除されたことを確認します。# virsh vol-list --pool RHEL-SP Name Path --------------------------------------------------------------- .bash_history /home/VirtualMachines/.bash_history .bash_logout /home/VirtualMachines/.bash_logout .bash_profile /home/VirtualMachines/.bash_profile .bashrc /home/VirtualMachines/.bashrc .git-prompt.sh /home/VirtualMachines/.git-prompt.sh .gitconfig /home/VirtualMachines/.gitconfig