Minimizing images

Hey all,

a new member here, just got my Rock Pi S -boards. Looks great so far!

One thing I did notice about the current Debian image is that it does take quite a lot of space by default. This is especially a concern when using the eMMC model with fairly limited storage.

My first observation is that the locales are generated for quite a few languages. The /usr/share/locale directory takes up 46 MB of space by default:

rock@rockpis:~$ sudo du --max-depth=1 -hc /usr/share/locale | sort -h
12K     /usr/share/locale/am
12K     /usr/share/locale/anp
12K     /usr/share/locale/bo
12K     /usr/share/locale/br
12K     /usr/share/locale/brx
12K     /usr/share/locale/de_CH
12K     /usr/share/locale/en_CA
12K     /usr/share/locale/ilo
12K     /usr/share/locale/kw
12K     /usr/share/locale/kw@kkcor
12K     /usr/share/locale/kw@uccor
12K     /usr/share/locale/kw_GB
12K     /usr/share/locale/mai
12K     /usr/share/locale/mg
12K     /usr/share/locale/mn
12K     /usr/share/locale/my
12K     /usr/share/locale/nso
12K     /usr/share/locale/rw
12K     /usr/share/locale/tw
12K     /usr/share/locale/ug
12K     /usr/share/locale/ur
12K     /usr/share/locale/wba
12K     /usr/share/locale/wo
12K     /usr/share/locale/xh
12K     /usr/share/locale/yo
16K     /usr/share/locale/bal
16K     /usr/share/locale/fa
16K     /usr/share/locale/nds
16K     /usr/share/locale/tg
16K     /usr/share/locale/wa
16K     /usr/share/locale/zh_HK
16K     /usr/share/locale/zu
20K     /usr/share/locale/is
20K     /usr/share/locale/ka
20K     /usr/share/locale/mk
20K     /usr/share/locale/oc
24K     /usr/share/locale/si
24K     /usr/share/locale/sq
32K     /usr/share/locale/be@latin
32K     /usr/share/locale/bn
32K     /usr/share/locale/gd
32K     /usr/share/locale/ia
36K     /usr/share/locale/bs
36K     /usr/share/locale/en_GB
36K     /usr/share/locale/ku
40K     /usr/share/locale/sr@latin
44K     /usr/share/locale/cy
48K     /usr/share/locale/fur
48K     /usr/share/locale/he
52K     /usr/share/locale/af
56K     /usr/share/locale/ar
56K     /usr/share/locale/et_EE
56K     /usr/share/locale/lv
72K     /usr/share/locale/ky
108K    /usr/share/locale/be
108K    /usr/share/locale/tl
112K    /usr/share/locale/ms
112K    /usr/share/locale/nn
120K    /usr/share/locale/kk
140K    /usr/share/locale/gu
140K    /usr/share/locale/or
148K    /usr/share/locale/hi
148K    /usr/share/locale/pa
156K    /usr/share/locale/ast
160K    /usr/share/locale/as
160K    /usr/share/locale/ml
164K    /usr/share/locale/bn_IN
168K    /usr/share/locale/ne
168K    /usr/share/locale/te
172K    /usr/share/locale/kn
192K    /usr/share/locale/km
200K    /usr/share/locale/dz
216K    /usr/share/locale/ta
224K    /usr/share/locale/lg
232K    /usr/share/locale/lt
276K    /usr/share/locale/mr
332K    /usr/share/locale/th
380K    /usr/share/locale/eu
436K    /usr/share/locale/ro
456K    /usr/share/locale/ga
484K    /usr/share/locale/gl
536K    /usr/share/locale/en@boldquot
536K    /usr/share/locale/en@quot
548K    /usr/share/locale/et
560K    /usr/share/locale/ko
580K    /usr/share/locale/sk
648K    /usr/share/locale/fi
700K    /usr/share/locale/el
716K    /usr/share/locale/sl
720K    /usr/share/locale/bg
812K    /usr/share/locale/eo
856K    /usr/share/locale/hr
856K    /usr/share/locale/pt
880K    /usr/share/locale/zh_TW
948K    /usr/share/locale/id
1.1M    /usr/share/locale/sr
1.1M    /usr/share/locale/tr
1.2M    /usr/share/locale/da
1.2M    /usr/share/locale/hu
1.2M    /usr/share/locale/it
1.2M    /usr/share/locale/nl
1.3M    /usr/share/locale/nb
1.3M    /usr/share/locale/vi
1.4M    /usr/share/locale/ca
1.4M    /usr/share/locale/pt_BR
1.5M    /usr/share/locale/zh_CN
1.6M    /usr/share/locale/cs
1.6M    /usr/share/locale/es
1.7M    /usr/share/locale/de
1.7M    /usr/share/locale/pl
1.7M    /usr/share/locale/sv
1.8M    /usr/share/locale/ja
1.9M    /usr/share/locale/ru
2.0M    /usr/share/locale/fr
2.3M    /usr/share/locale/uk
46M     /usr/share/locale
46M     total

By reducing the language choices we could drop down the image size quite significantly.

Also documentation (/usr/share/doc, 24 MB) and man pages (/usr/share/man, 7.9 MB) are created by default in the current images, this would save additional 36 MB.

You can create a minimal Rockpi S image with https://github.com/armbian/build or download a testing minimal image with Debian bullseye https://www.armbian.com/radxa-rockpi-s/

But if this is not enough, you have to make a completely custom Linux with Yocto or Buildroot … which will not be simple.