USB disk's UUID changing?!


3 posts
by rspi » Thu Mar 14, 2013 3:15 pm
I'm trying to add an entry to /etc/fstab so that a USB hard disk is mounted each boot.

The problem is that when I use
Code: Select all
sudo blkid
to get the UUID, and add it to
Code: Select all
fstab
in the standard way (i.e.
Code: Select all
UUID=xx
), the next time I boot I get a message saying the UUID wasn't recognised and the disk can't be mounted.

When I use blkid to check, I find the UUID of the disk is completely different. I haven't done anything to the disk in-between times — not even unplugged it!

Am I missing something important? I thought UUIDs were supposed to be, well, unique identifiers.
Posts: 8
Joined: Thu Mar 14, 2013 3:08 pm
by FTrevorGowen » Thu Mar 14, 2013 5:46 pm
Hi rspi, I've never used the "blkid" command to get a disk's UUID - my approach is outlined within my webpages at http://www.cpmspectrepi.webspace.virgin ... ticks.html . The only times I've known a UUID to change is when a (flash)disk is re-formatted and/or partioned (sometimes the UUID is that of the partition) or (under Windows XP) when the partition has been "repaired" by checkdisk (this "screwed-up" dual-booting of my netbook when I'd resized some partitions to make more room for, what was then, Ubuntu Netbook edition.
Hope that's of some help).
Trev.
Mainly running "Wheezy Raspbian" on seven Pi's (an A, B1, 2xB2, 2xB+ and an A+). Notes about them begin at http://www.cpmspectrepi.webspace.virginmedia.com/raspberry_pi/raspiidx.htm
User avatar
Forum Moderator
Forum Moderator
Posts: 2033
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
by rspi » Fri Mar 15, 2013 2:06 pm
Hi Trevor, thanks for the link!

I just tried it again with a fresh install and both blkid and your method of viewing /dev/disk/by-uuid reported the same values.

When I edited fstab and rebooted, everything worked fine.

This time around, however, I rebooted after formatting the new USB disk. I think this helped because I suspect I was seeing an older cached value for the disk that related to the old partition on the disk.

The moral of the story: If adding a new disk to the system and reformatting it, reboot before attempting to find out the UUID to add to /etc/fstab.
Posts: 8
Joined: Thu Mar 14, 2013 3:08 pm