Loading howto/lvm.md +51 −0 Original line number Diff line number Diff line Loading @@ -156,3 +156,54 @@ should do the following: mount /srv service apache2 start # Shrinking 1. unmount the filesystem: umount /mnt If that's not possible because the filesystem is in use, you'll need to stop processes using it. If that's possible (for example when resizing `/`), you'll need to reboot in a separate operating system first. 2. forcibly check the filesystem: e2fsck -fy /dev/sdX 3. shrink the filesystem: resize2fs /dev/sdX 5G 4. shrink the logical volume, to reduce *to* 5G: lvreduce -L 5G vg/mnt to reduce *by* 5G: lvreduce -L -5G vg/mnt WARNING: make sure the resulting size matches exactly the one specified in the `resize2fs` command above. 5. tell ext to resize the filesystem *again*: resize2fs /dev/sdX NOTE: no size argument here! 6. check the filesystem again: e2fsck -fy /dev/sdX 7. if you want to resize the underlying device (for example, if this is a LVM inside a virtual machine on top of another LVM), you can also shrink the parent logical volume, physical volume, and crypto device (if relevant) at this point. lvreduce -L 5G vg/hostname pvresize /dev/sdY cryptsetup resize DEVICE_LABEL WARNING: this last step has not been tested. Loading
howto/lvm.md +51 −0 Original line number Diff line number Diff line Loading @@ -156,3 +156,54 @@ should do the following: mount /srv service apache2 start # Shrinking 1. unmount the filesystem: umount /mnt If that's not possible because the filesystem is in use, you'll need to stop processes using it. If that's possible (for example when resizing `/`), you'll need to reboot in a separate operating system first. 2. forcibly check the filesystem: e2fsck -fy /dev/sdX 3. shrink the filesystem: resize2fs /dev/sdX 5G 4. shrink the logical volume, to reduce *to* 5G: lvreduce -L 5G vg/mnt to reduce *by* 5G: lvreduce -L -5G vg/mnt WARNING: make sure the resulting size matches exactly the one specified in the `resize2fs` command above. 5. tell ext to resize the filesystem *again*: resize2fs /dev/sdX NOTE: no size argument here! 6. check the filesystem again: e2fsck -fy /dev/sdX 7. if you want to resize the underlying device (for example, if this is a LVM inside a virtual machine on top of another LVM), you can also shrink the parent logical volume, physical volume, and crypto device (if relevant) at this point. lvreduce -L 5G vg/hostname pvresize /dev/sdY cryptsetup resize DEVICE_LABEL WARNING: this last step has not been tested.