Filesystem running low on diskspace

CMK version: Enterprise 2.2.0p25
OS version: Debian 11.9

Hi,

we are running Checkmk on a physical server with Debian 11.9. During installation the partitions/file systems were automatically created with those sizes:

administrator@server:~$ sudo lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 279,4G  0 disk
├─sda1   8:1    0   512M  0 part /boot/efi
├─sda2   8:2    0  23,3G  0 part /
├─sda3   8:3    0   9,3G  0 part /var
├─sda4   8:4    0   977M  0 part [SWAP]
├─sda5   8:5    0   1,9G  0 part /tmp
└─sda6   8:6    0 243,5G  0 part /home

This is the current usage of the filesystems:

administrator@server:~$ df -BG
Dateisystem                                   1G-Blöcke Benutzt Verfügbar Verw% Eingehängt auf
udev                                               126G      0G      126G    0% /dev
tmpfs                                               26G      1G       26G    1% /run
/dev/sda2                                           23G     19G        4G   84% /
tmpfs                                              126G      0G      126G    0% /dev/shm
tmpfs                                                1G      0G        1G    0% /run/lock
/dev/sda1                                            1G      1G        1G    2% /boot/efi
/dev/sda6                                          239G      1G      227G    1% /home
/dev/sda5                                            2G      1G        2G    1% /tmp
/dev/sda3                                           10G      2G        7G   21% /var
tmpfs                                              126G      1G      126G    1% /opt/omd/sites/sitename/tmp
tmpfs                                               26G      0G       26G    0% /run/user/1000

We now have the problem, that /dev/sda2 is running low on diskspace. /dev/sda6 on the other hand has plenty of free space left.

I know it is more or less a generic Linux question, but is there an easy way to decrease /dev/sda6 by e.g. 20GB and increase /dev/sda2 by 20GB?

Best regards,
UT2019

I would move /home into / and then use /dev/sda6 for a new /opt mountpoint.
checkmk stores everything below /opt/omd so it makes sense to put that into a separate partition.
Without any other application besides checkmk you will not have a lot data in /home.

2 Likes

And next time use LVM which makes such tasks much much easier. :slight_smile:

2 Likes

Thanks for your replies!

I must admit I am really no Linux expert. Can the suggestion (move /home into / and use /dev/sda6 for /opt) be done like this?

su - sitename
omd stop
exit

cd /
mkdir newHome
cp -a /home/* /newHome
umount /home
mv /newHome /home

nano /etc/fstab
old: UUID=<UUID> /home ext4 defaults 0 2
new: UUID=<UUID> /opt ext4 defaults 0 2

mv /opt /oldOpt
mount /opt
cp -a /oldOpt/* /opt
rm -rf /oldOpt

Best regards,
UT2019

I guess it is not that easy and my commands described above won’t work?

They should work. Have you tried to run them?

They should work. Have you tried to run them?

No not yet. Because this is a productive system which I don’t want to crash I was not brave enough yet…

The command umount /home might fail because that filesystem might be in use while the system is up and running and users are logged in. It is usually safer to do such changes while booting from an external USB stick or something like that.

But in general, your steps are correct. If the unmounting of /home works, you can go with your commands.

If you boot from an external stick, the steps would be like so:

# temporarily mount the root and home filesystems to somewhere in /mnt:
mkdir /mnt/root
mkdir /mnt/oldhome
mount /dev/sda2 /mnt/root
mount /dev/sda6 /mnt/oldhome

# move home:
mkdir /mnt/root/home
mv /mnt/oldhome/* /mnt/root/home/

# move opt:
mv /mnt/root/opt/* /mnt/oldhome/

Now edit /mnt/root/etc/fstab and reboot.

I’m not perfectly sure but maybe you can also boot in recovery mode instead of from an external stick.

Thanks for confirmation.

I just executed the commands and was actually able to do it on the fly without booting from an external USB stick. And the commands actually worked as planned, so we now have plenty of disk space left.

Thanks for your support!

3 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.