Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Best practices for /usr
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
LIsLinuxIsSogood
Veteran
Veteran


Joined: 13 Feb 2016
Posts: 1014

PostPosted: Mon Jun 25, 2018 9:43 am    Post subject: Best practices for /usr Reply with quote

I am trying to clean the filesystem and this is bugging me...

Code:

playboy /usr/src # du -sch
2.4G   .
2.4G   total
playboy /usr/src # ls -l
total 16
drwxr-xr-x 12 root root 4096 Jun  2 20:54 initramfs
lrwxrwxrwx  1 root root   22 Jan 19 12:32 linux -> linux-4.14.8-gentoo-r1
drwxr-xr-x 26 root root 4096 Jun 12 15:07 linux-4.14.8-gentoo-r1
drwxr-xr-x 25 root root 4096 Jun  2 20:54 linux-4.9.95-gentoo
drwxr-xr-x  2 root root 4096 Jun  2 20:54 local


With the larger being 1.6G for the selected kernel sources, 4.14.8. Why would this source directory be so huge all the sudden?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43184
Location: 56N 3W

PostPosted: Mon Jun 25, 2018 9:53 am    Post subject: Reply with quote

LIsLinuxIsSogood,

A clean kernel source tree is about 900MB when you add in all the object files by running make it gets bigger.
Code:
 /usr/src $ du -d1 -h
1.4G   ./linux-4.17.0-gentoo
908M   ./linux-4.16.3-gentoo
908M   ./linux-4.16.13-gentoo
1.4G   ./linux-4.17-rc7
908M   ./linux-4.16.9-gentoo
1.4G   ./linux-4.17.1-gentoo
1.4G   ./linux-4.17-rc1
903M   ./linux-4.17.2-gentoo
908M   ./linux-4.16.2-gentoo
908M   ./linux-4.16.12-gentoo
908M   ./linux-4.16.5-gentoo
12G   .


So my lean mean kernels are 1.4G built. I do have an initrd but its kernel agnostic. I think it goes back to 2009.
I don't use genkernel, that will build even more options in the kernel build location.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Mon Jun 25, 2018 10:11 am    Post subject: Re: Best practices for /usr Reply with quote

LIsLinuxIsSogood wrote:
With the larger being 1.6G for the selected kernel sources, 4.14.8. Why would this source directory be so huge all the sudden?

LIsLinuxIsSogood ... the kernel sources are big by any standard, and that size will only increase when compiled. So, I expect this is in part due to what's enabled ... if you're using genkernel, and not manually delecting the default =m, or =y ... then you can expect that directory to double in size after 'make'.

Code:
# xz -l /usr/src/distfiles/linux-*
Strms  Blocks   Compressed Uncompressed  Ratio  Check   Filename
    3       3     72.8 MiB    518.8 MiB  0.140  CRC64   /usr/src/distfiles/linux-3.12.tar.xz
    1       7     98.2 MiB    797.0 MiB  0.123  CRC32   /usr/src/distfiles/linux-4.16.tar.xz
-------------------------------------------------------------------------------
    4      10    171.1 MiB  1,315.8 MiB  0.130  CRC32,CRC64 2 files
# du -shc */
3.8M   config/
2.1G   distfiles/
277M   initramfs/
798M   linux-3.12.72-ck/
12K    misc/
15M    patches/
3.2G   total

That linux-3.12.72-ck has only those items selected I need, yet you can see it's some 300mb bigger than the unpacked tarball. If you don't mind rebuilding everything should you need to add a module, or whatever, then you can run 'make clean' after 'make modules-install' and 'cp arch/i386/boot/bzImage /boot/'.

HTH & best ... khay
Back to top
View user's profile Send private message
Akkara
Administrator
Administrator


Joined: 28 Mar 2006
Posts: 6693
Location: &akkara

PostPosted: Mon Jun 25, 2018 10:22 am    Post subject: Reply with quote

I mount a separate partition on /usr/src. Keeps the I/O traffic and fragmentation isolated and doesn't get in the way of the main /usr filesystem as much, which is read-mostly. (I keep meaning to try a read-only /usr but haven't had time to keep up with all the changes to know whether that would be a workable idea.)
_________________
Many think that Dilbert is a comic. Unfortunately it is a documentary.
Back to top
View user's profile Send private message
LIsLinuxIsSogood
Veteran
Veteran


Joined: 13 Feb 2016
Posts: 1014

PostPosted: Wed Jun 27, 2018 3:54 am    Post subject: Reply with quote

Neddy why do you have so many kernels? Is it like a backup of some kind or is there some other rationale to that...
Back to top
View user's profile Send private message
LIsLinuxIsSogood
Veteran
Veteran


Joined: 13 Feb 2016
Posts: 1014

PostPosted: Wed Jun 27, 2018 4:04 am    Post subject: Reply with quote

Sorry khayyam, but it seems like I was unclear at least on one of the systems I'm working on here the sources were already removed from Portage, so I don't have a Makefile in that directory. But it seems like the leftovers in that folder remaining are still substantial. I don't mind removing it altogether (probably going to sooner or later anyway).

Quote:
then you can run 'make clean' after 'make modules-install' and 'cp arch/i386/boot/bzImage /boot/'.


At this point I might just end up rm'ing them...But, if I wanted to keep the source, then it with some of the files missing in the source tree I can't be sure, but does reinstalling gentoo sources overwrite that data in /usr/src/linux-xx.xx.xx with new files or not. I could alternatively copy a ready to go Makefile in there, is there any harm in that (after inspecting?) I want to be sure that doesn't mess anything up with my active running kernel, which on this laptop is only 1 kernel source installed...


Code:

Machine_West /usr/src # eselect kernel list
Available kernel symlink targets:
  [1]   linux-4.17.2-gentoo


No other kernels.

Code:
Machine_West /usr/src # du -h --max-depth=1
616M   ./linux-4.16.9-gentoo
24K   ./rpm
629M   ./linux-4.17.0-gentoo
903M   ./linux-4.17.2-gentoo
2.1G   .


Please help me to figure out how best to remove or retain potential kernel sources like these previous ones.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Wed Jun 27, 2018 8:20 am    Post subject: Reply with quote

LIsLinuxIsSogood ...

it looks as though you've run --depclean and so selected package versions were removed. However, this doesn't remove the directory, object files, etc ... as these files were not installed by the package manager, and so are not component of the package. Once --depclean'ed they should be manually removed, ie:

Code:
# rm -fr /usr/src/linux-4.{16.9,17.0}-gentoo

That will free up about 1.2Gb ...

HTH & best ... khay
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum