Repartitioning

Issues related to applications and software problems and general support
Post Reply
fullbore
Posts: 22
Joined: 2018/10/21 14:33:19

Repartitioning

Post by fullbore » 2023/03/16 10:38:42

I did an server install of Centos 9 and let the installer do automatic partitioning and it set it up like this with a massive /home partition and a tiny / partition, how to I shrink the /home partition to expand the almost full / partition?

df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.7G 0 3.7G 0% /dev
tmpfs 3.7G 0 3.7G 0% /dev/shm
tmpfs 1.5G 166M 1.4G 12% /run
/dev/mapper/cs-root 70G 68G 2.9G 96% /
/dev/sda1 1014M 225M 790M 23% /boot
/dev/mapper/cs-home 857G 76G 781G 9% /home
tmpfs 751M 0 751M 0% /run/user/1000

lvs -a -o +devices
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices
home cs -wi-ao---- 856.82g /dev/sda2(943)
root cs -wi-ao---- 70.00g /dev/sda2(220290)
swap cs -wi-ao---- 3.68g /dev/sda2(0)

lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 931.5G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 930.5G 0 part
├─cs-root 253:0 0 70G 0 lvm /
├─cs-swap 253:1 0 3.7G 0 lvm [SWAP]
└─cs-home 253:2 0 856.8G 0 lvm /home
sr0 11:0 1 1024M 0 rom

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

Re: Repartitioning

Post by TrevorH » 2023/03/16 10:41:00

Since the default filesystem is xfs and that cannot be shrunk you will need to back up the data, umount /home, lvresize it, reformat it, remount it and then restore the data.
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

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

Re: Repartitioning

Post by jlehtone » 2023/03/16 12:03:52

Why your '/' is full? What consumes the space?
Applications should not take that much ... except perhaps some really big commercial packages (games?).

If you do have data, like database, website, containers, etc, their subdirectories could be mounted from
other filesystems. Such division makes also reinstall easier.

fullbore
Posts: 22
Joined: 2018/10/21 14:33:19

Re: Repartitioning

Post by fullbore » 2023/03/17 10:02:55

jlehtone wrote:
2023/03/16 12:03:52
Why your '/' is full? What consumes the space?
Master server backups, probably easiest to move /huntingdon-backup to /home/huntingdon-backup

du -h / --max-depth 1
186M /boot
0 /dev
70G /home
0 /proc
149M /run
0 /sys
4.0K /tmp
21M /etc
76K /root
12G /var
1.4G /usr
0 /afs
0 /media
0 /mnt
0 /opt
0 /srv
54G /huntingdon-backup
462M /home-potassium
0 /nsa320s-backup

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

Re: Repartitioning

Post by jlehtone » 2023/03/17 10:57:08

Indeed.

Personally, I do like bind-mounts as means to hide where data really is - no need to tamper service config or selinux. Then again /home has its own selinux rules. Not that any of that matters with that backup.


PS. The du has flags, like -x, to not look at "other" filesystems.

Post Reply