0

My problem : my root path is full

$ df -H
Filesystem      Size  Used Avail Use% Mounted on
udev             17G     0   17G   0% /dev
tmpfs           3.4G  170M  3.2G   6% /run
/dev/md1         21G   21G     0 100% /
tmpfs            17G     0   17G   0% /dev/shm
tmpfs           5.3M     0  5.3M   0% /run/lock
tmpfs            17G     0   17G   0% /sys/fs/cgroup
/dev/md0        295M   38M  238M  14% /boot
/dev/md2        481G   76M  457G   1% /data
tmpfs           3.4G     0  3.4G   0% /run/user/1000

so can we :

  1. reduce size of /dev/md2 and give this space to root (/dev/md1) ?
  2. merge both partition (/dev/md2 go in /dev/md1) ?
  3. other idea of solution to my space disk problem ?
2
  • 4
    4. Quick and dirty: move your biggest directories to /data and create appropriate symlinks or bind mounts there instead so nothing breaks.
    – HBruijn
    Aug 1, 2018 at 12:37
  • how can I change /var folder on other disk? I use "mv" cmd, but I don't know how specify a disk...
    – Matrix
    Aug 1, 2018 at 17:55

2 Answers 2

1

Moving some big files out of the way is the easiest solution. To find the biggest directories, use this command

du -Sx / | sort -n | less

The move large files or directories into directories on /dev/md2 below /data.

mkdir -p /data/path
mv /path/file /data/path
ls -s /data/path/file /path/file

All other solutions are complicated and risky, so you should have a backup. On the other hand, if you have a backup, just recreate your partitions and restore from backup. Anyway you should boot from another system, like a live system from USB.

Reducing size of /dev/md2 is possible. First reduce the file system inside the partition. Then resize the RAID array. Then resize the disk partitions that are part of the array. To increase /dev/md1, do it the other way. Increase the size of the disk partitions. Increase the size of the RAID. Increase the size of the file system.

To merge both partitions is even more work, unless you don't care about the reuse of the space now occupied on /dev/md1. Mount /dev/md2, create s sub directory data, move everything into this directory data. Mount /dev/md1, copy everything to /dev/md2. Use /dev/md2 as your new root partition.

If you want to reuse the space in /dev/md1, it is much more complicated, I can write about that if you are interested.

8
  • the problem is, I just have SSH acces to the server... I can't use usb or cd...
    – Matrix
    Aug 1, 2018 at 17:57
  • 1
    The you should just find some big files or directories and move them to /dev/md2. Place symlinks to access them with the original name.
    – RalfFriedl
    Aug 1, 2018 at 18:30
  • what the cmd to mv on other disk (i know "mv" cmd, but how can I specify the good disk?)
    – Matrix
    Aug 1, 2018 at 22:01
  • 1
    I added an example for move. If you provide names of directories that occupy much space, I can get more specific. Likely candidates are /tmp and /var/log
    – RalfFriedl
    Aug 1, 2018 at 22:06
  • 1
    The time to follow a symlink is very small. But if it is about apache or nginx, you can change the paths in the configuration if you want.
    – RalfFriedl
    Aug 2, 2018 at 17:15
0
  1. Try to find which is the source of the full partition, as RalfFriedl noted with du command
  2. Move (or delete if is the case) the files, check if /tmp is full of nonsense. /var/log perhaps?
  3. IMHO is better to keep / (/dev/md1) in 21GB, this is more than enough for a regular linux root partition
  4. Properly configure the service/app that is filling the / partition to write to /data (/dev/md2).
  5. For the future, you should enforce quotas and alerting so you can prevent this when the space is reaching a threshold.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .