Check present logical volumes
root@abcd:/# lvs LV VG Attr LSize Origin Snap% Move Log Copy% Convert home wgkiste -wi-ao 914.13g root wgkiste -wi-ao 13.42g swap wgkiste -wi-ao 3.72g
root@wgkiste:/# cat /etc/fstab # /etc/fstab: static file system information. proc /proc proc nodev,noexec,nosuid 0 0 /dev/mapper/wgkiste-root / ext4 errors=remount-ro 0 1 /dev/mapper/wgkiste-home /home ext3 defaults 0 2 /dev/mapper/wgkiste-swap none swap sw 0 0
Shrink logical volume „home“
Check out, if we have spare space on home
root@wgkiste:/# df -h Dateisystem Größe Benut Verf Ben%%
Eingehängt auf /dev/mapper/wgkiste-root 14G 11G 2.6G 80% / /dev/mapper/wgkiste-home 914G 668G 187G 79% /home
First, we have to shrink the filesystem („ext3“ in this case). For that, the filesystem must be umounted.
We are checking te current size to determine the new size.
root@wgkiste:/# lvdisplay /dev/mapper/wgkiste-home --- Logical volume --- LV Name /dev/wgkiste/home VG Name wgkiste LV Size 914.13 GiB
We have to switch to textconsole and login as root, not as user and su, because the users home directory is going to be umounted.
Ctrl + Alt + F1
Login as root on command prompt
/etc/init.d/kdm stop
umount /home
e2fsck -f /dev/mapper/wgkiste-homeResize the file sstem to a good deal less than what you will shrink the logical volume to. You don’t want to run in a situation, where your filesystem is begger than the new partition size. If your EXT3 system seems bigger than the partition, your comuter wont reboot anymore, because fsck will hang! I’ve chosen a margin of 50G between the file system size and the logical volume size.
resize2fs /dev/mapper/wgkiste-home 850Glvreduce -L 900G /dev/mapper/wgkiste-homee2fsck /dev/wgkiste/homeAlthough the fsck will take a long while each time, don’t omit this step. If the resize command went wrong, your chances to save the situation are better now than later.
Now, we can extend the file system to the full size of the partition again
resize2fs /dev/wgkiste/homee2fsck /dev/wgkiste/home