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:

/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:

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:

#20220619 a replacement for the old guess_fstype
[ ! "$PART" ] && exit
[ "${PART:0:5}" != "/dev/" ] && exit
FS="$(blkid $PART | tr ' ' '\n' | grep '^TYPE' | cut -f 2 -d '"')"
[ ! "$FS" ] && FS='unknown'
echo "$FS" far as I can recall, that will work the same as the old guess_fstype.   

Tags: easy