2

I have a Raspberry Pi 2 and want to automount a USB drive on startup while using an external HDD as root filesystem (see the post on Raspberry Pi StackExchange for further information).

Among others I tried to mount it by UUID but while blkid returns

/dev/sda1: LABEL="GIT" UUID="3a20b6ab-f7cb-44a4-9437-23b8ba33fef2" TYPE="ext4"

/dev/disk/by-uuid contains the following

lrwxrwxrwx 1 root root 10 Jan  1  1970 66a72c4f-1a9b-47ad-99b7-3040ab1f79f6 -> ../../sda1

I already tried to change the UUID of my USB drive by using tune2fs /dev/{device} -U {uuid} but to no avail.

So, how could it be that blkid and /dev/disk/by-uuid return different UUIDS for my USB drive and how can I fix it?

  • Maybe try running partprobe and/or hdparm -z to make sure your kernel is in sync with the disk. Also maybe udevadm trigger. Not saying these will fix your problem, but then at least we can rule out some weird transient condition. – user3188445 Aug 18 '15 at 6:20
  • Also, what does dumpe2fs /dev/sda1 report for the UUID? – user3188445 Aug 18 '15 at 6:21
  • I ran all commands. Still no change. dumpe2fs reports the same UUID as /dev/disk/by-uuid – Kagemusha Aug 18 '15 at 6:45
3

Given what dumpe2fs is reporting, it must be the case that blkid is wrong and the others are correct. This isn't so surprising because blkid maintains a cache. If you run blkid -g or blkid -p /dev/sda1 as root it will probably bypass or fix the cache and agree with the other two results. You can also blow away the cache file, which is often in /run/blkid/blkid.tab.

  • Or just have blkid read the cache from /dev/null: blkid -c /dev/null – Dan Moulding May 25 '17 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.