Can I delete all these cache files under admin:///var/lib/snapd/cache?

enter image description here

Also, when I double click on one of them it says this:
enter image description here
What is "squashfs filesystem image" and what is it doing in the cache folder?

Asked By: Galaxium

||

Generally from an operating system point of view, /var/lib/* are files belonging to installed software. The rules for whether you can delete those files without problems are specific to that installed software, but it’s not like /var/cache where it is generally regarded safe to clear it.

Regarding snapd specifically, it is safe to clear the files in its cache, though I would take care to do so while it is not running, and I’d reconsider whether you need to do it at all, as it is generally helpful for the smooth operation of snapd to have that information (you can, instead, remove old snaps with –purge).

It should be noted that snapd minimises the disk utilization by making extensive use of both compression and hard links. Hard links, in particular, can make things look bigger on disk than the actual space they are taking up, depending on whether the tool you’re using to browse the files are aware of hard links.

The other part of your question was, what is a squashfs filesystem. It is a type of filesystem that is compressed, and you can mount it read-only while it remains in its compressed state. It’s relatively good in terms of performance, but you can never mount it to be writable, because of the compression which does not leave any room for modifications in-place, so to use it read-write you would often mount an overlay filesystem over the top of it.

Think of it like a zip file – it’s compressed and contains a whole filesystem – though unlike zip it’s intended to be able to be mounted so that you can use it transparently like another filesystem. This would be difficult with zip because in zip you can’t randomly access part of a large file without decompressing the whole file.

The squashfs files are central to the way snapd works but there is no need or use for you to mount them yourself to look in them.

Answered By: thomasrutter
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.