Virtual server products — 20% discount for the first month! Coupon code: Dedicated server products — ₺500 discount for the first month! Coupon code: Virtual server products — 20% discount for the first month! Coupon code: Dedicated server products — ₺500 discount for the first month! Coupon code: Virtual server products — 20% discount for the first month! Coupon code: Dedicated server products — ₺500 discount for the first month! Coupon code: Virtual server products — 20% discount for the first month! Coupon code: Dedicated server products — ₺500 discount for the first month! Coupon code: Virtual server products — 20% discount for the first month! Coupon code: Dedicated server products — ₺500 discount for the first month! Coupon code: Virtual server products — 20% discount for the first month! Coupon code: Dedicated server products — ₺500 discount for the first month! Coupon code: Virtual server products — 20% discount for the first month! Coupon code: Dedicated server products — ₺500 discount for the first month! Coupon code: Virtual server products — 20% discount for the first month! Coupon code: Dedicated server products — ₺500 discount for the first month! Coupon code: Virtual server products — 20% discount for the first month! Coupon code: Dedicated server products — ₺500 discount for the first month! Coupon code: Virtual server products — 20% discount for the first month! Coupon code: Dedicated server products — ₺500 discount for the first month! Coupon code:
Ubuntu Disk Expansion Guide
Blog
Linux

Ubuntu Disk Expansion Guide

March 15, 2024
Adahost Team

Ubuntu Disk Expansion Guide

When your Ubuntu server runs out of disk space, it's possible to expand the disk without reinstalling the system. In this guide, we'll explain step by step how to expand disk space using both LVM (Logical Volume Manager) and standard partitioning methods.

Preparation

Before starting the disk expansion process, make sure to:

  • **Backup**: Back up all your important data
  • **Create snapshot**: If you're using a virtual server, take a snapshot
  • **Check system status**: Make sure the system is stable
  • Checking Current Disk Status

    First, let's check the current disk status:

    df -h

    lsblk

    These commands will show you your disk partitions and usage rates.

    Disk Expansion Using LVM

    If you're using LVM, the process is quite simple:

    1. Expanding Physical Disk

    First, expand the disk from VMware, Hyper-V, or your cloud provider. Then:

    Scan disk changes

    sudo pvresize /dev/sda3

    2. Expanding Logical Volume

    Check available space

    sudo vgdisplay

    Expand volume

    sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv

    Expand filesystem

    sudo resize2fs /dev/ubuntu-vg/ubuntu-lv

    3. Check Result

    df -h

    Disk Expansion with Standard Partitioning

    If you're not using LVM:

    1. Expanding Partition

    Expand partition using GParted or parted

    sudo parted /dev/sda

    (parted) print

    (parted) resizepart 1 100%

    (parted) quit

    2. Expanding Filesystem

    For ext4

    sudo resize2fs /dev/sda1

    For xfs

    sudo xfs_growfs /

    Common Issues

    Disk Not Showing

    If the expanded disk isn't visible:

    Refresh partition table

    sudo partprobe /dev/sda

    LVM Error

    If you get an LVM error:

    Clear LVM cache

    sudo pvscan

    sudo vgscan

    sudo lvscan

    Security Tips

  • Always backup
  • Create snapshots before changes
  • Enter commands carefully
  • Test in test environment before production
  • Conclusion

    Ubuntu disk expansion is safe and fast when done correctly. If you're using LVM, the process will be much easier. If you encounter any issues, make sure you have backups and seek professional help if needed.

    At Adahost, we offer easy disk expansion on all our servers. You can increase your disk size with a single click from your customer panel and expand your system by following the steps above.