Increase /dev/mapper/centos-home by reducing centos-root

Issues related to applications and software problems
Post Reply
anchearv
Posts: 2
Joined: 2019/10/03 17:01:33

Increase /dev/mapper/centos-home by reducing centos-root

Post by anchearv » 2019/10/03 17:11:18

Hi,
My disk allocation looks like below. I am using the virtual Box and then booting CentOS.
My question is how can i move not utilised disk space from centos-root (/) Say 30GB to centos-home (/home) increase from 20GB to 50GB ?
I am doing most of the work in /home so need more disk space here instead of the root.

Code: Select all

lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0 77.7G  0 disk 
├─sda1            8:1    0    1G  0 part /boot
└─sda2            8:2    0   63G  0 part 
  ├─centos-root 253:0    0   41G  0 lvm  /
  ├─centos-swap 253:1    0    2G  0 lvm  [SWAP]
  └─centos-home 253:2    0   20G  0 lvm  /home
sr0              11:0    1 73.6M  0 rom  /run/media/aanche/VBox_GAs_6.0.10
[aanche@localhost /]$ df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   41G  6.3G   35G  16% /
devtmpfs                 1.9G     0  1.9G   0% /dev
tmpfs                    1.9G     0  1.9G   0% /dev/shm
tmpfs                    1.9G  9.5M  1.9G   1% /run
tmpfs                    1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/mapper/centos-home   20G   20G  423M  98% /home
/dev/sda1               1014M  232M  783M  23% /boot
Share                    233G  120G  114G  52% /home/aanche/MAC_Work
tmpfs                    379M   32K  379M   1% /run/user/1000
/dev/sr0                  74M   74M     0 100% /run/media/aanche/VBox_GAs_6.0.10

User avatar
TrevorH
Site Admin
Posts: 33191
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Increase /dev/mapper/centos-home by reducing centos-root

Post by TrevorH » 2019/10/03 17:56:16

If your current filesystem uses the default 'xfs' then you cannot shrink it.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

anchearv
Posts: 2
Joined: 2019/10/03 17:01:33

Re: Increase /dev/mapper/centos-home by reducing centos-root

Post by anchearv » 2019/10/04 07:03:57

My file system is xfs. So is there a way around this?

Code: Select all

df -Th
Filesystem              Type      Size  Used Avail Use% Mounted on
/dev/mapper/centos-root xfs        41G  6.2G   35G  16% /
devtmpfs                devtmpfs  1.9G     0  1.9G   0% /dev
tmpfs                   tmpfs     1.9G   60K  1.9G   1% /dev/shm
tmpfs                   tmpfs     1.9G  9.5M  1.9G   1% /run
tmpfs                   tmpfs     1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/sda1               xfs      1014M  232M  783M  23% /boot
/dev/mapper/centos-home xfs        54G   30G   24G  56% /home
Share                   vboxsf    233G  137G   97G  59% /home/aanche/MAC_Work
tmpfs                   tmpfs     379M   28K  379M   1% /run/user/1000
/dev/sr0                iso9660    74M   74M     0 100% /run/media/aanche/VBox_GAs_6.0.10
#
# /etc/fstab
/dev/mapper/centos-root /                       xfs     defaults        0 0
UUID=994ab107-5e2c-4751-85c3-2ee333a73c6c /boot                   xfs     defaults        0 0
/dev/mapper/centos-home /home                   xfs     defaults        0 0
/dev/mapper/centos-swap swap                    swap    defaults        0 0

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Increase /dev/mapper/centos-home by reducing centos-root

Post by jlehtone » 2019/10/04 14:45:10

Yes.
1. Dump the root to different disk "Backup"
2. Remove the root volume
3. Create new, sensible root volume
4. Restore data from Backup to root
5. Fix grub.cfg, fstab, ... to match the new volume id's

You obviously cannot do that "on live system", but need rescue media.

Post Reply