如何扩展OpenStack Hypervisor本地磁盘容量?DevStack存储扩容咨询
Hey there! Let me walk you through the steps to add your 2TB RAID drive and expand the local storage for your DevStack-deployed OpenStack Hypervisor. I'll break this down into two main parts: preparing the RAID disk, then expanding the storage for your compute node.
1. Prepare the RAID Disk First
Before touching OpenStack, make sure your RAID array is properly recognized and configured on the host system:
- Verify the RAID disk is detected: Run
lsblkto list all block devices—you should see your 2TB RAID device (usually something like/dev/md0or a dedicated disk name if using hardware RAID). - Create a file system: Format the RAID device with a compatible FS (XFS is recommended for OpenStack):
mkfs.xfs /dev/your_raid_device - Get the disk UUID: Use
blkid /dev/your_raid_deviceto grab the UUID—this is needed for persistent mounting. - Mount temporarily (for testing):
mkdir /mnt/openstack_new_storage mount /dev/your_raid_device /mnt/openstack_new_storage
2. Expand Hypervisor Local Storage
How you expand depends on what you're using the local storage for (Nova instance storage or Cinder local volumes). Let's cover both common cases.
Case 1: Expanding Nova Instance Storage (Default DevStack Setup)
DevStack defaults to storing Nova instances in /var/lib/nova/instances. Here are two safe ways to expand this:
Option A: Migrate Instance Data to the New RAID Disk
This is straightforward if you want to move all instance storage to the new drive:
- Pause/stop running instances: To avoid data corruption, pause or shut down all VMs:
# Pause a single instance openstack server pause <instance_name_or_id> # Or shut down if downtime is acceptable openstack server stop <instance_name_or_id> - Stop the Nova Compute service:
systemctl stop devstack@n-compute.service - Copy existing instance data: Use
rsyncto safely transfer data to the new mount point:rsync -avz /var/lib/nova/instances/* /mnt/openstack_new_storage/ - Backup the original directory:
mv /var/lib/nova/instances /var/lib/nova/instances.bak - Set up persistent mount:
- Create the new mount point:
mkdir /var/lib/nova/instances - Edit
/etc/fstaband add this line (replaceYOUR_UUIDwith the value fromblkid):UUID=YOUR_UUID /var/lib/nova/instances xfs defaults 0 0 - Mount the drive:
mount /var/lib/nova/instances
- Create the new mount point:
- Fix permissions: Ensure the Nova user owns the directory:
chown nova:nova /var/lib/nova/instances - Restart services and resume instances:
systemctl start devstack@n-compute.service # Resume instances openstack server unpause <instance_name_or_id> # Or start if you shut them down openstack server start <instance_name_or_id>
Option B: Expand with LVM (If Instance Storage is on a Logical Volume)
If your /var/lib/nova/instances is already on an LVM volume, you can extend it with the new RAID disk:
- Add the RAID disk to your existing volume group:
vgextend <your_volume_group_name> /dev/your_raid_device - Expand the logical volume:
lvextend -l +100%FREE /path/to/your/logical_volume - Resize the file system:
- For XFS:
xfs_growfs /path/to/your/logical_volume - For EXT4:
resize2fs /path/to/your/logical_volume
- For XFS:
Case 2: Expanding Cinder Local LVM Storage
If you're using Cinder's local LVM backend (DevStack enables this by default), adding the RAID disk to the Cinder volume group is simple:
- Add the RAID disk to the
cinder-volumesvolume group:vgextend cinder-volumes /dev/your_raid_device - Cinder will automatically detect the new free space—you don't need to restart any services. New volumes you create will use the expanded storage.
Key Notes to Remember
- Backup first: Always back up critical data (instance images, Cinder volumes) before making storage changes.
- RAID validation: Double-check your RAID array's health (use tools like
mdadmfor software RAID or your hardware RAID manager) before proceeding. - Test in staging: If this is a production-like environment, test these steps in a staging setup first to avoid surprises.
内容的提问来源于stack exchange,提问作者Inmd

