How to Shrink Vultr Block Storage Volume
-
by Blog Admin
- 40
How to Shrink Vultr Block Storage Volume
A guide explaining how to reduce the size of a Vultr Block Storage volume
Vultr doesn’t support direct shrinking of Block Storage volumes. To reduce volume size, create a smaller volume, copy the necessary data from the original, and delete the larger one.
Follow this guide to migrate your data to a smaller Vultr Block Storage volume.
- Manual Migration
- Inventory your files to determine the space needed.
- On Windows, you can use the File explorer, or use the
fsutiltool.pwsh> fsutil volume diskfree E:\
- On Linux and FreeBSD based instance, use the
dfcommand.console$ sudo df -h /mnt/blockstorage
- On Windows, you can use the File explorer, or use the
- Create a new Vultr Block Storage volume of the required size in the same region as your instance.
- Attach the new volume on your instance, then mount it.
- Copy your files from the larger block storage volume to the new, smaller volume. Use the tools appropriate for your platform.
- On Windows, use the
robocopytool.pwsh> robocopy E:\ F:\ /E /XD "temp"
This command copies all the files from
E:\toF:\, excluding thetempfolder. The/Eoption recursively copies the subfolders. - On Linux, use the
rsynctool.console$ sudo rsync -avc /mnt/blockstorage/ /mnt/smallblockstorage/ --exclude "lost+found"
On FreeBSD, use the
rsynctool. You may need to install it first. -
console
# pkg install -y rsync # rsync -avc /mnt/blockstorage/ /mnt/smallblockstorage/ --exclude "lost+found"
- On Windows, use the
- Verify the migrated data in your new Vultr Block Storage volume.
- On Windows, compare the source and destination Vultr Block Storage volume and list any files that are different, without actually performing any copy operation.
pwsh
> robocopy E:\ F:\ /L /E
The
/Loption simulates the copy and reports what would be done. In case of a successful data migration, theMismatchfield shows0. - On Linux and FreeBSD, use rsync with
--dry-runoption.console$ sudo rsync -avc --dry-run /mnt/blockstorage/ /mnt/smallblockstorage/ --exclude "lost+found"
If the data migration was successful, the command does not list any individual file names between the header
sending incremental file listand the final summary.
- On Windows, compare the source and destination Vultr Block Storage volume and list any files that are different, without actually performing any copy operation.
- Detach your old Vultr Block Storage volume.
- When satisfied with the new volume, destroy your old Vultr Block Storage volume.
- Terraform
- Shrinking an existing Block Storage volume is not supported. Use Terraform to create a new, smaller volume, attach it, and later remove the original.
terraform
terraform { required_providers { vultr = { source = "vultr/vultr" version = "~> 2.23" } } } provider "vultr" {} # Existing instance resource "vultr_instance" "server" { region = "ewr" plan = "vc2-1c-1gb" os_id = 215 label = "app-server" } # New smaller volume resource "vultr_block" "small_block" { region = "ewr" size_gb = 40 label = "Remote-Block-Storage-Small" block_type = "high_perf" attached_to_instance = vultr_instance.server.id }
After you migrate and verify data, detach and delete the original larger volume by removing its resource from configuration (or targeting destroy), then apply.
How to Shrink Vultr Block Storage Volume A guide explaining how to reduce the size of a Vultr Block Storage volume Vultr doesn’t support direct shrinking of Block Storage volumes. To reduce volume size, create a smaller volume, copy the necessary data from the original, and delete the larger one.…
How to Shrink Vultr Block Storage Volume A guide explaining how to reduce the size of a Vultr Block Storage volume Vultr doesn’t support direct shrinking of Block Storage volumes. To reduce volume size, create a smaller volume, copy the necessary data from the original, and delete the larger one.…