# Can't mount USB device by label or uuid

## fearofcarpet

I have an external USB hard drive that I would like to mount during boot, when connected. I generally do this by making a bash script that checks to see if it is mounted and then mounts it by UUID if it is not. Recently, however, Gentoo says:

```
mount: special device /dev/sdd1 does not exist
```

 when I mount by UUID or by LABEL. This is because the device is actually /dev/sde1. What is going on here?  

```
$ls /dev/disk/by-uuid/ -l

total 0

lrwxrwxrwx 1 root root 10 Aug 24 08:04 13d8794b-f1a2-4b60-99c4-28fd8d94120f -> ../../sda2

lrwxrwxrwx 1 root root 10 Aug 24 08:04 436478bc-bc3c-424c-942e-74176ce3cd3c -> ../../sda4

lrwxrwxrwx 1 root root 10 Aug 24 08:04 D61037F41037DA67 -> ../../sda3

lrwxrwxrwx 1 root root 10 Aug 24 08:04 D6148A031489E6B9 -> ../../sdc1

lrwxrwxrwx 1 root root 10 Aug 24 08:04 b348aed1-0b45-4aa9-b131-043b8f79e559 -> ../../sde1

lrwxrwxrwx 1 root root 10 Aug 24 08:04 c2e0a53a-8067-42be-83f2-c1bc1b4fdc1a -> ../../sdb1

lrwxrwxrwx 1 root root 10 Aug 24 08:04 cf9ed134-430b-46bd-8f25-eedaa66e84ea -> ../../sda1

$ls -l /dev/disk/by-label/

total 0

lrwxrwxrwx 1 root root 10 Aug 24 08:04 Games -> ../../sda3

lrwxrwxrwx 1 root root 10 Aug 24 08:04 home -> ../../sdb1

lrwxrwxrwx 1 root root 10 Aug 24 08:04 homemirror -> ../../sde1

lrwxrwxrwx 1 root root 10 Aug 24 08:04 root -> ../../sda2
```

 Yet, 

```
$mount -U b348aed1-0b45-4aa9-b131-043b8f79e559 /mnt/homemirror/

mount: special device /dev/sdd1 does not exist

$mount -L homemirror /mnt/homemirror/

mount: special device /dev/sdd1 does not exist
```

  And 

```
$fdisk -l

Disk /dev/sde: 1000.2 GB, 1000204886016 bytes

255 heads, 63 sectors/track, 121601 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x44fdfe06

   Device Boot      Start         End      Blocks   Id  System

/dev/sde1               1      121601   976760001   83  Linux
```

 Is there something I'm missing here? 

I can, FYI, mount it with "mount /dev/sde1 /mnt/homemirror", but of course it isn't always at sde1 which is why I want to be able to mount it by UUID...

For the time being I'm just using 

```
$mount /dev/disk/by-label/homemirror /mnt/homemirror/
```

 This, however, is annoying un-Gentoo.

----------

## el-chaote

I guess you're using udev. So why not writing a udev rule? Have a look here and here.

I've got two of them. Now, my external HD  always has the symlink /dev/myHD and my ipod /dev/ipod.  :Very Happy: 

----------

## fearofcarpet

I use udev rules to customize devices like MP3 players as well, but this problem is in using the '-U' and '-L' switches in mount. I'm as curious to learn how it is possible for mount -U to point somewhere else than /dev/disk/by-uuid as I am annoyed that it isn't working properly.

----------

## boyzonder

fearofcarpet, I might have a problem somewhat related to yours. I have an external USB disk with two partitions. The first one is an ext3 partition with label 'Helter', the second an xfs partition with label 'Skelter' (yeah, I like The Beatles   :Very Happy:  ). I have the following /etc/fstab entries:

```
  LABEL=Helter       /mnt/helter      ext3      noatime,auto            0 0

  LABEL=Skelter      /mnt/skelter     xfs       noatime,auto            0 0

```

Both mountpoint (/mnt/helter and /jet) exist. I have the following udev rule, which says that 'mount -a', which attempts to mount all devices with the 'auto' option set, should be run after a block device is inserted:

```
  SUBSYSTEM=="block", run+="/bin/mount -a"

```

When I turn on the USB disk, the weird thing is that the 'Skelter' partition (/dev/sdb2) gets mounted, but the 'Helter' partition (/dev/sdb1) not! I also can't mount 'Helter' by doing 'mount -L Helter' or 'mount /mnt/helter', because these commands give the following result:

```
  mount: special device LABEL=Helter does not exist

```

Doing 'ls -l /dev/disk/by-label/' outputs the following (expected) info:

```
  lrwxrwxrwx 1 root root 10 2008-09-20 22:25 Helter -> ../../sdb1

  lrwxrwxrwx 1 root root 10 2008-09-20 22:25 Skelter -> ../../sdb2

```

Now funnily enough, when I mount /dev/sdb1 by hand, either by doing 'mount /dev/sdb1 /mnt/helter' or even doing 'mount /dev/disk/by-label/Helter', the partition gets mounted. But even stranger, when I then do 'umount /mnt/helter' and then do 'mount -L Helter' it suddenly works!

The same goes for mounting by UUID: It doesn't work until after /dev/sdb1 has been mounted by hand. Anybody have a clue?

EDIT:

Right after this post I decided to search around the forum a bit, and found some related issues which were caused by an invald /etc/blkid.tab. Read the bug report at https://bugs.gentoo.org/show_bug.cgi?id=225669 for more detail. I fixed the issue by specifying in the udev rules  that /etc/blkid.tab should be regenerated after each 'block' event.

```
  SUBSYSTEM=="block", run+="/sbin/blkid -w /etc/blkid.tab"

  SUBSYSTEM=="block", run+="/bin/mount -a"

```

----------

## jamapii

I downgraded e2fsprogs, ss, com_err to 1.40.8 to make this work (some weeks or months ago)

---

 *boyzonder wrote:*   

> https://bugs.gentoo.org/show_bug.cgi?id=225669

 

The bug says it's fixed for 1.41, its links say it's broken in debian's 1.40.5-2, my tests say it's broken in 1.40.>=9

From 1.41 rewlease notes:   *Quote:*   

> Fix blkid handling of stale devices. Fix a bug which could cause a core dump while garbage collecting the blkid cache, and assure that blkid_find_dev_with_tag() never returns a non-existent device. Also, if a filesystem is found at a new /dev location, eliminate any duplicate stale entries which can not be verified. (Addresses-Debian-Bugs: #487758, #487783)

 

OK, I'll try it ... --- it works! for 1.41.2

----------

