4.3.11. Increasing the size of partitions on a VPS

Attention!

Before proceeding, be sure to create backup the server and save copies of all important data from the server to your PC.
Resizing partitions is required when increase VPS tariff. Without this, the additional disk space will appear on the system as unallocated space.

You can change the size of partitions using specialized GUI programs or through console.

  1. Create backup the server and save copies of all important data from the server to your PC.
  2. Connect image System Rescue CD the latest available version — the server will be automatically rebooted.
  3. Connect to the server via VNC.
  4. If the main menu is displayed, select "Boot SystemRescueCd using default options":
  5. Launch the GUI — enter the command startx and press Enter:
  6. Start the GParted application:
  7. Right-click on the section you want to enlarge and select "Resize/Move":
  8. Use the arrows to expand the section to all the available space so that the margins "Free space preceding" and "Free space following" were zeros, and click "Resize/Move":
  9. Click on the button to apply changes and confirm the operation:
  10. Wait for the successful completion of the operation:
  11. Disable mounted image.
  12. After server reboot connect to it via SSH and check the size information:
    df -h

Attention!

The resize2fs program only supports ext2-ext4 file systems. If the server uses a different file system, use Gparted or another way.
  1. Create backup the server and save copies of all important data from the server to your PC.
  2. Connect image System Rescue CD the latest available version — the server will be automatically rebooted.
  3. Connect to the server via VNC.
  4. If the main menu is displayed, select "Boot SystemRescueCd using default options":
  5. Wait for the command line prompt:
  6. Check the current disk layout:
    fdisk -l
  7. Run fdisk interactively:
    fdisk /dev/xvda
  8. In fdisk interactive mode, run the commands:
    1. List the current sections:
      p
    2. Delete the section you want to enlarge (only the markup is removed, the data itself is not affected):
      d
      3

      Instead 3 specify the number of the partition to be deleted. The numbers can be seen in the list of current sections.

    3. Create a new partition instead of the deleted one:
      n
      p
      3

      p — primary section (primary).
      Instead 3 specify the number of the partition to be created (it will be the same as that of the deleted one).
      When prompted for the start and end sectors, just press Enter.
      ⚠️ Answer the request to remove the signature n.

    4. Check out the resulting markup:
      p
    5. Save changes:
      w
  9. Check the file system of the created partition:
    e2fsck -f /dev/xvda3

    Instead 3 specify the number of the created section.

  10. Resize the file system of the created partition:
    resize2fs /dev/xvda3

    Instead 3 specify the number of the created section.

  11. Exit the console:
    exit
  12. Disable mounted image.
  13. After server reboot connect to it via SSH and check the size information:
    df -h
Content