Help:Adding Disk Space to Cloud VPS instances

From Wikitech
Jump to navigation Jump to search

Overview

This page explains how to add additional disk space to your Cloud VPS instance.

Cinder: Attachable Block Storage for Cloud VPS

Cloud VPS provides attachable block storage for VMs via the OpenStack Cinder component. A Cinder volume is created separately from a VM; it can then be 'attached' to a VM, formatted, and mounted within that VM's filesystem. A Cinder volume can also be detached and re-attached to a different VM and will persist after any associated VM is deleted.

Volumes can be created, deleted, expanded, and attached via the 'Volumes' tab in Horizon.

Horizon Cinder Screenshot.png

Quick Start

To add storage to a cloud-vps instance under /extrastorage:

  1. Create a volume in the Horizon Volumes interface with the 'Create Volume' button. Set name, size, and description. Leave the other settings as defaults.
  2. Attach that volume to your instance using the 'Manage Attachements' action in Horizon.
  3. On the VM, run sudo wmcs-prepare-cinder-volume.
[email protected]:~$ sudo wmcs-prepare-cinder-volume
This tool will partition, format, and mount a block storage device.


Attached storage devices:

    vda: the primary volume containing /
    vdb: already contains ext4 filesystem
    vdc: 

The only block device device available to mount is vdc.  Selecting.

Where would you like to mount it? </srv> /extrastorage
Ready to prepare and mount vdc on /extrastorage. OK to continue? <Y|n>
Formatting as ext4...
mke2fs 1.44.5 (15-Dec-2018)
Creating filesystem with 1048576 4k blocks and 262144 inodes
Filesystem UUID: 116f7a72-1e26-4ca1-b546-fd7015632900
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done 

Mounting on /extrastorage...
Updating fstab with UUID=116f7a72-1e26-4ca1-b546-fd7015632900 /extrastorage ext4 nofail,x-systemd.device-timeout=2s 0 2
...
Done.

Useful Commands

wmcs-prepare-cinder-volume

The custom wmcs-prepare-cinder-volume script is useful for setting up new Cinder devices. It will format and mount the new volume and add an entry to /etc/fstab so that the volume is re-mounted after a reboot.

This tool is only useful for newly-created block devices. It can not be used to reattach formatted volumes or move volumes between instances.

[email protected]:~$ sudo wmcs-prepare-cinder-volume
This tool will partition, format, and mount a block storage device.


Attached storage devices:

    vda: the primary volume containing /
    vdb: 
    vdd: 
    vde: already contains ext4 filesystem

What device would you like to format and mount? <vdb>

Detecting available volumes

The lsblk tool is useful for locating available devices and volumes and seeing where they're mounted. Typically, your instance's root drive will be vda; other attached volumes will be vd<something>.

[email protected]:~$ lsblk
NAME   MAJ:MIN RM    SIZE RO TYPE MOUNTPOINT
vda    254:0    0     20G  0 disk 
├─vda1 254:1    0 1007.5K  0 part 
├─vda2 254:2    0     19G  0 part /
└─vda3 254:3    0   1023M  0 part 
vdb    254:16   0      1G  0 disk /moreofmydata
vdd    254:48   0      1G  0 disk 
vde    254:64   0      1G  0 disk

Extend a volume

Volumes can be extended using the 'Extend Volume' action in Horizon. This option is only available for volumes that are not currently attached to an instance.

Once the volume has been extended and re-attached to an instance, the filesystem must be resized. Remount on your VM, check the device name (with lsblk), and then resize with resize2fs:

[email protected]:~$ sudo resize2fs /dev/vdc
resize2fs 1.44.5 (15-Dec-2018)
Filesystem at /dev/vdc is mounted on /extrastorage; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/vdc is now 2097152 (4k) blocks long.

Storage Quotas

The default block storage quota for a project is 80Gb. To request additional quota for your project, open a quota request ticket in Phabricator. Most reasonable requests will be granted within 7 days.

With LVM (deprecated as of February, 2021)

Communication and support

Support and administration of the WMCS resources is provided by the Wikimedia Foundation Cloud Services team and Wikimedia movement volunteers. Please reach out with questions and join the conversation:

Discuss and receive general support
Receive mail announcements about critical changes
Subscribe to the [email protected] mailing list (all messages are also mirrored to the [email protected] list)
Track work tasks and report bugs
Use the Phabricator workboard #Cloud-Services for bug reports and feature requests about the Cloud VPS infrastructure itself
Learn about major near-term plans
Read the News wiki page
Read news and stories about Wikimedia Cloud Services
Read the Cloud Services Blog (for the broader Wikimedia movement, see the Wikimedia Technical Blog)