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


Swap

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

https://www.thegeekdiary.com/centos-rhel-how-to-create-new-lvm-based-swap-partition/

fondamentalmente:


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
(oppure)
free -h



https://www.centos.org/docs/5/html/5.1/Deployment_Guide/s2-swap-extending-lvm2.html



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


Home

https://www.owned-networks.net/client_area/knowledgebase/45/How-to-resize-LVM-partitions--shrink-home-or-extend-root.html




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