0

i have made by mistake a small partition partion on my Debian installation and after installing openvz on this bare metal server i notice that i created production vps on this partion and that it reached 100%

this is df -h result :

Sys. fich.        Taille Util. Dispo Uti% Monté sur
udev                 10M     0   10M   0% /dev
tmpfs               3,2G  352K  3,2G   1% /run
/dev/md2             20G   18G  179M 100% /
tmpfs               5,0M     0  5,0M   0% /run/lock
tmpfs               6,5G     0  6,5G   0% /dev/shm
/dev/md3            1,8T  4,3G  1,7T   1% /home
/dev/ploop22956p1    25G  4,5G   20G  19% /var/lib/vz/root/1
/dev/ploop30467p1    25G  3,7G   20G  16% /var/lib/vz/root/2
/dev/ploop61065p1    25G  1,7G   22G   8% /var/lib/vz/root/4
/dev/ploop44786p1    25G  1,5G   22G   7% /var/lib/vz/root/5
/dev/ploop27624p1    25G  2,3G   22G  10% /var/lib/vz/root/3
/dev/ploop45115p1    25G  639M   23G   3% /var/lib/vz/root/6

i know that gnu parted can do this with resize command but i have never used it and i don't want to risk it is there anyway to do it without losing data ?

Taha
  • 3
  • 1
  • 3

2 Answers2

1

Yes you can, but just don't rely on it (i.e. back up your data first!).

The partitions should be adjacent, and for ease's sake you want to be expanding into a partition that comes AFTER the one you want to expand.

Then just use parted on the device, delete both partitions (e.g. sdb1, sdb2), create a new one that spans the entire space, and use resize2fs to grow the filesystem so that it's using all the available space.

I did this recently with some home data - I would NOT suggest doing it with your only copy of the important data.

0

You can do it, but be careful.

Use resize2fs to resize the partition, then you can adjust the partition to match using cfdisk. It's always easier to grow a partition than it is to shrink it, if you don't specify the final size then resize2fs will grow to fit.

Ed Neville
  • 193
  • 4