Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

How to reduce the size of the installation?

New to Debian (Or Linux in general)? Ask your questions here!
Message
Author
User avatar
sickpig
Posts: 592
Joined: 2019-01-23 10:34
Has thanked: 1 time
Been thanked: 1 time

Re: How to reduce the size of the installation?

#21 Post by sickpig »

TygerTung wrote:I am a little frustrated with how big it is.
Just came across HypriotOS while learning something else -
"
HypriotOS developers have optimized the toolset to only require 600MB of disk space and have reduced the size of the download packages to 232MB
"
It is optimized for docker. You can use this along with docker for pi-hole. pi-hole has an official docker image.

brian_p
Posts: 196
Joined: 2015-11-05 10:32
Has thanked: 1 time
Been thanked: 5 times

Re: How to reduce the size of the installation?

#22 Post by brian_p »

Hello Sam,

I have installed Debian and other software on HP thin clients quite a number of times. For your preliminary investigation you should first install the base system (nothing else), move to install GRUB, finish and reboot. Give us what you get for 'df -h'. A package list for the installation would be very useful.

Now install your pi-hole and DNS stuff. Make sure it is exactly what you need and all the dependencies are there. I hope X isn't involved. :) Give 'df -h' again.

Cheers,

Brian.
--
Brian.

TygerTung
Posts: 27
Joined: 2020-08-03 17:00

Re: How to reduce the size of the installation?

#23 Post by TygerTung »

OK thanks for the advice.

I've done a fresh install of Debian 9, base only. I had to install SSH-client post installation, as I need to be able to remotely log into the system from my netbook.

Upon running the

Code: Select all

df -h
command I get this:

Code: Select all

Filesystem      Size  Used Avail Use% Mounted on
udev            938M     0  938M   0% /dev
tmpfs           190M  2.9M  187M   2% /run
/dev/sda1       945M  631M  299M  68% /
tmpfs           946M     0  946M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           946M     0  946M   0% /sys/fs/cgroup
tmpfs           190M     0  190M   0% /run/user/1000
I've cloned the hard drive on to a USB flash drive and I'm now going to try to thin it out. This way if I completely break the system, I might be able to use my copy without having to do a full re-installation.

These are the installed packages:

Code: Select all

adduser						install
apt						install
apt-utils					install
base-files					install
base-passwd					install
bash						install
bsdmainutils					install
bsdutils					install
busybox						install
console-setup					install
console-setup-linux				install
coreutils					install
cpio						install
cron						install
dash						install
dbus						install
debconf						install
debconf-i18n					install
debian-archive-keyring				install
debianutils					install
dictionaries-common				install
diffutils					install
discover					install
discover-data					install
dmidecode					install
dmsetup						install
dpkg						install
e2fslibs:i386					install
e2fsprogs					install
emacsen-common					install
findutils					install
gcc-6-base:i386					install
gettext-base					install
gnupg						install
gnupg-agent					install
gpgv						install
grep						install
grub-common					install
grub-pc						install
grub-pc-bin					install
grub2-common					install
gzip						install
hostname					install
iamerican					install
ibritish					install
ienglish-common					install
ifupdown					install
init						install
init-system-helpers				install
initramfs-tools					install
initramfs-tools-core				install
installation-report				install
iproute2					install
iptables					install
iputils-ping					install
isc-dhcp-client					install
isc-dhcp-common					install
ispell						install
kbd						install
keyboard-configuration				install
klibc-utils					install
kmod						install
krb5-locales					install
laptop-detect					install
libacl1:i386					install
libapparmor1:i386				install
libapt-inst2.0:i386				install
libapt-pkg5.0:i386				install
libassuan0:i386					install
libattr1:i386					install
libaudit-common					install
libaudit1:i386					install
libblkid1:i386					install
libbsd0:i386					install
libbz2-1.0:i386					install
libc-bin					install
libc-l10n					install
libc6:i386					install
libcap-ng0:i386					install
libcap2:i386					install
libcomerr2:i386					install
libcryptsetup4:i386				install
libdb5.3:i386					install
libdbus-1-3:i386				install
libdebconfclient0:i386				install
libdevmapper1.02.1:i386				install
libdiscover2					install
libdns-export162				install
libedit2:i386					install
libelf1:i386					install
libestr0					install
libexpat1:i386					install
libfastjson4:i386				install
libfdisk1:i386					install
libffi6:i386					install
libfreetype6:i386				install
libfuse2:i386					install
libgcc1:i386					install
libgcrypt20:i386				install
libgdbm3:i386					install
libgmp10:i386					install
libgnutls30:i386				install
libgpg-error0:i386				install
libgssapi-krb5-2:i386				install
libhogweed4:i386				install
libidn11:i386					install
libidn2-0:i386					install
libip4tc0:i386					install
libip6tc0:i386					install
libiptc0:i386					install
libisc-export160				install
libk5crypto3:i386				install
libkeyutils1:i386				install
libklibc					install
libkmod2:i386					install
libkrb5-3:i386					install
libkrb5support0:i386				install
libksba8:i386					install
liblocale-gettext-perl				install
liblogging-stdlog0:i386				install
liblognorm5:i386				install
liblz4-1:i386					install
liblzma5:i386					install
libmnl0:i386					install
libmount1:i386					install
libncurses5:i386				install
libncursesw5:i386				install
libnetfilter-conntrack3:i386			install
libnettle6:i386					install
libnewt0.52:i386				install
libnfnetlink0:i386				install
libnpth0:i386					install
libp11-kit0:i386				install
libpam-modules:i386				install
libpam-modules-bin				install
libpam-runtime					install
libpam-systemd:i386				install
libpam0g:i386					install
libpci3:i386					install
libpcre3:i386					install
libpipeline1:i386				install
libpng16-16:i386				install
libpopt0:i386					install
libprocps6:i386					install
libpsl5:i386					install
libreadline7:i386				install
libseccomp2:i386				install
libselinux1:i386				install
libsemanage-common				install
libsemanage1:i386				install
libsepol1:i386					install
libslang2:i386					install
libsmartcols1:i386				install
libsqlite3-0:i386				install
libss2:i386					install
libssl1.0.2:i386				install
libssl1.1:i386					install
libstdc++6:i386					install
libsystemd0:i386				install
libtasn1-6:i386					install
libtext-charwidth-perl				install
libtext-iconv-perl				install
libtext-wrapi18n-perl				install
libtinfo5:i386					install
libudev1:i386					install
libunistring0:i386				install
libusb-0.1-4:i386				install
libusb-1.0-0:i386				install
libustr-1.0-1:i386				install
libuuid1:i386					install
libwrap0:i386					install
libx11-6:i386					install
libx11-data					install
libxapian30:i386				install
libxau6:i386					install
libxcb1:i386					install
libxdmcp6:i386					install
libxext6:i386					install
libxmuu1:i386					install
libxtables12:i386				install
linux-base					install
linux-image-4.9.0-13-686-pae			install
linux-image-686-pae				install
locales						install
login						install
logrotate					install
lsb-base					install
mawk						install
mount						install
multiarch-support				install
nano						install
ncurses-base					install
ncurses-bin					install
ncurses-term					install
netbase						install
openssh-client					install
openssh-server					install
openssh-sftp-server				install
os-prober					install
passwd						install
pciutils					install
perl-base					install
pinentry-curses					install
procps						install
readline-common					install
rsyslog						install
sed						install
sensible-utils					install
systemd						install
systemd-sysv					install
sysvinit-utils					install
tar						install
task-english					install
tasksel						install
tasksel-data					install
tcpd						install
tzdata						install
ucf						install
udev						install
usbutils					install
util-linux					install
util-linux-locales				install
vim-common					install
vim-tiny					install
wamerican					install
wget						install
whiptail					install
xauth						install
xkb-data					install
xxd						install
zlib1g:i386					install

TygerTung
Posts: 27
Joined: 2020-08-03 17:00

Re: How to reduce the size of the installation?

#24 Post by TygerTung »

Hmm, using the "script" I found on the ReduceDebian page didn't work too good.

Code: Select all

# Remove non-critical packages (don't remove busybox -> don't sure if this ist still a problem on debian 7)
# ~i -> list all installed packages
# !~M -> don't list automatic installed packages
# !~prequired -> don't list packages with priority required
# !~pimportant -> don't list packages with priority important
# !~R~prequired -> don't list dependency packages of required packages
# !~R~pimportant -> don't list dependency packages of important packages
# !~R~R~prequired -> don't list dependency packages of dependency packages of required packages -.- (two levels should be enough. Have not found a recursive option)
# !~R~R~pimportant -> ... required packages
# !busybox -> don't list busybox
# !grub -> don't list grub (we need a boot manager. If LILO or something else is used change this)
# !initramfs-tools -> don't list initramfs-tools (else the kernel is gone)

apt-get purge $(aptitude search '~i!~M!~prequired!~pimportant!~R~prequired!~R~R~prequired!~R~pimportant!~R~R~pimportant!busybox!grub!initramfs-tools' | awk '{print $2}')
apt-get purge aptitude
apt-get autoremove
apt-get clean
It might have broken the system a little bit, but I think I repaired it with the

Code: Select all

 apt --fix-broken install^
command.
After running it, I had to reinstall openssh-server as it got uninstalled, and now the disk usage is even larger!

Code: Select all

Filesystem      Size  Used Avail Use% Mounted on
udev            938M     0  938M   0% /dev
tmpfs           190M  2.9M  187M   2% /run
/dev/sda1       945M  679M  250M  74% /
tmpfs           946M     0  946M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           946M     0  946M   0% /sys/fs/cgroup
tmpfs           190M     0  190M   0% /run/user/1000
Lucky I made the clone of the disc before ruining it. I guess the best way to clone it back will be to boot off the cloned disc, use DD to copy it back over to the original disc and then change the boot order again in the BIOS.

brian_p
Posts: 196
Joined: 2015-11-05 10:32
Has thanked: 1 time
Been thanked: 5 times

Re: How to reduce the size of the installation?

#25 Post by brian_p »

My recent experience is with Debian 10.

Code: Select all

apt show <pkg>
should be used to decide on whether a package should be purged.
/dev/sda1 945M 631M 299M 68% /
/dev/sda1 945M 679M 250M 74% /
About a 50M before and after difference. Not bad. What you want to do seems doable. But every M counts, so the initial footprint may be reduced.

Only you can judge how useful these packages are to you. Otherwise they could go. I wouldn't have (or need) them on my machines.

Code: Select all

dictionaries-common
iamerican
ibritish
ienglish-common
wamerican
ispell
task-english
Not needed on a running machine.

Code: Select all

apt-utils
dmidecode
installation-report
laptop-detect
pciutils
usbutils
wget
xauth
tasksel
tasksel-data
Not on buster, so I don't really know. I think they could be removed.

Code: Select all

emacsen-common
pinentry-curses
multiarch-support
Give the machine a fixed IP and remove these:

Code: Select all

isc-dhcp-client
isc-dhcp-server
Do you really need two editors?

Code: Select all

nano
vim-tiny
vim-common
Space hogs. Replace with dropbear

Code: Select all

openssh-client
openssh-server
Transfer files between machines? Replace with netcat-openbsd

Code: Select all

openssh-sftp-server
You need Kerberos? I wouldn't think so.

Code: Select all

krb5-locales
I'd purge these.

Code: Select all

iptables
tcpd
Do really want documentation?

Code: Select all

rm -r /usr/share/doc/

Code: Select all

apt clean
temporarily reduces disk space used until Debian is updated. Section 4.4.3 of the Release Notes is worth looking at.

BTW, I would reinstall rather than clone. You learn a lot more that way :).

Cheers,

Brian.
--
Brian.

TygerTung
Posts: 27
Joined: 2020-08-03 17:00

Re: How to reduce the size of the installation?

#26 Post by TygerTung »

OK, my clone didn't seem to want to boot so I'm re-installing. I found the expert mode which gives me a bit more control. I tried installing the base system only without installing any software, but it didn't really give me a bootable system. It only loaded into initramfs, which I couldn't really do anything with. It was using busybox I think.

I am now re-installing it, but I will go to the install software phase.

I'll install dropbear ssh and then I can login on my netbook and thin out the system a little.

TygerTung
Posts: 27
Joined: 2020-08-03 17:00

Re: How to reduce the size of the installation?

#27 Post by TygerTung »

OK, I found that the problem was not just installing the base system and no software, it was using LILO instead of GRUB.

I have completed the installation and installed dropbear (nice and small) and now this is my disk usage (df is much nicer with the -h argument)

Code: Select all

Filesystem      Size  Used Avail Use% Mounted on
udev            944M     0  944M   0% /dev
tmpfs           190M  2.9M  187M   2% /run
/dev/sda1       945M  546M  384M  59% /
tmpfs           947M     0  947M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           947M     0  947M   0% /sys/fs/cgroup
I'll put my daughter down for a nap and try thinning out the system according to your instructions. Thanks.,

TygerTung
Posts: 27
Joined: 2020-08-03 17:00

Re: How to reduce the size of the installation?

#28 Post by TygerTung »

There is still a lot of packages installed (249.
I can't see that I would need all of them. I don't need to add any users for example, so maybe I could remove adduser? I have everything I need on the system now, so wouldn't need a great deal of utilities?

Code: Select all

adduser						install
apt						install
base-files					install
base-passwd					install
bash						install
bind9-host					install
bsdmainutils					install
bsdutils					install
busybox						install
console-setup					install
console-setup-linux				install
coreutils					install
cpio						install
cron						install
cryptsetup					install
cryptsetup-bin					install
curl						install
dash						install
debconf						install
debconf-i18n					install
debian-archive-keyring				install
debianutils					install
dhcpcd5						install
diffutils					install
dmsetup						install
dns-root-data					install
dnsutils					install
dpkg						install
dropbear					install
dropbear-bin					install
dropbear-initramfs				install
dropbear-run					install
e2fslibs:i386					install
e2fsprogs					install
findutils					install
gcc-6-base:i386					install
gettext-base					install
git						install
git-man						install
gnupg						install
gnupg-agent					install
gpgv						install
grep						install
grub-common					install
grub-pc						install
grub-pc-bin					install
grub2-common					install
gzip						install
hostname					install
idn2						install
ifupdown					install
init						install
init-system-helpers				install
initramfs-tools					install
initramfs-tools-core				install
iproute2					install
iputils-ping					install
isc-dhcp-common					install
kbd						install
keyboard-configuration				install
klibc-utils					install
kmod						install
libacl1:i386					install
libapparmor1:i386				install
libapt-inst2.0:i386				install
libapt-pkg5.0:i386				install
libassuan0:i386					install
libattr1:i386					install
libaudit-common					install
libaudit1:i386					install
libbind9-140:i386				install
libblkid1:i386					install
libbsd0:i386					install
libbz2-1.0:i386					install
libc-bin					install
libc-l10n					install
libc6:i386					install
libcap-ng0:i386					install
libcap2:i386					install
libcap2-bin					install
libcomerr2:i386					install
libcryptsetup4:i386				install
libcurl3:i386					install
libcurl3-gnutls:i386				install
libdb5.3:i386					install
libdebconfclient0:i386				install
libdevmapper1.02.1:i386				install
libdns-export162				install
libdns162:i386					install
libedit2:i386					install
libelf1:i386					install
liberror-perl					install
libestr0					install
libexpat1:i386					install
libfam0:i386					install
libfastjson4:i386				install
libfdisk1:i386					install
libffi6:i386					install
libfreetype6:i386				install
libfuse2:i386					install
libgcc1:i386					install
libgcrypt20:i386				install
libgdbm3:i386					install
libgeoip1:i386					install
libgmp10:i386					install
libgnutls30:i386				install
libgpg-error0:i386				install
libgssapi-krb5-2:i386				install
libhogweed4:i386				install
libicu57:i386					install
libidn11:i386					install
libidn2-0:i386					install
libip4tc0:i386					install
libip6tc0:i386					install
libiptc0:i386					install
libisc-export160				install
libisc160:i386					install
libisccc140:i386				install
libisccfg140:i386				install
libk5crypto3:i386				install
libkeyutils1:i386				install
libklibc					install
libkmod2:i386					install
libkrb5-3:i386					install
libkrb5support0:i386				install
libksba8:i386					install
libldap-2.4-2:i386				install
libldap-common					install
liblocale-gettext-perl				install
liblogging-stdlog0:i386				install
liblognorm5:i386				install
liblwres141:i386				install
liblz4-1:i386					install
liblzma5:i386					install
libmagic-mgc					install
libmagic1:i386					install
libmnl0:i386					install
libmount1:i386					install
libncurses5:i386				install
libncursesw5:i386				install
libnetfilter-conntrack3:i386			install
libnettle6:i386					install
libnewt0.52:i386				install
libnfnetlink0:i386				install
libnghttp2-14:i386				install
libnpth0:i386					install
libp11-kit0:i386				install
libpam-modules:i386				install
libpam-modules-bin				install
libpam-runtime					install
libpam0g:i386					install
libpcre3:i386					install
libperl5.24:i386				install
libpipeline1:i386				install
libpng16-16:i386				install
libpopt0:i386					install
libprocps6:i386					install
libpsl5:i386					install
libreadline7:i386				install
librtmp1:i386					install
libsasl2-2:i386					install
libsasl2-modules-db:i386			install
libseccomp2:i386				install
libselinux1:i386				install
libsemanage-common				install
libsemanage1:i386				install
libsepol1:i386					install
libslang2:i386					install
libsmartcols1:i386				install
libsqlite3-0:i386				install
libss2:i386					install
libssh2-1:i386					install
libssl1.0.2:i386				install
libssl1.1:i386					install
libstdc++6:i386					install
libsystemd0:i386				install
libtasn1-6:i386					install
libtext-charwidth-perl				install
libtext-iconv-perl				install
libtext-wrapi18n-perl				install
libtinfo5:i386					install
libudev1:i386					install
libunistring0:i386				install
libustr-1.0-1:i386				install
libuuid1:i386					install
libxapian30:i386				install
libxml2:i386					install
libxslt1.1:i386					install
libxtables12:i386				install
lighttpd					install
linux-base					install
linux-image-4.9.0-13-686			install
locales						install
login						install
logrotate					install
lsb-base					install
lsof						install
mawk						install
mime-support					install
mount						install
multiarch-support				install
nano						install
ncurses-base					install
ncurses-bin					install
netbase						install
netcat						install
netcat-traditional				install
openssl						install
os-prober					install
passwd						install
perl						install
perl-base					install
perl-modules-5.24				install
php-cgi						install
php-common					install
php-intl					install
php-sqlite3					install
php-xml						install
php7.0-cgi					install
php7.0-cli					install
php7.0-common					install
php7.0-intl					install
php7.0-json					install
php7.0-opcache					install
php7.0-readline					install
php7.0-sqlite3					install
php7.0-xml					install
pinentry-curses					install
procps						install
psmisc						install
readline-common					install
rsyslog						install
sed						install
sensible-utils					install
sqlite3						install
sudo						install
systemd						install
systemd-sysv					install
sysvinit-utils					install
tar						install
tzdata						install
ucf						install
udev						install
unzip						install
util-linux					install
whiptail					install
xkb-data					install
xxd						install
zlib1g:i386					install

TygerTung
Posts: 27
Joined: 2020-08-03 17:00

Re: How to reduce the size of the installation?

#29 Post by TygerTung »

OK great, I got it down to 51% of the disk. Still seems big for a terminal only system but never mind.

Code: Select all

Filesystem      Size  Used Avail Use% Mounted on
udev            944M     0  944M   0% /dev
tmpfs           190M  2.9M  187M   2% /run
/dev/sda1       945M  467M  462M  51% /
tmpfs           947M     0  947M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           947M     0  947M   0% /sys/fs/cgroup
Installing pi-hole now.... I had to leave wget and install ca-certificates, but can remove post pi-hole install.

Post install and removing those excess packages...

Code: Select all

Filesystem      Size  Used Avail Use% Mounted on
udev            944M     0  944M   0% /dev
tmpfs           190M  2.9M  187M   2% /run
/dev/sda1       945M  656M  273M  71% /
tmpfs           947M   48K  947M   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           947M     0  947M   0% /sys/fs/cgroup
71% is pretty good, that leaves 29% for data-logging and headroom.

TygerTung
Posts: 27
Joined: 2020-08-03 17:00

Re: How to reduce the size of the installation?

#30 Post by TygerTung »

Unfortunately that quickly got used up, updating the lists on the pihole got me up to 100% disk usage which is a problem. I think I need to re-install again and work out a way to have the base system on the internal drive and then the programmes like pi-hole installed on this (slow) usb flash drive I have.

Deb-fan
Posts: 1047
Joined: 2012-08-14 12:27
Been thanked: 4 times

Re: How to reduce the size of the installation?

#31 Post by Deb-fan »

Cool stuff, meant to mention choice of filesystem perhaps, btrfs = onthefly de/compression don't know what kind of processor you're working with on the box. Compression has to mean being able to cram more data in x-amount of space. Verses ext4 or whatever with its tendency to reserve part of available disk space. Also tend towards doubting it'll get you there. This pi-hole thing ate 500mbs like that, yowza? Still rooting for you. :)
Most powerful FREE tech-support tool on the planet * HERE. *

TygerTung
Posts: 27
Joined: 2020-08-03 17:00

Re: How to reduce the size of the installation?

#32 Post by TygerTung »

It has a duel core 1 GHz VIA Eden so pretty powerful, considering what it has to do, i.e. not much. boots real quick into the terminal.

I'll try the file system you mentioned. I think if I am really careful about installing block lists I might be alright. If I get real desperate I can not install the web interface, but it would be a real pain not to have it.

brian_p
Posts: 196
Joined: 2015-11-05 10:32
Has thanked: 1 time
Been thanked: 5 times

Re: How to reduce the size of the installation?

#33 Post by brian_p »

OK great, I got it down to 51% of the disk. Still seems big for a terminal only system but never mind.
This is just about the minimum that Debian reckons is required for a functioning Debian system. From now on you would just be tinkering round the edges. For example, install and use deborphan and do

Code: Select all

apt --purge autoremove.
I don't need to add any users for example, so maybe I could remove adduser?
Try it! ifupdown depends on adduser; you wouldn't want that removed too. (Warning: take note of the scary message).

pi-hole appears to want about 60M minimum. You are going to have to make decisions on what you install and how to manage it now and in the future. That means more reinstallations and becoming more familiar with how pi-hole works. As I said, it looks doable to me but I have no idea how pi-hole functions. These lists? What are they? Are they essential?
--
Brian.

brian_p
Posts: 196
Joined: 2015-11-05 10:32
Has thanked: 1 time
Been thanked: 5 times

Re: How to reduce the size of the installation?

#34 Post by brian_p »

I think I need to re-install again and work out a way to have the base system on the internal drive and then the programmes like pi-hole installed on this (slow) usb flash drive I have.
An expert install would allow you to partition and put /usr on the flash drive. I do wonder whether speed is of the essence with pi-hole?
--
Brian.

brian_p
Posts: 196
Joined: 2015-11-05 10:32
Has thanked: 1 time
Been thanked: 5 times

Re: How to reduce the size of the installation?

#35 Post by brian_p »

I said:
From now on you would just be tinkering round the edges.
Well, perhaps not - I forgot about the kernel modules in /lib.

Code: Select all

du -h
tells me they use about 150M. Will I ever use all those wireless and sound drivers?
--
Brian.

TygerTung
Posts: 27
Joined: 2020-08-03 17:00

Re: How to reduce the size of the installation?

#36 Post by TygerTung »

I've reinstalled using btrfs and thinned it out again.

However I am having a problem with drive space. Even though the drive should be about 976 MB it is only assigning me much 684 MB so even though I have only got 486 MB used, it is saying my drive is 72% full. I think that maybe it is assigning a whole lot of space to swap or temporary drives?! I don't know how to control it. At least with the Ext4 I was able to assign no swap and no reserved blocks.

Also I don't know how to turn the compression on. I'm not sure if it is on by default.

Code: Select all

Filesystem      Size  Used Avail Use% Mounted on
udev            944M     0  944M   0% /dev
tmpfs           190M  2.9M  187M   2% /run
/dev/sda1       976M  486M  198M  72% /
tmpfs           947M     0  947M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           947M     0  947M   0% /sys/fs/cgroup
With regard to the kernel modules, it is hard to know which ones I can remove. I don't need any wireless or sound drivers, or many other drivers at all really. I don't think I can delete the whole folder or anything though.

Deb-fan
Posts: 1047
Joined: 2012-08-14 12:27
Been thanked: 4 times

Re: How to reduce the size of the installation?

#37 Post by Deb-fan »

Would have to read the docs and google as needed for btrfs and on removing unused kernel modules. Been a long while since ive had a real interest in obsessively trimming down a nix OS and sub-1gb is pretty dang extreme. Getting to the point you have you're doing pretty dang good.

Btw: Amount of space reserved on ext4 can be tuned, stuff like https://duckduckgo.com/?q=reduce+reserv ... =h_&ia=web . Five percent is still 5% = 50mbs, if every mb counts, clearly +1 Brian's observation/suggestion too. If you havent already, remember i used to get rid of unused locales and at that time doing so freed up a decent enough chunk.
Most powerful FREE tech-support tool on the planet * HERE. *

Deb-fan
Posts: 1047
Joined: 2012-08-14 12:27
Been thanked: 4 times

Re: How to reduce the size of the installation?

#38 Post by Deb-fan »

Btw2: With absolute min installed locales o course dont matter here, still popped into head, out keyboard. :P Honestly btrfs is just muddying the water too, though its de/compression features could be made to be a benefit, its still overkill and if anything again might consider tuning ext4, a simpler filesystem vs more complex type. Pretty much hit end-of-line as to what to suggest. Well one more.. choice of init, am sure many with the goal of embedded gnu/nix may go with something like SysV or runit or other, other than systemd and remember reading it can be trimmed itself. Was a good choice jettisoning grub for something simpler. Cool. :)

All these things add complexity + in terms of learning curve. If someone wants to learn about setting up alternative init's, deal with init scripts, run levels etc. Never bothered studying embedded nix to any great extent and at this time still have no great interest. Being limited to 1gb of disk space is well into embedded gnu/nix territory in my view, crap the dirt cheap Android phone im typing on has 8gbs. :) Still imo, you're doing well and its an interesting project. You've bound to have learned some good Nixology while doing all this. :)
Most powerful FREE tech-support tool on the planet * HERE. *

TygerTung
Posts: 27
Joined: 2020-08-03 17:00

Re: How to reduce the size of the installation?

#39 Post by TygerTung »

Well after doing a lot more research I have managed to enable the compression on the BTRFS scheme. It made a massive difference!

Code: Select all

root@debian:/# btrfs filesystem df /
Data, single: total=626.50MiB, used=212.85MiB
System, DUP: total=8.00MiB, used=16.00KiB
Metadata, DUP: total=160.75MiB, used=16.34MiB
GlobalReserve, single: total=16.00MiB, used=0.00B
root@debian:/# btrfs filesystem usage /
Overall:
    Device size:		 976.00MiB
    Device allocated:		 964.00MiB
    Device unallocated:		  12.00MiB
    Device missing:		     0.00B
    Used:			 245.57MiB
    Free (estimated):		 413.65MiB	(min: 413.65MiB)
    Data ratio:			      1.00
    Metadata ratio:		      2.00
    Global reserve:		  16.00MiB	(used: 0.00B)
Got down to maybe 245 MB used, although the file system seems to allocate 160 MB to metadata for some reason which seems too much. It is a bit of a complicated file system. I think it allocates data between the data and metadata though so might not be too bad. Even if a bit of space is lost, the compression is so good that it more than makes up for it.

Post Pi-hole install and adding to the blocklist database (now have 269093 domains blocked, that should be quite a few bytes just there), there is still oodles of space on the drive!:

Code: Select all

root@debian:/home/sam# btrfs filesystem df /
Data, single: total=448.00MiB, used=396.45MiB
System, DUP: total=5.50MiB, used=16.00KiB
Metadata, DUP: total=48.75MiB, used=21.06MiB
GlobalReserve, single: total=16.00MiB, used=0.00B
root@debian:/home/sam# btrfs filesystem usage /
Overall:
    Device size:		 976.00MiB
    Device allocated:		 556.50MiB
    Device unallocated:		 419.50MiB
    Device missing:		     0.00B
    Used:			 438.61MiB
    Free (estimated):		 471.05MiB	(min: 261.30MiB)
    Data ratio:			      1.00
    Metadata ratio:		      2.00
    Global reserve:		  16.00MiB	(used: 0.00B)

Data,single: Size:448.00MiB, Used:396.45MiB
   /dev/sda1	 448.00MiB

Metadata,DUP: Size:48.75MiB, Used:21.06MiB
   /dev/sda1	  97.50MiB

System,DUP: Size:5.50MiB, Used:16.00KiB
   /dev/sda1	  11.00MiB

Unallocated:
   /dev/sda1	 419.50MiB
brtfs is a pretty weird file system and it is quite hard to actually know how much free space is avaliable, there is quite a large quantity of commands to query it and I think you have to just guess.

The machine still runs lightning fast and boots really quickly as it is so powerful.

Memory usage: 2.4 % so plenty of headroom on the RAM front and there seems to still be plenty of room on the hard drive too.
With btrfs it seems that I can add a second drive and set it behave as one volume, so I can do that if I run out of space on the 1 GB drive. I think it is not going to be a very good to use a cheap no brand USB flash drive as a hard drive so I wish to avoid doing this if possible.

Anyway, happy days.
https://www.youtube.com/watch?v=gqsT4xnKZPg

TygerTung
Posts: 27
Joined: 2020-08-03 17:00

Re: How to reduce the size of the installation?

#40 Post by TygerTung »

For something real easy to see, here is the "df -h" command (not accurate on btrfs)

Code: Select all

root@debian:/home/sam# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            944M     0  944M   0% /dev
tmpfs           190M  2.9M  187M   2% /run
/dev/sda1       976M  455M  471M  50% /
tmpfs           947M  252K  947M   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           947M     0  947M   0% /sys/fs/cgroup
only 50% usage!

Post Reply