Red Hat Training
A Red Hat training course is available for RHEL 8
11.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 wiped
virsh 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