DevOps by Default Blog

Manually extending hard disk space (on SkyScape/UKCloud)

Perhaps an instance is running low on disk space and you’d like to extend it? Unfortunately on Skyscape there doesn’t seem to be a way to do this via terraform at present, but it can be achieved manually by:

Skyscape Portal

  1. Login to the SkyScape’s portal
  2. Locate the vApp in question, then locate the VM contained within it. Right click and select ‘properties’
  3. Under the hardware tab, click ‘+’ under the exsiting hard drive and add another on the next bus.
  4. Type the size required for the new disk, eg. 146G
  5. Click OK and wait until the changes have been applied.
  6. Next we need to ssh to the instance and do a few LVM commands. Here’s a sample session to give you a hint, but you may need to adjust to suit:
# ssh to the server
ssh centos@${my-instance-with-a-new-disk}

# check the free space
df -h

# elevate your shell
sudo -i

# force a scan for the new disk, note this one is on the 2nd disk channel
echo "- - -" >/sys/class/scsi_host/host1/scan

# you should create an LVM partition although you don't have to
echo -e "n\np\n1\n\n\nt\n8e\nw\n" | fdisk /dev/sdb

# enable the new partition for LVM usage
pvcreate /dev/sdb1

# add the new PV to the default VG, note in this case this is the 2nd disk
vgextend centos /dev/sdb1

# extend the root LV to 90% of free space, or you could try -L +20G or similar
lvextend -l90%free /dev/mapper/centos-root

# as we are using an xfs filesystem, use xfs_growfs to extend the filesystem to match the new LV size
xfs_growfs /

# all done, check the free space
df -h

Hopefully you’ve got more space now. :)


Comments