4.3.11. Increasing the size of partitions on a VPS

Attention!

Before proceeding, be sure to create server backup, as well as save copies of all important data from the server on your PC or in FTP archive.
Changing the size of partitions may be necessary in case tariff changes VPS for a tariff with a large amount of available disk space.

Partitions can be resized both with the help of specialized programs with a graphical interface, and with the help of console utilities.

  1. Make sure that you created server backup, as well as backed up copies of all important data from the server to your PC or FTP archive.
  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 over SSH and check the size information:
    df -h

Attention!

Resize2fs only supports ext2-ext4 file systems. If the server uses a different file system, use Gparted or in another way.
  1. Make sure that you created server backup, as well as backed up copies of all important data from the server to your PC or FTP archive.
  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 over SSH and check the size information:
    df -h
Content