You are not logged in.

#1 2014-08-08 15:09:39

swordfeng
Member
Registered: 2014-07-24
Posts: 19

[SOLVED]blkid cannot detect exfat partitions

[root@swordfeng-PC ~]# blkid /dev/sdb1
[root@swordfeng-PC ~]# busybox blkid /dev/sdb1
/dev/sdb1: UUID="8B76-4A2B" TYPE="exfat"

The busybox blkid can find my exfat partition on my USB disk, but the blkid of my system gives nothing.
Therefore, I am not able to automount the exfat USB, as it detects filesystems by libblkid or `blkid -o udev`.

It seems that the filesystem bits were not correctly set.I used wipefs and it can discover udf now.Still having problems with exfat.

Last edited by swordfeng (2014-08-09 14:34:30)

Offline

#2 2014-08-09 14:34:02

swordfeng
Member
Registered: 2014-07-24
Posts: 19

Re: [SOLVED]blkid cannot detect exfat partitions

Finally I solved it by myself, using some stupid tricks.
I found that I could overwrite udev info, and then the udisks2 worked.
I added a udev rule

# /etc/udev/rules.d/99-exfat.rules
KERNEL=="sd[a-z][1-9]*", ACTION=="add", ENV{ID_FS_TYPE}=="", IMPORT{program}="/bin/blkexfat.sh /dev/%k", SYMLINK+="disk/by-uuid/%E{ID_FS_UUID}"
KERNEL=="sd[a-z][1-9]*", ACTION=="add", ENV{ID_FS_TYPE}=="exfat", ENV{ID_FS_LABEL}!="", SYMLINK+="disk/by-label/%E{ID_FS_LABEL}"
KERNEL=="sd[a-z][1-9]*", ACTION=="change", ENV{ID_FS_TYPE}=="exfat", IMPORT{program}="/bin/blkexfat.sh /dev/%k"

The script blkexfat.sh makes an emulated output like blkid -o udev:

/usr/bin/blkexfat.sh
------------------------------------
#!/bin/sh

fstype=$(busybox blkid $1 | grep exfat -o)
if [ "$fstype" = "exfat" ];then
  echo ID_FS_TYPE=exfat
  echo ID_FS_USAGE=filesystem
  label=$(exfatlabel $1)
  if [ "$label" != "" ];then
    echo ID_FS_LABEL=$label
    echo ID_FS_LABEL_ENC=$label
  fi
  uuid=$(busybox blkid /dev/sdb1 | grep -E UUID=\[\[:graph:\]\]\* -o | grep -E \=.\* -o | grep -E \[0-9A-F\-\]\* -o)
  echo ID_FS_UUID=$uuid
  echo ID_FS_UUID_ENC=$uuid
fi

Then it is all right except blkid /dev/sdb1 still puts out nothing.

Last edited by swordfeng (2014-08-09 14:36:48)

Offline

Board footer

Powered by FluxBB