RL9.3 how to move /home

So I’ve used CentOS for years, and have been converting CentOS installs (all 7) into RL releases (couple 8’s and now a 9).

This homelab server runs CubeCoder’s AMP, a game management engine which I use so my kids can easily via web start/stop/modify, change, create etc (you get the idea) and while the rest of this application reside in normal folders, the actual server instances (IE world files for Minecraft) sit in the /home/amp folder…

When I spun up RL9.3, as I generally always do (this is on ESXi), I usually pick the default options meaning whatever file structure RL wants (in this case) is what I roll with.

As you’ve guessed, google searches have revealed that at least with RL9, things have changed, and of my 150GB drive alotted (the CentOS install only had 100), I can’t even copy one server from old to new because as it turns out, /home is out of space!

I’m dangerously knowledgeable with Linux and not sure how to fix this. Any advice would be greatly appreciated. Would prefer to fix what I already have set up, already got all the tools and commands I’m used to installed and all that, but if absolutely the easiest best thing to do it wipe it and go again, so be it, just let me know what I should do to get the similar partition/folder sizes that I’m used to. For reference, I think the 2 MC server are like 15gb and 24gb, give or take…

Thanks in advance,

MTXRooster

More info, it structured me like this:

[root@amphost~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 4.0M 0 4.0M 0% /dev
tmpfs 7.7G 0 7.7G 0% /dev/shm
tmpfs 3.1G 8.8M 3.1G 1% /run
/dev/mapper/rl-root 66G 2.6G 63G 4% /
/dev/sda1 960M 221M 740M 23% /boot
/dev/mapper/rl-home 32G 30G 2.8G 92% /home
tmpfs 1.6G 4.0K 1.6G 1% /run/user/1000

Can this not be done? Is this a reinstall the OS kind of situation? (And if so, clearly I don’t want the automated volume creation, what are the recommendations for having a classic style structure similar to older CentOS’s accommodating a larger /home?

Thanks in advance!

No doubt the file systems are XFS. Since /dev/mapper/rl-root has like 63GB free, you would want to allocate this to rl-home. The problem is, XFS filesystem cannot be shrunk. If the filesystem was ext4, then it could be shrunk. Although it’s also not all that easy to do, and does require calculating additional space like 3-5% between filesystem data and partition end when shrinking depending on how close you want to get to the used space when shrinking.

So I would expect you will have to reinstall it, and not use the automated partitioning and rather customise it yourself during install. I never use what is recommended, and set up my own partitions sizes when installing Rocky. You choose the appropriate option when partitioning instead of the automated/recommended partitions.

It looks like your system is using LVM. Sounds to me like you want to eliminate the separate lvm volume for /home and just have a single volume for Everything.

This is possible, but it is not without risk. I can give you a general outline, but it would be best to get a better understanding of LVM before proceeding. And as always; have good backups before proceeding.

Begin by stopping all the services that could be accessing any data in /home. Then un-mount /home and mount that volume elsewhere.
something like:

umount /home
mkdir /mnt/oldhome
mount /dev/mapper/rl-home /mnt/oldhome

Now if you go to /home, it should be empty and if you go to /mnt/oldhome you should see your files there instead.

Next, you will need to copy your stuff from /mnt/oldhome to /home
Because the rl-home LVM Volume is not mounted on /home any more, the empty /home that you see now is actually on the rl-root LVM Volume.
I prefer rsync, but you can use whatever tool you choose to copy the files.

rsync -a /mnt/oldhome/ /home/

Once that is done, you should have an exact copy of your date from the rl-home volume in the /home directory under the rl-root volume.

Once you are absolutely certain that everything was copied you are ready to proceed.

You will need to Remove the rl-home volume, and then allocate that space to the rl-root volume.
Something like this:

umount /mnt/oldhome
lvremove /dev/mapper/rl-home
lvextend -l +100%FREE /dev/mapper/rl-root

Now the disk capacity that was previously used by the rl-home volume should be assigned to the rl-root volume. However, the Volume is separate from the Filesystem, so now you need to expand the filesystem.

You will need to know which filesystem is being used.

mount | grep rl-root

You should see something like type xfs or type ext4. If it’s type is something else, please send the output of that command.

If it’s xfs:

xfs_growfs /dev/mapper/rl-root

If it’s ext4 (unlikely):

resize2fs /dev/mapper/rl-root

Now your df -h should show the Size of your / mount closer to 98G instead of 66G.

I have to say it again; Take Backups! And it’s entirely possible that I may have made mistakes. Make sure you understand what each command is doing and check my work before you run it.

2 Likes

One more thing I should mention; If you log in as a normal user, and then su to root, you won’t be able to unmount /home. You will either need to access the server console and log in directly as root, or modify your SSH Config to allow root to connect via SSH.

1 Like

The lvextend does have also option --resizefs. See man lvextend
With that one does not have to expand the filesystem separately.

Thank you all for your information; after a brief trip out for some errands, I will be giving this another shot :slight_smile: (the resize first, good learning experience, and if I fail at it horribly, the manual method, which, tbh, I think I might try for just a test box to get a better feel of doing it that way down the road, as I do have a few more boxes to migrate.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.