1

I have a RHEL 7.9 virtual machine without GUI, and I would like to make updates via the yum update command but it tells me that the disk is full, especially on the /var folder. I thought I'd take 10GB/20GB from the /home partition and transfer it to /var. It's possible ? If so, what steps should I take so as not to damage the machine?

enter image description here

I have seen this post but it seems to me the ideal solution: Change size of /home partition and move /var/www on new partition

1

2 Answers 2

1

You have a RHEL 7 VM. Default filesystem in RHEL 7 is XFS, which doesn't support shrinking so you can't reduce the size of /home. Therefore your only possibility is to ask the sysadmin to add a new virtual disk, or increase the size of the existing virtual disk, and then use the appropriate LVM commands.

So the steps are:

  1. Add a new virtual disk to the machine (let's assume is /dev/sdx)
  2. Initialize the Physical Volume: pvcreate /dev/sdx
  3. Add the Physical Volume to the existing Volume Group: vgextend rootvg /dev/sdx

or

  1. Increase the size of the existing virtual disk (let's assume is /dev/sda)
  2. Notify the kernel of the new disk size: partprobe
  3. Accommodate the Physical Volume to the new size: pvresize /dev/sda

Then,

  1. increase the /var Logical Volume: lvresize -r -l+100%FREE /dev/mapper/rootvg-varlv
1
  • thanks you! I'll try to talk to the system administrator and I will also test these steps. Commented Sep 29, 2022 at 10:28
-2

I thought I'd take 10GB/20GB from the /home partition and transfer it to /var. It's possible ?

No, it is not. First of all, what you have are not partitions. Those are shares on the server which are defined by the server's admin. To change sizes of these volumes you must talk with your sysadmin.

I have seen this post but it seems to me the ideal solution

Yes you can make symbolic links from one mounted volume to another mounted volume, effectively moving folders. And if the application which uses these folders opens them by regular means - it would work.
Unfortunately, it is not always a case and sometimes the application requires a real folder, or at least a hard link (which does not work across volumes).
And anyway, you have to be very careful what are symlinking in the tree. It is very easy to ruin everything.

So I really discourage you to do this task yourself. Talk with system administrator who made the virtual machine for you.

5
  • Hi @WhiteOwl , I will follow your advice, thank you very much! One question: how did you understand that they are not partitions? From /dev/mapper ? Commented Sep 23, 2022 at 13:45
  • 2
    I'm not sure exactly what you mean by calling these shares. These mount points are logical volumes. Each LV does not correspond to a disk partition but the VG containing them is mapped to one of more physical disk partitions. If /dev/mapper/rootvg is not completely allocated then /var can be resized using lvextend. Commented Sep 23, 2022 at 14:04
  • @Kanuc From two points: 1. You said, you are using virtual machine. 2. There are both /dev/sda1 and /dev/mapper in your list of mounts, and their combination.<br> The easiest and most logical way to make a VM on organization level is to create a sharable drive a Commented Sep 23, 2022 at 16:03
  • ... create a sharable drive (/opt or /usr/bin are good examples), and share that drive as logical volume to all individual users. MUCH easier to maintain and backup/restore if necessary. As a side effect - user can login remotely to the exact same VM as he does in office. Again - much easier to maintain. Logical drive over local physical - possible, but too much hustle for the admin and not much advantage for user - so it could be done, but... Commented Sep 23, 2022 at 16:11
  • @WhiteOwl , thank you very much! I'll try to talk to the system administrator of this virtual machine. Commented Sep 29, 2022 at 10:26

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.