0

when installing Linux from iso (Redhat-8 for example) you have the option of doing the LVM partition scheme instead of the standard hard partitions. When LVM partitions are made as described below, how do you manipulate their sizes after Linux installation ?

# note - hostname is abc

Filesystem                             Size  Used Avail Use% Mounted on
------------------------------------------------------------------------
/dev/mapper/rhel_abc-root              3.5T   58G  3.5T   2% /
tmpfs                                   10G     0   10G   0% /tmp
/dev/sda1                               95M  5.8M   90M   7% /boot/efi
/dev/sda2                              935M  315M  621M  34% /boot
/dev/mapper/rhel_abc-home              9.3G  100M  9.2G   2% /home
/dev/mapper/rhel_abc-var               9.3G  1.2G  8.2G  13% /var
/dev/mapper/rhel_abc-var_tmp           1.9G   46M  1.9G   3% /var/tmp
/dev/mapper/rhel_abc-var_log           4.7G  275M  4.4G   6% /var/log
/dev/mapper/rhel_abc-var_log_audit     4.7G   75M  4.6G   2% /var/log/audit

I made /var 10GB in size during installation, if that partition becomes full for example then how do you manipulate all this in order to take space away from some other(s) and add increase the size of others? Is there a GUI available to easily manipulate this?

specifically in the event if/when I need to what is the fastest way to simply take 10GB away from rhel_abc-root and add it to rhel_abc-var ? Can this be done on a running system without unmounting and a reboot?

2 Answers 2

1

Some filesystems can be both extended and shrunk non-destructively; unfortunately RHEL 8's default filesystem type is XFS, which can be extended even while in use just fine, but cannot be currently shrunk non-destructively at all.

(The xfs.org website seems to be having certificate and/or other issues at this time, but here's the latest archive.org snapshot of the relevant subpage from year 2022.)

In other words, the fact that most of your disk space is already allocated to your root filesystem on the rhel_abc-root logical volume is the only problem here, but assuming you're using XFS filesystems, it is a showstopper.

When using LVM with XFS filesystems, it is generally useful to try and keep filesystems on the small side, and hold some unallocated space in reserve at the LVM volume group level: you could then easily extend any logical volume with a single command. For example, to add another 10GB to /var would be:

lvextend -r -L +10G /dev/mapper/rhel_abc-var

The -r option tells lvextend to handle extending the filesystem too, and -L specifies the new size... or if prefixed with a plus sign, the amount to add to the current size.

0

Without reboot? Sure. Without unmounting the partitions? Can be tricky. (see How to shrink root filesystem without booting a livecd)

The idea is this. To reduce one partition by 10GB:

lvreduce --size -10G --resizefs volgroup/logical_volume

To extend another partition:

lvextend --size +10GB --resizefs volgrou/logical_volume

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.