Ridimensionare Partizioni in uso (esempio home o swap)
Updated at: 29/05/2021


qui c'è una guida per aggiungere da zero una parzione swap su lvm



lvcreate -L 10G -n lv_swap vg_system
mkswap /dev/vg_system/lv_swap
swapon -v /dev/vg_system/lv_swap

quindi editare il file /etc/fstab aggiungendo

/dev/vg_system/lv_swap swap swap defaults 0 0

per controllare lo spazio disponibile per swap

free -h


Disable swapping for the associated logical volume:

# swapoff -v /dev/vg_system/lv_swap
Resize the LVM2 logical volume by 256 MB:

# lvresize --size +256M /dev/vg_system/lv_swap
Format the new swap space: # mkswap /dev/vg_system/lv_swap
Enable the extended logical volume: # swapon -va Test that the logical volume has been extended properly: # cat /proc/swaps # free



umount /home

System may refuse to unmount /home if you have users logged on to the box or services running from /home. After logging off / stopping services command should succeed.

2. Shrink old /home partition to 20GB, (system will force you to check filesystem for errors by running e2fsck)

e2fsck -f /dev/mapper/vg_system-lv_home

resize2fs /dev/mapper/vg_test-lv_home 20G

3. Reduce the LVM to 20G

lvresize --size 20G /dev/mapper/vg_system-lv_home
5. Grow /root (ext3/4) partition to new LVM size resize2fs /dev/mapper/vg_system-lv_home
6. Mount /home mount /home