Les Mikesell
2014-Aug-15 16:05 UTC
[CentOS] Centos7 - remove /home and expand / after install?
I did a default install and after installing some other things I realized that a lot of space was allocated to /home as an lvm that is never going to be used. Is it possible to remove the lvm and grow the root (xfs) filesystem without starting over? -- Les Mikesell lesmikesell at gmail.com
Mark Tinberg
2014-Aug-15 16:48 UTC
[CentOS] Centos7 - remove /home and expand / after install?
On Aug 15, 2014, at 11:05 AM, Les Mikesell <lesmikesell at gmail.com> wrote:> I did a default install and after installing some other things I > realized that a lot of space was allocated to /home as an lvm that is > never going to be used. Is it possible to remove the lvm and grow > the root (xfs) filesystem without starting over?That should be very possible For example if you have LVM for your root and home filesystems like the following /dev/Volume00/rootfs /dev/Volume00/home Do a pvscan to see how much space is available in your Volume Group /usr/sbin/pvscan If you have anything on /home you want then you can arrange to move it, tar it up, move it to the side, whatever. You can then: umount /home sed -i -e ?/home/ d? /etc/fstab # remove from fstab /usr/sbin/lvremove /dev/Volume00/home # remove block device, adding space back to volume group You should see the space reclaimed in the volume group /usr/sbin/pvscan At least on ext4 lvextend knows how to run resize2fs for you so you can just /usr/sbin/lvextend ?size +20G ?resizefs /dev/Volume00/rootfs and it will extend the logical volume then extend the filesystem. Otherwise you should be able to lvextend to the size you want then run /usr/sbin/xfs_growfs /dev/Volume00/rootfs I don?t think you have to give it any options, it?ll just grow to fill out the new size of the block device I prefer to set up new devices with filesystems of the minimal viable size and leave the rest of the space in the volume group, then it is easy to extend any particular place with more space by growing an existing filesystem or creating a new one, it is easy to have a separate filesystem for each part of an application (database, spools, logs) so that you can easily manage and monitor usage. ? Mark Tinberg mtinberg at wisc.edu