Note: There is a video available for this article.
If you run out of space on a partition you have to clean up or you can add more space, like an additional harddisk, additional volume in a virtual environment or resize the virtual image.
In all cases the new disk needs to be integrated.
- You can partition the new disk and mount it to a new folder
This is not described here! - You can resize the logical volume (LV). LV is part of the UCS partitioning by default.
How to do this is now described in this article
First you can get an overview of the physical volume (PV), the volume groups (VG) and logical volumes (LV) of the installation.
root@master:~# pvs
PV VG Fmt Attr PSize PFree
/dev/sda5 vg_ucs lvm2 a-- 9,52g 0·
root@master:~# vgs
VG #PV #LV #SN Attr VSize VFree
vg_ucs 1 2 0 wz--n- 9,52g 0·
root@master:~# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root vg_ucs -wi-ao---- 9,10g
swap_1 vg_ucs -wi-ao---- 432,00m
Now, if you have already add a new disk, you can find it via
root@master:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb 8:16 0 5G 0 disk
sr0 11:0 1 1024M 0 rom
sda 8:0 0 10G 0 disk
├─sda2 8:2 0 1K 0 part
├─sda5 8:5 0 9,5G 0 part
│ ├─vg_ucs-swap_1 254:1 0 432M 0 lvm [SWAP]
│ └─vg_ucs-root 254:0 0 9,1G 0 lvm /
└─sda1 8:1 0 487M 0 part /boot
The disk has already to be partitioned. You can use cfdisk
if you like
root@master:~# cfdisk /dev/sdb
First you get a short selection menu:
Select label type
│ gpt
│ dos
│ sgi
│ sun
Please choose gpt and then make a new partition with your desired size. Close cfdisk
writting the changes to disk first and then quit.
After that you want to create a new physikal volume on the new partition.
root@master:~# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created
root@master:~# pvs
PV VG Fmt Attr PSize PFree
/dev/sda5 vg_ucs lvm2 a-- 9,52g 0·
/dev/sdb1 lvm2 --- 5,00g 5,00g
To increase at least the LV “root” the VG has to be increased first.
root@master:~# vgextend vg_ucs /dev/sdb1
Volume group "vg_ucs" successfully extended
root@master:~# vgs
VG #PV #LV #SN Attr VSize VFree
vg_ucs 2 2 0 wz--n- 14,52g 5,00g
Finally, in this case, the LV “root” can be resized. You can expand “root” with the whole new space like this:
root@master:~# lvextend -l +100%FREE /dev/mapper/vg_ucs-root
Size of logical volume vg_ucs/root changed from 9,10 GiB (2329 extents) to 14,09 GiB (3608 extents).
Logical volume root successfully resized
To update the changes
root@master:~# resize2fs -p /dev/mapper/vg_ucs-root
resize2fs 1.42.12 (29-Aug-2014)
Filesystem at /dev/mapper/vg_ucs-root is mounted on / ;on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/mapper/vg_ucs-root is now 3694592 (4k) blocks long.
root@master:~# df -h
Dateisystem Größe Benutzt Verf. Verw% Eingehängt auf
udev 10M 0 10M 0% /dev
tmpfs 401M 13M 389M 4% /run
/dev/dm-0 14G 2,2G 11G 17% /
tmpfs 1003M 0 1003M 0% /dev/shm
tmpfs 5,0M 0 5,0M 0% /run/lock
tmpfs 1003M 0 1003M 0% /sys/fs/cgroup
/dev/sda1 472M 97M 351M 22% /boot