Expanding ext3 filesystem after VPS upgrade with no data loss

Discussion in 'Installation/Configuration' started by Arkymedes, Mar 6, 2016.

  1. Arkymedes

    Arkymedes New Member

    Hello all, I'm very sorry for the question but I'm just learning Linux and cannot find my answer. I'll explain better below:
    I currently rent a VPS with OVH (VPS SSD 2016 plans) and their basic plan comes with a 10GB SSD. I remember that back in the day, I upgraded to their middle tier one (20GB space) and although after the migration I did have a bigger disk, my filesystem was still using the old amount, so I had unallocated disk space.

    I then created a ticket with them and they told me that I would need to reinstall my VPS from scratch in order to use the full amount, or pay them 80 EUR for the service. After a lot of back and forth, with me explaining how an upgrade package needs additional fees and technical support, I decided to Google around and then I found a solution that literally was a single line of code, no reboot required, no restart, nothing. Right after that, my filesystem was using the whole disk. I then wrote them that and closed the ticket.

    Today I went ahead and upgraded again, to their next tier since I need more horsepower now and more disk space (40GB this time)
    I did this and went to check my old tickets for this command to run and continue business as usual just to find out that they had recently erased every ticket when they started their new interface!

    So now, I cannot for the life of me, find this command again and expand my filesystem.

    Can someone help me out?

    I'm running Debian 7/ISPConfig 3 from one of the Perfect Server tutorials and everything is fine apart from this small problem.

    The output of df-h showing the used space
    Code:
    root@myserver:~# df -h
    Filesystem      Size  Used Avail Use% Mounted on
    rootfs           20G   17G  2.1G  90% /
    udev             10M     0   10M   0% /dev
    tmpfs           782M  196K  782M   1% /run
    /dev/vda1        20G   17G  2.1G  90% /
    tmpfs           5.0M     0  5.0M   0% /run/lock
    tmpfs           1.6G     0  1.6G   0% /run/shm
    /dev/vda1        20G   17G  2.1G  90% /var/www/clients/web1/log
    /dev/vda1        20G   17G  2.1G  90% /var/www/clients/web2/log
    /dev/vda1        20G   17G  2.1G  90% /var/www/clients/web3/log
    /dev/vda1        20G   17G  2.1G  90% /var/www/clients/web4/log
    /dev/vda1        20G   17G  2.1G  90% /var/www/clients/web5/log
    The output of fdisk -l showing the full disk size (42.9GB)
    Code:
    root@myserver:~# fdisk -l
    
    Disk /dev/vda: 42.9 GB, 42949672960 bytes
    4 heads, 32 sectors/track, 655360 cylinders, total 83886080 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/vda1   *        2048    41943039    20970496   83  Linux
    So in resume, I would like to expand my /dev/vda1 to use the entire available space.

    Thanks so much in advance,
    Arky
     
  2. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    probably
    resize2fs -p /dev/vda1

    but please make a backup before trying :)
     
    Arkymedes likes this.
  3. Arkymedes

    Arkymedes New Member

    Hello! Thanks for your answer, however I get this message:
    Code:
    resize2fs 1.42.5 (29-Jul-2012)
    
    The filesystem is already 5242624 blocks long.  Nothing to do!
    
    Thanks again!
     
  4. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    Stupid me =) resizing the filesystem might be needed after resizing the partition :D
    Sooo... resize the partition like described here
    Yeah it's the Centos docs, but parted is pretty much the same everywhere =)
     
    Arkymedes likes this.
  5. Arkymedes

    Arkymedes New Member

Share This Page