# Find hard drive UUID [SOLVED]

## count_zero

Anyone know how I can extract the uuid of my usb hard drives?  I have an external enclosure that holds two SATA drives.  I need a command to find the UUID so I can use it in a udev rule.

```
scsi_id -g -u --device=/dev/sdc1

```

gives me nothing.

I know the system is getting the UUID from somewhere, because I can see the UUID in /dev/disk/by-uuid/

```
ls -l /dev/disk/by-uuid | grep sdc1

lrwxrwxrwx 1 root root 10 Mar  7 22:23 342bf013-c044-4f70-9c1a-f1baeb1aa721 -> ../../sdc1
```

Anyone have an idea?

----------

## chiefbag

The command below works for me, I have tested it on a pen drive also

 *Quote:*   

> ls -l /dev/disk/by-uuid

 

[Edit] I suppose thats not the answer you are looking for  :Confused: 

----------

## sebaro

```
/sbin/udevadm info --query=all --name=/dev/sdc1 | grep UUID
```

----------

## kite14

```
# blkid /dev/sdb3

/dev/sdb3: UUID="126c2e59-c4b2-4dfa-8aa6-30c74ba46058" TYPE="reiserfs" 
```

/sbin/blkid is part of sys-apps/util-linux

----------

## chiefbag

What do you need the udev rule for as a matter of interest?

Can you not just add a rule to your /etc/fstab to mount them by UUID

```
vi /etc/fstab

UUID=342bf013-c044-4f70-9c1a-f1baeb1aa721 /mnt/new_drive    ext3    relatime,errors=remount-ro 0       1
```

----------

## count_zero

 *sebaro wrote:*   

> 
> 
> ```
> /sbin/udevadm info --query=all --name=/dev/sdc1 | grep UUID
> ```
> ...

 

Ah, this did it.

Thanks!   :Very Happy: 

----------

