regarding memory issue

General support questions
deva_linux
Posts: 5
Joined: 2024/03/06 10:28:29

regarding memory issue

Post by deva_linux » 2024/05/14 10:32:50

dear sir,

hello sir, i have some question regarding its memory issue, i am using centos 7 in my server and its has 22TB hardrive but it shows that, its /dev/mapper/cl-root 50G 50G 33M 100% / drive compltely full and how can i clear it without formatting my machine , i have attached the details of indormation when we use the command df -h



Filesystem Size Used Avail Use% Mounted on
devtmpfs 32G 0 32G 0% /dev
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 32G 19M 32G 1% /run
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/mapper/cl-root 50G 50G 33M 100% /
tmpfs 32G 388K 32G 1% /tmp
/dev/sda2 1014M 196M 819M 20% /boot
/dev/sda1 200M 13M 187M 7% /boot/efi
/dev/mapper/cl-home 22T 2.8T 20T 13% /home
tmpfs 6.3G 8.0K 6.3G 1% /run/user/42
tmpfs 6.3G 36K 6.3G 1% /run/user/1004

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

Re: regarding memory issue

Post by TrevorH » 2024/05/14 11:44:03

As root, run

du -m -x -d1 / | sort -n

That will show you a list of the top level directories on your / filesystem and how much space is used under each one, sorted in size order with the largest at the bottom. Now repeat that command for the largest directory and keep doing that until you find the bottom level directory that uses all the space. Now review that to see if the contents of that are required. If they are not then delete/compress/move it elsewhere. If they are then work out why it's so large. Explore any other directories using lots of space in the same way.

The rest of your 22TB is in your /home filesystem

/dev/mapper/cl-home 22T 2.8T 20T 13% /home

The default install will create that layout and will use the xfs filesystem and that cannot be shrunk so you cannot make /home smaller without backing up its contents and resizing it then formatting it and restoring the backup. If you do that - don't forget that you will lose the entire contents of /home if you do this - then you will have freespace in the 'cl' volume group that you can assign to your curent 50GB / filesystem.
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: 4551
Joined: 2007/12/11 08:17:33
Location: Finland

Re: regarding memory issue

Post by jlehtone » 2024/05/14 12:13:58

If one has httpd, (SQL) databases, virtual machines, and or containers, then they are by default under /var.
Also log files accumulate under /var/log.

As example, web pages for httpd are under /var/www. One stop the httpd.service, copy all from there to elsewhere,
(under /home is not logical, but one has to do with what one has), remove original, and then mount the new to old.
Something like:

Code: Select all

systemctl stop httpd
rsync -avHAX --stats /var/www/ /home/var_www/
rm -fr /var/www/*
echo "/home/var_www /var/www none bind 0 0" >> /etc/fstab
mount /var/www
restorecon -r /var/www
systemctl start httpd
If that did all went as hoped for, the files are still seen under /var/www/ as before, but are now really on the 22TB volume.

deva_linux
Posts: 5
Joined: 2024/03/06 10:28:29

Re: regarding memory issue

Post by deva_linux » 2024/05/15 07:29:54

TrevorH wrote:
2024/05/14 11:44:03
As root, run

du -m -x -d1 / | sort -n

That will show you a list of the top level directories on your / filesystem and how much space is used under each one, sorted in size order with the largest at the bottom. Now repeat that command for the largest directory and keep doing that until you find the bottom level directory that uses all the space. Now review that to see if the contents of that are required. If they are not then delete/compress/move it elsewhere. If they are then work out why it's so large. Explore any other directories using lots of space in the same way.

The rest of your 22TB is in your /home filesystem

/dev/mapper/cl-home 22T 2.8T 20T 13% /home

The default install will create that layout and will use the xfs filesystem and that cannot be shrunk so you cannot make /home smaller without backing up its contents and resizing it then formatting it and restoring the backup. If you do that - don't forget that you will lose the entire contents of /home if you do this - then you will have freespace in the 'cl' volume group that you can assign to your curent 50GB / filesystem.

after running the command " du -m -x -d1 / | sort -n we are getting


0 /.cache
0 /lost+found
0 /media
0 /mnt
0 /opt
0 /srv
14 /netcdf
15 /mpich
54 /etc
197 /root
8151 /var
42023 /usr
50453 /

and when we go, how we can find which folder takes all the spaces

tunk
Posts: 1215
Joined: 2017/02/22 15:08:17

Re: regarding memory issue

Post by tunk » 2024/05/15 10:29:48

As Trevor said:
"Now repeat that command for the largest directory and keep doing that until you find the bottom level directory that uses all the space. Now review that to see if the contents of that are required."

And:
8151 /var
42023 /usr
I.e. 8 and 42GB.

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

Re: regarding memory issue

Post by TrevorH » 2024/05/15 11:24:02

And then repeat it again until you reach the bottopm of the directory tree containing the space.
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: 4551
Joined: 2007/12/11 08:17:33
Location: Finland

Re: regarding memory issue

Post by jlehtone » 2024/05/15 15:28:48

It is also possible to take a "deeper peek" first:

Code: Select all

du -m -x -d3 /usr

My bet is on /usr/local

deva_linux
Posts: 5
Joined: 2024/03/06 10:28:29

Re: regarding memory issue

Post by deva_linux » 2024/05/15 15:32:23

As you said when we go to /usr as it shows it takes 42 gb and we run the same command which is du -m -x -d1 / | sort -n we get the same result like earlier

0 /.cache
0 /lost+found
0 /media
0 /mnt
0 /opt
0 /srv
14 /netcdf
15 /mpich
54 /etc
197 /root
8151 /var
42023 /usr
50453 /

when we do ls -lrt

drwxr-xr-x. 2 root root 6 Apr 11 2018 games
drwxr-xr-x. 2 root root 6 Apr 11 2018 etc
lrwxrwxrwx. 1 root root 10 Apr 23 2020 tmp -> ../var/tmp
drwxr-xr-x. 4 root root 34 Apr 23 2020 src
dr-xr-xr-x. 54 root root 4096 Jul 13 2021 lib
drwxr-xr-x. 59 root root 12288 Jul 13 2021 libexec
drwxr-xr-x. 368 root root 12288 Jul 13 2021 share
drwxr-xr-x. 583 root root 40960 Jul 13 2021 include
dr-xr-xr-x. 2 root root 102400 Jul 13 2021 bin
dr-xr-xr-x. 251 root root 196608 Jul 13 2021 lib64
drwxr-xr-x. 19 root root 260 Sep 8 2021 local
dr-xr-xr-x. 2 root root 24576 Mar 6 12:45 sbin

these are the library, how can we move it to home and link with the same path without loosing any library, because its install it in our sever and doing some unkown delete problem may occurred for me please guide us to identify the problem and how we can tackle from it.

pjsr2
Posts: 617
Joined: 2014/03/27 20:11:07

Re: regarding memory issue

Post by pjsr2 » 2024/05/15 15:55:09

Code: Select all

du -m -x -d1 / | sort -n
gives you the disk usage ("du") in megabyte ("-m") one directory level deep ("-d1") starting from the root directory ("/") and always staying within the same file system ("-x"), since you are not interested in whatever is in the /home partition. Finally sort it in numerical order.

Now 42 GB in /usr is unusually much. So dig deeper into the /usr directory tree:

Code: Select all

du -m -x -d1 /usr] | sort -n
Now repeat for large subdictories of /usr.

If you have another CentOS-7 machine at hand, you can compare the results.

Websites, databases, containers, mail or virtual machines are by default stored under /var. If you have these, that might explain why your /var directory contains over 8 GB. Otherwise, check your log files (under /var/log) and see if there are huge log files there.

deva_linux
Posts: 5
Joined: 2024/03/06 10:28:29

Re: regarding memory issue

Post by deva_linux » 2024/05/15 16:21:23

pjsr2 wrote:
2024/05/15 15:55:09

Code: Select all

du -m -x -d1 / | sort -n
gives you the disk usage ("du") in megabyte ("-m") one directory level deep ("-d1") starting from the root directory ("/") and always staying within the same file system ("-x"), since you are not interested in whatever is in the /home partition. Finally sort it in numerical order.

Now 42 GB in /usr is unusually much. So dig deeper into the /usr directory tree:

Code: Select all

du -m -x -d1 /usr] | sort -n
Now repeat for large subdictories of /usr.

If you have another CentOS-7 machine at hand, you can compare the results.

Websites, databases, containers, mail or virtual machines are by default stored under /var. If you have these, that might explain why your /var directory contains over 8 GB. Otherwise, check your log files (under /var/log) and see if there are huge log files there.
Thankyou very much sir for your advice

now as i can see the maximum space were used by /usr/local/polyspace/
i have installed some libraies in /user/local/bin, /usr/local/bin but i dont have idea how whats are inside these folder (polyspace)

0 /usr/local/bin
0 /usr/local/etc
0 /usr/local/games
0 /usr/local/include
0 /usr/local/lib
0 /usr/local/lib64
0 /usr/local/libexec
0 /usr/local/sbin
0 /usr/local/src
1 /usr/local/share
40 /usr/local/LIBRARIES
53 /usr/local/cdo
177 /usr/local/grib2
311 /usr/local/ferret
339 /usr/local/ncarg
339 /usr/local/ncarg2
29348 /usr/local/Polyspace
30630 /usr/local

Post Reply