Cleaning root (/)

Hello,
my root (/) is almost full, how can i clean it please ?
i’m already cleaning temp files at boot, i used bleachbit, FSlint and rpmorphan (with the last one i’m careful and not using it for orphans are sometimes needed, it gives me more than 3000 orphans …).

Is there another tool or tip that could be interesting ?

Thanks :wink:

On 2012-12-27 09:26, manchette fr wrote:
>
> Hello,
> my root (/) is almost full, how can i clean it please ?
> i’m already cleaning temp files at boot, i used bleachbit, FSlint and
> rpmorphan (with the last one i’m careful and not using it for orphans
> are sometimes needed, it gives me more than 3000 orphans …).
>
> Is there another tool or tip that could be interesting ?

How big is your root, and what exact directories are using most space?
If you don’t know how to find out, ask again.


Cheers / Saludos,

Carlos E. R.
(from 11.4, with Evergreen, x86_64 “Celadon” (Minas Tirith))

you show that by posting

df -h

As a quick and dirty stopgap, it is pretty safe to do:


cd /var/log
rm *.xz

That removes older log entries.

hi,

here it is :

df -h
Sys. fich. Taille Util. Dispo Uti% Monté sur
rootfs 30G 27G 1,8G 94% /
devtmpfs 2,0G 36K 2,0G 1% /dev
tmpfs 2,0G 0 2,0G 0% /dev/shm
tmpfs 2,0G 2,3M 2,0G 1% /run
/dev/sda2 30G 27G 1,8G 94% /
tmpfs 2,0G 0 2,0G 0% /sys/fs/cgroup
tmpfs 2,0G 2,3M 2,0G 1% /var/lock
tmpfs 2,0G 2,3M 2,0G 1% /var/run
tmpfs 2,0G 0 2,0G 0% /media
/dev/sdb1 195G 185G 0 100% /stockage1
/dev/sdc1 917G 145G 726G 17% /stockage2
/dev/sdb2 99G 86G 13G 88% /osvirtuels
/dev/sda3 113G 28G 79G 26% /home

how can i clear the cache of all your downloaded or upgraded packages respectively ?

Thanks :wink:

Sorry, but you are long enough here to have seen the usage of CODE tags. If you forgot: use the # button in the toolbar of the post editor. This is next to uninterpretable.

You must have installed a lot of software. My root file system is only about 14GB.

henk@boven:~> df -h
Bestandssysteem Grootte Gebruikt Besch Geb% Aangekoppeld op
rootfs              20G     4,9G   14G  26% /
devtmpfs           486M      44K  486M   1% /dev
tmpfs              494M      96K  494M   1% /dev/shm
tmpfs              494M     692K  494M   1% /run
/dev/sda5           20G     4,9G   14G  26% /
tmpfs              494M        0  494M   0% /sys/fs/cgroup
tmpfs              494M     692K  494M   1% /var/lock
tmpfs              494M        0  494M   0% /media
tmpfs              494M     692K  494M   1% /var/run
/dev/sda6           99G      46G   48G  50% /home
/dev/sda2           20G     5,9G   13G  32% /mnt/A
/dev/sda3           92G      63G   28G  70% /mnt/A/home
henk@boven:~> 

As said, either you have installed masses and masses of software, or something has run havoc.

Apart from the “first actions” (like the one from nrickert) you have to do some intelligent searching.
This normaly done by using

du -s *

first from the root of the file system in your case

cd /
du -s *

and then when you see a suspect (a directory that is unexpected big, it is here that the intelligent part of the action sits), cd into it and repeat the command. Drill down to the culprit. In tthe root file system it is often /var, Thus

cd var
du -s *

and so on.

On 2012-12-27 13:06, manchette fr wrote:
>
> hi,
>
> here it is :

Please use code tags. Advanced editor, ‘#’ button.
View this
thread for instructions

> df -h
> Sys. fich. Taille Util. Dispo Uti% Monté sur
> rootfs 30G 27G 1,8G 94% /

Well, the next step is showing where the space went. Try:


# du -chsx /*

Then, if /var is the culprit, repeat the command for “/var/*”.


Cheers / Saludos,

Carlos E. R.
(from 11.4, with Evergreen, x86_64 “Celadon” (Minas Tirith))

df -h
Sys. fich.     Taille Util. Dispo Uti% Monté sur
rootfs            30G   27G  1,8G  94% /
devtmpfs         2,0G   36K  2,0G   1% /dev
tmpfs            2,0G     0  2,0G   0% /dev/shm
tmpfs            2,0G  2,3M  2,0G   1% /run
/dev/sda2         30G   27G  1,8G  94% /
tmpfs            2,0G     0  2,0G   0% /sys/fs/cgroup
tmpfs            2,0G  2,3M  2,0G   1% /var/lock
tmpfs            2,0G  2,3M  2,0G   1% /var/run
tmpfs            2,0G     0  2,0G   0% /media
/dev/sdb1        195G  185G     0 100% /stockage1
/dev/sdc1        917G  145G  726G  17% /stockage2
/dev/sdb2         99G   86G   13G  88% /osvirtuels
/dev/sda3        113G   28G   79G  26% /home
# cd /
opensuse122:/ # du -s *
4704    bin
86444   boot
44      dev
49072   etc
28728140        home
2941028 lib
16      lost+found
0       media
20      mnt
607716  opt
89135932        osvirtuels                                                                                                                                                                                                                   
du: cannot access ‘proc/7598/task/7598/fd/4’: No such file or directory                                                                                                                                                                      
du: cannot access ‘proc/7598/task/7598/fdinfo/4’: No such file or directory                                                                                                                                                                  
du: cannot access ‘proc/7598/fd/4’: No such file or directory                                                                                                                                                                                
du: cannot access ‘proc/7598/fdinfo/4’: No such file or directory                                                                                                                                                                            
0       proc                                                                                                                                                                                                                                 
71792   root                                                                                                                                                                                                                                 
du: cannot access ‘run/user/fabrice/gvfs’: Permission denied                                                                                                                                                                                 
11152   run                                                                                                                                                                                                                                  
9592    sbin                                                                                                                                                                                                                                 
4       selinux                                                                                                                                                                                                                              
1360    srv                                                                                                                                                                                                                                  
193791356       stockage1                                                                                                                                                                                                                    
151459460       stockage2                                                                                                                                                                                                                    
4       stockage3                                                                                                                                                                                                                            
0       success                                                                                                                                                                                                                              
0       sys                                                                                                                                                                                                                                  
308     tmp                                                                                                                                                                                                                                  
22672876        usr                                                                                                                                                                                                                          
932392  var        
opensuse122:/ # du -chsx /*                                                                                                                                                                                                                  
4.6M    /bin                                                                                                                                                                                                                                 
85M     /boot
44K     /dev
48M     /etc
28G     /home
2.9G    /lib
16K     /lost+found
0       /media
20K     /mnt
594M    /opt
86G     /osvirtuels
du: cannot access ‘/proc/7709/task/7709/fd/4’: No such file or directory
du: cannot access ‘/proc/7709/task/7709/fdinfo/4’: No such file or directory
du: cannot access ‘/proc/7709/fd/4’: No such file or directory
du: cannot access ‘/proc/7709/fdinfo/4’: No such file or directory
0       /proc
71M     /root
du: cannot access ‘/run/user/fabrice/gvfs’: Permission denied
12M     /run
9.4M    /sbin
4.0K    /selinux
1.4M    /srv
185G    /stockage1
145G    /stockage2
4.0K    /stockage3
0       /success
0       /sys
332K    /tmp
22G     /usr
911M    /var
468G    total
opensuse122:/ # 

i cleaned files in /home but it still says 28G , and also 11G


# du -chsx /home/fabrice/*
1.8M    /home/fabrice/Bibliothèque calibre
141M    /home/fabrice/Bureau
63M     /home/fabrice/Documents
4.0K    /home/fabrice/Hibernation.desktop
8.8G    /home/fabrice/Images
4.0K    /home/fabrice/Modèles
1.1G    /home/fabrice/Musique
24K     /home/fabrice/My GCompris
4.0K    /home/fabrice/Public
4.0K    /home/fabrice/Suspendre.desktop
13M     /home/fabrice/Téléchargements
4.0K    /home/fabrice/Vidéos
4.0K    /home/fabrice/android_appli
44K     /home/fabrice/bin
4.0K    /home/fabrice/bières
4.0K    /home/fabrice/bourse.txt
66M     /home/fabrice/core
4.0K    /home/fabrice/courses.txt
68K     /home/fabrice/dwhelper
7.4M    /home/fabrice/logs
32M     /home/fabrice/manchette@free.fr
1.8M    /home/fabrice/openSUSE-reworked
8.0K    /home/fabrice/public_html
28K     /home/fabrice/rpmbuild
714M    /home/fabrice/src
48K     /home/fabrice/tests
11G     total



opensuse122:/ # du -chsx /home/*
28G     /home/fabrice
4.0K    /home/groups
16K     /home/lost+found
28G     total

Cleaning /home is not a bad idea (like cleaning up every room/kitchen/etc), but as /home is on separate file system, it has nothing to do with the usage of the root file system.

/boot is a bit large. You could look inside if there are old, unused kernels. But that is only a small part.

/lib looks very big to me. I have 202808 (and 20280 for lib64, this being a 64 bit system). You have more then 10 times this size. You should go searching in there.

i think better option would be to backup home
Reinstall rest of OS while retaining home folder

On 2012-12-27 14:36, manchette fr wrote:

> Code:
> --------------------
> opensuse122:/ # du -chsx /*
> 4.6M /bin
> 85M /boot
> 44K /dev
> 48M /etc

> 2.9G /lib
> 16K /lost+found
> 0 /media
> 20K /mnt
> 594M /opt

> 71M /root

> 9.4M /sbin
> 4.0K /selinux
> 1.4M /srv

> 332K /tmp
> 22G /usr
> 911M /var
> 468G total
> opensuse122:/ #
> --------------------

Your big space users are /usr (22G) and /lib (2.9G). You can go inside
those directories (sp /usr) and find out what subdirectories are the big
spenders, but my guess by now is that you simply have a lot installed
and you need more space. Do you have more space on the disk, where you
can put another partition?


Cheers / Saludos,

Carlos E. R.
(from 11.4, with Evergreen, x86_64 “Celadon” (Minas Tirith))

Maybe, but nobody then will know why this happened. And thus it is very likely this will happen again.

For me this is a sort of running away in forward direction (blindfolded). More the sort of MS action. :wink:

On 2012-12-27 19:46, hcvv wrote:
>
> vazhavandan;2513810 Wrote:
>> i think better option would be to backup home
>> Reinstall rest of OS while retaining home folder
> Maybe, but nobody then will know why this happened. And thus it is very
> likely this will happen again.

Why has anything to happen? :slight_smile:

My /usr directory at home has perhaps 50 GiB of things, simply because I
have lots of software installed. Try install the flight simulator game,
for example :wink:


Cheers / Saludos,

Carlos E. R.
(from 11.4, with Evergreen, x86_64 “Celadon” (Minas Tirith))

Well, a system manager that installs software upon software without even watching his diskspace allows something bad to happen.
That is something to avoid in the future. And simply reinstalling (as was suggested) and adding all the software again, wll see the 94% full happen again.

On 2012-12-27 20:26, hcvv wrote:
>
> Well, a system manager that installs software upon software without even
> watching his diskspace allows something bad to happen.
> That is something to avoid in the future. And simply reinstalling (as
> was suggested) and adding all the software again, wll see the 94% full
> happen again.

If you use lots of software, you need that more space, as simple as
that. Some programs are large.


Cheers / Saludos,

Carlos E. R.
(from 11.4, with Evergreen, x86_64 “Celadon” (Minas Tirith))

this is the smallest disk i have, the 1st one below
(this because it came with the pc originally, bigger disks came after).
I’d rather not reinstall, and of course installing softwares needs room

# !fdi
fdisk -l

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x20e3865f

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1       306280448   312580095     3149824   82  Linux swap / Solaris
/dev/sda2   *     4209030    67119569    31455270   83  Linux
/dev/sda3        67119570   306279224   119579827+  83  Linux

Partition table entries are not in disk order

Disk /dev/sdb: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00072096

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1              63   415248119   207624028+  83  Linux
/dev/sdb2   *   415248120   625137344   104944612+  83  Linux

Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c1b47

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1              63  1953520064   976760001   83  Linux

i guess i shall have more regular clean ups a create a procedure similar as follows, for example :

a- using bleachbit cleaning tools

then

b-cleaning archives

cd /var/log
rm *.xz

c- used %

df -h

d-id of the culprit


du -chsx *most_used_dir*s/*

e- erasing unwanted files

rm -rf dir or files

i have many unwanted data in /usr/src :

du -chsx /usr/*
53M     /usr/NX                                                                                                                                                                                                                              
904K    /usr/X11R6                                                                                                                                                                                                                           
631M    /usr/bin                                                                                                                                                                                                                             
4.0K    /usr/games                                                                                                                                                                                                                           
16K     /usr/i586-suse-linux                                                                                                                                                                                                                 
225M    /usr/include                                                                                                                                                                                                                         
4.0K    /usr/lexinkjet                                                                                                                                                                                                                       
3.8G    /usr/lib                                                                                                                                                                                                                             
319M    /usr/local                                                                                                                                                                                                                           
56M     /usr/sbin                                                                                                                                                                                                                            
4.8G    /usr/share                                                                                                                                                                                                                           
12G     /usr/src                                                                                                                                                                                                                             
0       /usr/tmp                                                                                                                                                                                                                             
22G     total              

opensuse122:~ # du -chsx /usr/src
12G     /usr/src
12G     total
opensuse122:~ # du -chsx /usr/src/*
21M     /usr/src/debug
3.7M    /usr/src/kernel-modules
0       /usr/src/linux
**5.6G    /usr/src/linux-3.4**
77M     /usr/src/linux-3.4.tar.bz2
**5.6G    /usr/src/linux-3.5**
78M     /usr/src/linux-3.5.tar.bz2
551M    /usr/src/linux-3.7.1-1
38M     /usr/src/linux-3.7.1-1-obj
8.0K    /usr/src/linux-obj
64K     /usr/src/packages
0       /usr/src/vboxhost-4.2.4
12G     total
opensuse122:~ # 


a few questions here :
1- how come /usr/src is not cleaned up when updating kernel ?
2- why is the 2d kernel kept not the most recent one ? for example : 3.7.1 and 3.7.0. here i have 3.7.1 and 3.5.0xxx
3- what’s this grub2 entry for when i’m using grub the Old_and_mighty ? (aka not grub 2 but the previous one)
4- Do i need grub2 for any reason ?

i have this for menu/lst : ( thus still need kernel 3.5 )

# cat /boot/grub/menu.lst
# Modified by YaST2. Last modification on Wed Dec 19 14:38:35 CET 2012
# THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader
# For the new kernel it try to figure out old parameters. In case we are not able to recognize it (e.g. change of flavor or strange install order ) it it use as fallback installation parameters from /etc/sysconfig/bootloader

default 0
timeout 5
##YaST - generic_mbr
gfxmenu (hd0,1)/boot/message
##YaST - activate

###Don't change this comment - YaST2 identifier: Original name: linux###
title Desktop -- openSUSE 12.2 - 3.7.1-1
    root (hd0,1)
    kernel /boot/vmlinuz-3.7.1-1-desktop root=/dev/disk/by-id/ata-WDC_WD1600PD-07FZB1_WD-WMAES3562221-part2 resume=/dev/disk/by-id/ata-WDC_WD1600PD-07FZB1_WD-WMAES3562221-part1 quiet showopts vga=0x345
    initrd /boot/initrd-3.7.1-1-desktop

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 12.2 - 3.7.1-1
    root (hd0,1)
    kernel /boot/vmlinuz-3.7.1-1-desktop root=/dev/disk/by-id/ata-WDC_WD1600PD-07FZB1_WD-WMAES3562221-part2 showopts apm=off noresume nosmp maxcpus=0 edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe vga=0x345
    initrd /boot/initrd-3.7.1-1-desktop

###Don't change this comment - YaST2 identifier: Original name: linux###
title GNU GRUB 2 -- openSUSE 12.2 - GNU GRUB 2
    kernel (hd0,1)/boot/grub2/core.img root=/dev/disk/by-id/ata-WDC_WD1600PD-07FZB1_WD-WMAES3562221-part2 resume=/dev/disk/by-id/ata-WDC_WD1600PD-07FZB1_WD-WMAES3562221-part1 splash=silent quiet showopts vga=0x345

###Don't change this comment - YaST2 identifier: Original name: linux###
title Desktop -- openSUSE 12.2 - 3.5.0-1.16
    root (hd0,1)
    kernel /boot/vmlinuz-3.5.0-1.16-desktop root=/dev/disk/by-id/ata-WDC_WD1600PD-07FZB1_WD-WMAES3562221-part2 resume=/dev/disk/by-id/ata-WDC_WD1600PD-07FZB1_WD-WMAES3562221-part1 quiet showopts vga=0x345
    initrd /boot/initrd-3.5.0-1.16-desktop

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 12.2 - 3.5.0-1.16
    root (hd0,1)
    kernel /boot/vmlinuz-3.5.0-1.16-desktop root=/dev/disk/by-id/ata-WDC_WD1600PD-07FZB1_WD-WMAES3562221-part2 showopts apm=off noresume nosmp maxcpus=0 edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe vga=0x345
    initrd /boot/initrd-3.5.0-1.16-desktop

On 2012-12-27 22:16, manchette fr wrote:
>
> this is the smallest disk i have, the 1st one below
> (this because it came with the pc originally, bigger disks came after).
> I’d rather not reinstall, and of course installing softwares needs room

You have two solutions. 1, reinstall on a bigger root partition. 2,
split the installation on / and /usr, for which you need another
partition - and it is you who has to find space for that partition.


Cheers / Saludos,

Carlos E. R.
(from 11.4, with Evergreen, x86_64 “Celadon” (Minas Tirith))