Find disk free space without Snap drives

Disk free space df in Ubuntu gets clogged with all the Snap drives. Old versions of Snaps are retained, which makes the list grow longer and longer over time.

Fix

Listing only actual hard drive partitions can be done a couple different ways.

Find only Ext4 and FUSE drives, like exFAT:

df -hT | grep -E "ext4|fuseblk"

It’s often preferable to use this method: exclude tmpfs and snap virtual drives:

df -hT | grep -vE "squashfs|tmpfs"

cleanup old Snap versions

As snap packages update, old versions are left behind. Find snap packages with multiple versions by examining output of:

df -t squashfs | sort -k6

say you see that /snap/slack/6 and /snap/slack/7 are installed. Remove the old version by (NOT using sudo)

snap remove slack --revision=6

Find drive types

df -T

Tags: ,

Categories:

Written by Michael Hirsch, Ph.D. //

Comments