Author Topic: Increase size of centos-root  (Read 73 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Increase size of centos-root
« on: March 10, 2025, 07:48:43 AM »
Hello everyone,
i want to take space from a hdd that i've just added to my server and extend space on /dev/mapper/centos-root.

df -h

Filesystem              Size  Used Avail Use% Mounted on
devtmpfs                16G     0   16G   0% /dev
tmpfs                     16G  480K   16G   1% /dev/shm
tmpfs                     16G   36M   16G   1% /run
tmpfs                     16G     0   16G   0% /sys/fs/cgroup
/dev/mapper/centos-root   50G   40G   11G  79%

/dev/sda1               1014M  325M  690M  32% /boot
/dev/sdc1                550G   73M  522G   1% /mnt/SAS2-600GB
/dev/mapper/centos-home  1.9T  139G  1.8T   8% /home
tmpfs                    3.2G     0  3.2G   0% /run/user/0

So i want to take some space from /dev/sdc1 (550G) and to add it in /dev/mapper/centos-root.


So, as far as i undestand, i should use the following commands:

1. Add /dev/sdc1 to volume group
pvcreate /dev/sdc1
vgextend centos /dev/sdc1

(This will add the space on /dev/sdc1 to the centos volume group)

2. Extend the logical volume /dev/mapper/centos-root:
lvextend -l +100%FREE /dev/centos/root
(this will extend the volume to the available capacity in the volume group (i.e. all available space on /dev/sdc1)

3. Expand the file system:
xfs_growfs /dev/mapper/centos-root
(expand the file system to utilize the added space).


Is that enough?
Those space modification will not affect my production server?
I can make them without loosing data?



Offline
*****
Re: Increase size of centos-root
« Reply #1 on: March 10, 2025, 08:35:46 PM »
Take a full image backup or snapshot before you proceed!

Offline
*
Re: Increase size of centos-root
« Reply #2 on: March 10, 2025, 09:16:28 PM »
What tools do you use for backup image creation? Clonezilla?