{% extends "dashboard/base.html" %} {% load staticfiles %} {% load i18n %} {% block title-page %}{% trans "Resize how-to" %}{% endblock %} {% block content %}

{% blocktrans %} If you don't have enogh space on your virtual machine you can ask for more. After a request has been made an administrator can extend your HDD. If the request is granted you have to manually rescan and extend a logical volume on your machine to acquire the extra space. To do so you need root access/administrator rights. {% endblocktrans %}

  1. {% trans "Ask the administrator for more space. After it has been granted do the following steps." %}
  2. {% blocktrans %} You can check how much free space is left on your machine (on Debian based distributions like Ubuntu) with the df -h command. As you can see below we need more space on / so we will extend /dev/mapper/cloud–x–vg-root. {% endblocktrans %}
    Filesystem Size Used Avail Use% Mounted on
    /dev/mapper/cloud–x–vg-root 39G 37G 65M 100% /
    none 4.0K 0 4.0K 0% /sys/fs/cgroup
    udev 487M 4.0K 487M 1% /dev
    tmpfs 100M 368K 100M 1% /run
    none 5.0M 0 5.0M 0% /run/lock
    none 498M 0 498M 0% /run/shm
    none 100M 0 100M 0% /run/user
    /dev/vda1 236M 37M 187M 17% /boot
  3. {% blocktrans %} List logical volumes and find the VG Name (volume group name) of /dev/mapper/cloud–x–vg-root: lvdisplay

    {% endblocktrans %}
      — Logical volume —
      LV Path                /dev/cloud-x-vg/root
      LV Name                root
      VG Name                cloud-x-vg
      LV UUID                xlGizo-eVyj-aqRn-Us7d-BRzj-dsKW-U6kp0F
      LV Write Access        read/write
      LV Creation host, time cloud-x, 2014-07-31 13:17:53 +0200
      LV Status              available
      # open                 1
      LV Size                38.76 GiB
      Current LE             9923
      Segments               2
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           252:0
  4. {% blocktrans %} List physical volumes to get the PV Name (partition name) of the cloud-x-vg volume group: pvdisplay {% endblocktrans %}
      — Physical volume —
      PV Name               /dev/vda5
      VG Name               cloud-x-vg
      PV Size               39.76 GiB / not usable 2.00 MiB
      Allocatable           yes (but full)
      PE Size               4.00 MiB
      Total PE              10178
      Free PE               0
      Allocated PE          10178
      PV UUID               JDp5TP-PHjT-Cgwk-MN4h-iAnk-9dfT-lYoldd
  5. {% blocktrans %} List the partitions with fdisk: fdisk /dev/vda and press p. This will show something similar: {% endblocktrans %}
    Device Boot Start End Blocks Id System
    /dev/vda1 * 2048 499711 248832 83 Linux
    /dev/vda2 501758 83884031 41691137 5 Extended
    /dev/vda5 501760 83884031 41691136 8e Linux LVM

    {% blocktrans %} As you can see, the /dev/vda5 is in the /dev/vda2 Extended partition. To resize it we have to recreate the Extended partition. {% endblocktrans %}

  6. {% trans "Delete the Extended partition:" %}

    {% blocktrans %} Press d and the number of the partition. In the example above the extended partition name is vda2 so press 2. {% endblocktrans %}

  7. {% trans "Create extended partition:" %}

    {% blocktrans %} Press n to create new partition. Type e to choose extended type. Set partition number - the same as you deleted above: 2. You can use the default starting and ending sector. {% endblocktrans %}

  8. {% trans "Create logical partition:" %}

    {% blocktrans %} Press n to create new partition. If not selected automatically, type l to choose logical type, and set partition number - the same as the Linux LVM (vda5) has above: 5. You can use the default starting and ending sector. Do NOT remove the LVM2_member signature. {% endblocktrans %}

  9. {% trans "Change the logical partition’s type:" %}

    {% blocktrans %} Press t to change type. Set the logical partition’s number: 5 (vda5). Type 8e to choose Linux LVM type. (to show the full list, press L). {% endblocktrans %}

  10. {% trans "Save and exit: Press w." %}

    {% trans "If you list the partitions again, you will see the difference:" %}

    Device Boot Start End Blocks Id System
    /dev/vda1 * 2048 499711 248832 83 Linux
    /dev/vda2 499712 89338673 44419481 5 Extended
    /dev/vda5 501760 89338673 44418457 8e Linux LVM
  11. {% trans "Reread partition table:" %} partprobe -s /dev/vda

      /dev/vda: msdos partitions 1 2 <5>
  12. {% trans "Resize logical partition:" %} pvresize /dev/vda5

      Physical volume “/dev/vda5” changed
      1 physical volume(s) resized / 0 physical volume(s) not resized
  13. {% trans "Check Free PE / Size:" %} vgdisplay

      ...
      Free  PE / Size           666 / 2.60 GiB
      ...
  14. {% trans "Extend LVM:" %} lvextend -L+2.6G /dev/mapper/cloud--x--vg-root

      Rounding size to boundary between physical extents: 2.60 GiB
      Extending logical volume root to 41.36 GiB
      Logical volume root successfully resized
  15. {% trans "Finally, resize filesystem:" %} resize2fs /dev/mapper/cloud--x--vg-root

      resize2fs 1.42.9 (4-Feb-2014)
      Filesystem at /dev/mapper/cloud–x–vg-root is mounted on /; on-line resizing required
      old_desc_blocks = 3, new_desc_blocks = 3
      The filesystem on /dev/mapper/cloud–x–vg-root is now 10843136 blocks long.

{% blocktrans %} The df -h will show now some free space on your /: {% endblocktrans %}

Filesystem Size Used Avail Use% Mounted on
/dev/mapper/cloud–x–vg-root 41G 37G 2.6G 94% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 487M 4.0K 487M 1% /dev
tmpfs 100M 368K 100M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 498M 0 498M 0% /run/shm
none 100M 0 100M 0% /run/user
/dev/vda1 236M 37M 187M 17% /boot

{% trans "Expanding disk on Windows 7" %}

{% blocktrans %} If we don’t have enogh space on our virtual machine, we can ask more. After the request, the administrator will extend your HDD, but you have to rescan and extend it manually on your machine. {% endblocktrans %}

  1. {% trans "Ask the administrator for more space. After they had given more, do the following steps." %} Sometimes we don't have enough space
  2. {% blocktrans %} Click on the Start menu, and type: disk management. Click the Create and format hard disk partitions {% endblocktrans %} {% trans
  3. {% trans "Currently you can’t see the extended size." %} {% trans
  4. {% blocktrans %} To update the disk information, click Rescan Disks on the Action menu. {% endblocktrans %} {% trans
  5. {% trans "After scanning Unallocated space appeared." %} {% trans
  6. {% trans "To extend the C drive, right click on it, and select Extend Volume." %} {% trans
    {% trans "You can also create a new partition from the unallocated space." %}
  7. {% blocktrans %} In the wizard you can change, how much space will you using from the unallocated space. The default is to use all, so press Next,Next,Finish. {% endblocktrans %} {% trans {% trans {% trans
  8. {% trans "Your partition is now bigger." %} {% trans {% trans
{% endblock %}