site  contact  subhomenews

guess_fstype symlink removed

June 19, 2022 — BarryK

It was drawn to my attention yesterday, a post from Berto, that guess-fstype failed:

https://forum.puppylinux.com/viewtopic.php?p=60034#p60034

/bin/guess_fstype is a symlink to /bin/busybox. That symlink should not be there. guess_fstype was deprecated a very long time ago.

It goes back to 2008, or thereabouts, Jesse, a forum member back then, created 'guess_fstype', written in C. You gave it the partition name on the commandline, and it returned the filesystem in that partition, for example "ext2".

That original utility was buggy, so circa-2015, James (jamesbond in the forum), rewrote it as a patch for busybox. I reported on that in my blog:

https://bkhome.org/news/201511/busybox-1241-with-guessfstype.html

However, it doesn't do anything new, that the busybox 'blkid' utility does, so I stopped applying the patch many years ago.

However, as I discovered yesterday, the /bin/guess_fstype symlink is still in the busybox PET package. So, have removed it.

I suppose we could create a script /bin/guess_fstype, that calls 'blkid' and returns the filesystem type.  To support old PETs, such as grub2config that Berto was trying to use. Yeah, why not, have created /bin/guess_fstype:

#!/bin/ash
#20220619 a replacement for the old guess_fstype
PART="$1"
[ ! "$PART" ] && exit
[ "${PART:0:5}" != "/dev/" ] && exit
FS="$(blkid $PART | tr ' ' '\n' | grep '^TYPE' | cut -f 2 -d '"')"
[ ! "$FS" ] && FS='unknown'
echo "$FS"

...as far as I can recall, that will work the same as the old guess_fstype.   

Tags: easy