- to resize the volume, the volume must be detached first.
- but if it is the only boot volume, or the vm is created by the volume, it cannot be detached.
- Login
. ~/keystone_admin
- Check volume ID, VM ID by
cinder list
oropenstack volume list
, for ex.
VOLUME=ce6e79c1-5b57-49aa-9a66-acf17f37be70 VM=06e7979a-e23e-4f02-9b57-2bc70442be0a
- Go into mysql:
mysql
- change the volume's mount to other than
/dev/vda
so it can be unmouted.
use cinder;
select * from volume_attachment where volume_id='ce6e79c1-5b57-49aa-9a66-acf17f37be70';
update volume_attachment set mountpoint='/dev/vdb' where volume_id='ce6e79c1-5b57-49aa-9a66-acf17f37be70';
use nova;
select * from block_device_mapping where volume_id='ce6e79c1-5b57-49aa-9a66-acf17f37be70';
update block_device_mapping set device_name='/dev/vdb', boot_index=1 where volume_id = 'ce6e79c1-5b57-49aa-9a66-acf17f37be70' and deleted_at is NULL;
- detach the volume from the VM
openstack server remove volume 06e7979a-e23e-4f02-9b57-2bc70442be0a ce6e79c1-5b57-49aa-9a66-acf17f37be70
- resize the volume (e.g. to 100GB)
openstack volume set ce6e79c1-5b57-49aa-9a66-acf17f37be70 --size 100
- re-mount the volume
openstack server add volume 06e7979a-e23e-4f02-9b57-2bc70442be0a ce6e79c1-5b57-49aa-9a66-acf17f37be70
- Go into mysql and change back to
/dev/vda
use nova;
update block_device_mapping set device_name='/dev/vda' where volume_id='ce6e79c1-5b57-49aa-9a66-acf17f37be70' and deleted_at is NULL;
use cinder;
update volume_attachment set mountpoint='/dev/vda' where volume_id='ce6e79c1-5b57-49aa-9a66-acf17f37be70' and deleted=0;