Image of the Raspberry Pi 5

Raspberry Pi 5 Desktop Mini PC: Avoid snap pollution

I’m not a heavy user of snaps particularly on the Raspberry Pi 5. I find that installing software with Flatpak is a better solution than snap in most instances even though both are wasteful of disk space. But occasionally it’s useful to use a snap.

After installing a few snaps, df output gets overridden with /dev/loop entries. Here’s an example.

df output

A snap is a SquashFS file carrying content alongside metadata to tell the system how it should be manipulated.

What’s the easiest remedy to clean up df’s output besides avoiding snaps altogether?

I can exclude squashfs with the -x flag. And use the -h option to make the output human readable.

$ df -hx "squashfs"

Exclude squashfs

Another solution is to use an alternative to df. There are quite a few alternatives to df featured in this roundup. My favourite is dysk which can be installed with cargo, Rust’s package manager. First install cargo.

$ sudo apt install cargo

Now let’s try to build dysk with the command:

$ cargo install dysk

Building dysk fails

dysk fails to build because the version of rustc installed with the Raspberry Pi OS is too old.

It’s suggested re-running cargo install with --locked.

$ cargo install dysk --locked

Build failed with locked option

That didn’t help.

Let’s remove the old version of rustc and cargo we’ve got.

$ sudo apt remove rust cargo

Let’s install the current version of Rust. Issue the command:

$ curl https://sh.rustup.rs -sSf | sh

Install current version of Rust

Select option 1 by pressing enter.

Current version of Rust now installed

I’ve now installed the current version of Rust on my Pi 5.

$ rustc --version

rusc --version

Let’s try compiling dysk again.

$ cargo install dysk

Building dysk with cargo

Success, dysk is now installed on my system.

Issue the command:

$ dysk

Here’s example output from dysk. In my opinion the output is much neater than with df.

dysk output

Let’s go the whole hog and use an alias, so I can just type df. I’m going to use the -s label flag in my alias.

Add the following line to ~/.bashrc using a text editor such as nano.

alias df='dysk -s label'

Log out of the shell or type: $ source .bashrc

Now when I type df, I get the output.

Using an alias

This article was written on a Raspberry Pi 5 (16GB RAM) provided by SunFounder, a company focused on STEAM education with products like Open-source robots, Arduino & Raspberry Pi Kits, display screens, and other smart devices.


All articles in this series:

Raspberry Pi 5 Series
Hardware
iRasptek Starter KitAll the kit you need to get started with the Pi 5
Pironman 5 Case ReviewTransform the Pi 5 into a beautiful desktop mini PC
Passive Cooling the Pi 5Passively cool your Pi 5 the right way. Silent yet cool
BenchmarkingBenchmarking the Pi 5 against an Intel N100 mini PC
OverclockingLet's increase the clock speed of the BCM2712 SoC
Power ConsumptionCompare the power consumption of the Pi 5 with Intel Mini PCs
Configuration
raspi-configUseful text-based tool to configure the Pi 5
PiGroGUI tool that streamlines the process of managing the Pi 5
Increase Swap Memory SizeIncrease the swap size from 512MB to 2GB
ZRAM swapdriveSimple script to use a ZRAM swapdrive instead of a swapfile
Software
Installing SoftwareDifferent ways to install software on the Pi 5
df snap pollutionReplace df with dysk
Many software articles are planned. Stay tuned!
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Please read our Comment FAQ before posting.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments