How to resize /var space on virtual disk (proxmox)

Hi all, i’ve ereditated an UCS@school server with UCS 4.4.8 and i’ve to upgrade to lastest version to migrate configuration nto another UCS instance on different Hypervisor (VMware) (it’s the fisrt step to dismit an old hardware). The problem is that my /var directory haven’t enough free space.
here the situation:

lsblk
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0    42G  0 disk 
├─sda1            8:1    0    16G  0 part /
├─sda2            8:2    0     1K  0 part 
├─sda5            8:5    0   4,8G  0 part [SWAP]
└─sda6            8:6    0  11,3G  0 part 
sr0              11:0    1   1,3G  0 rom  
vda             254:0    0   100G  0 disk 
vdb             254:16   0   256G  0 disk 
└─vdb1          254:17   0   256G  0 part 
  └─dataold-opt 253:1    0 243,2G  0 lvm  
vdc             254:32   0   2,5T  0 disk 
└─vdc1          254:33   0   2,5T  0 part 
  └─data-home   253:0    0   2,3T  0 lvm  /home
vdd             254:48   0    42G  0 disk 
└─vdd1          254:49   0    32G  0 part /var

File system            Dim. Usati Dispon. Uso% Montato su
udev                    10M     0     10M   0% /dev
tmpfs                  3,2G   18M    3,2G   1% /run
/dev/sda1               16G  5,3G    9,3G  37% /
tmpfs                  7,9G   28K    7,9G   1% /dev/shm
tmpfs                  5,0M     0    5,0M   0% /run/lock
tmpfs                  7,9G     0    7,9G   0% /sys/fs/cgroup
/dev/vdd1               32G   30G    2,7G  92% /var
/dev/mapper/data-home  2,3T  1,4T    880G  62% /home

i’ve added 10G on /dev/vdd virtual disk but now i’ve to resize partition on server without data loss… but i don’t know how to do it
Please help

This works with parted

Short:

unit s
print free
resizepart 2 125829119s
resizepart 5 125829119s
print free
quit

Section- and Partitionnumber have to be changed.

Details under https://linux.die.net/man/8/parted

If /dev/vdd1 is the last partition on /dev/vdd you could do something like this:

sudo apt install cloud-guest-utils
sudo growpart /dev/vdd 1
sudo resize2fs /dev/vdd1

These steps can be performed online (ie. not shutting down the server), a subsequent restart is not required.

That’s how I do and did increase storage size of our UCS servers hosted on our Proxmox servers.

1 Like

thanks so much,
i tried the procedure and this is results:

root@srv030:/# growpart /dev/vdd 1
CHANGED: partition=1 start=2048 old: size=67106783 end=67108831 new: size=88078303,end=88080351
root@srv030:/# resize2fs /dev/vdd1
resize2fs 1.43.4 (31-Jan-2017)
resize2fs: Valore magic non corretto nel super-blocco nell'aprire /dev/vdd1
Impossibile trovare un valido super-blocco per il file system.
root@srv030:/# df -h
File system                          Dim. Usati Dispon. Uso% Montato su
udev                                  10M     0     10M   0% /dev
tmpfs                                3,2G   17M    3,2G   1% /run
/dev/sda1                             16G  5,3G    9,3G  37% /
tmpfs                                7,9G   28K    7,9G   1% /dev/shm
tmpfs                                5,0M     0    5,0M   0% /run/lock
tmpfs                                7,9G     0    7,9G   0% /sys/fs/cgroup
/dev/mapper/data-home                2,3T  1,4T    880G  62% /home
/dev/vdd1                             32G   30G    2,6G  92% /var
scp@10.137.175.120:/share/BKP_dati/   14T  9,7T    3,6T  73% /home/BKP1
root@srv030:/# lsblk
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0    42G  0 disk
├─sda1            8:1    0    16G  0 part /
├─sda2            8:2    0     1K  0 part
├─sda5            8:5    0   4,8G  0 part [SWAP]
└─sda6            8:6    0  11,3G  0 part
sr0              11:0    1   1,3G  0 rom  
vda             254:0    0   100G  0 disk
vdb             254:16   0   256G  0 disk
└─vdb1          254:17   0   256G  0 part
  └─dataold-opt 253:1    0 243,2G  0 lvm  
vdc             254:32   0   2,5T  0 disk
└─vdc1          254:33   0   2,5T  0 part
  └─data-home   253:0    0   2,3T  0 lvm  /home
vdd             254:48   0    42G  0 disk
└─vdd1          254:49   0    42G  0 part /var

seems that’s partially worked but the free space on /var doesn’t change… may i’ve to reboot the server?

Please post the output from these commands:

LANG=C.UTF-8 fdisk -l /dev/vdd
LANG=C.UTF-8 df -h /var

(LANG=C.UTF-8) forces this output only to be in English, makes it easier to help :slight_smile:

From your output it looks like the superblock for /dev/vdd1 went missing. With ext4 as filesystem this should not be that much of a problem since ext4 stores multiple copies of the superblock.

Mastodon