LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-11-2008, 12:41 PM   #1
Jayla
Member
 
Registered: Nov 2005
Location: Suffolk, UK
Distribution: kubuntu 9.04
Posts: 188

Rep: Reputation: 30
[Ubuntu] how to find a hard disks UUID


Hi

I've just plugged in two new hard drives, and I need to add entries for them in /etc/fstab

I'd really like to follow suit an use UUIDs in the fstab, but I cant seem to find a command to find their UUID?

I have done it once before, but cannot find a link to where I found that information, can anyone please help?

Regards
 
Old 05-11-2008, 12:47 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

As root: udevinfo -q -n /dev/sdc2

The UUID will be somewhere in the output.
Change sdc2 into an appropriate value for your device.

Hope this helps.
 
Old 05-11-2008, 12:49 PM   #3
Jayla
Member
 
Registered: Nov 2005
Location: Suffolk, UK
Distribution: kubuntu 9.04
Posts: 188

Original Poster
Rep: Reputation: 30
Thanks,

I've just tried that and getting an "unknown command query" back

Regards
 
Old 05-11-2008, 12:55 PM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Sorry, my mistake (although you could have found it in the manpage). It should be:

udevinfo -q all -n /dev/sdc2

 
Old 05-11-2008, 01:03 PM   #5
Jayla
Member
 
Registered: Nov 2005
Location: Suffolk, UK
Distribution: kubuntu 9.04
Posts: 188

Original Poster
Rep: Reputation: 30
hmm I can see two types of IDs an not sure which is the correct one

is there a good GUI tool I can use? I have tried gparted but there doesnt seem to be a "mount to" option
 
Old 05-11-2008, 01:15 PM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

What is the actuall output of the udevinfo command?

Example:
Code:
udevinfo -q all -n /dev/sdc2
P: /block/sdc/sdc2
N: sdc2
S: disk/by-id/ieee1394-00d04b810a08fd05:0:0-part2
S: disk/by-path/pci-0000:10:0b.0-ieee1394-0x00d04b810a08fd05:0:0-part2
S: disk/by-uuid/903f74d8-cc39-42d1-86b9-36c4846288ff
E: ID_SERIAL=00d04b810a08fd05:0:0
E: ID_BUS=ieee1394
E: ID_PATH=pci-0000:10:0b.0-ieee1394-0x00d04b810a08fd05:0:0
E: ID_FS_USAGE=filesystem
E: ID_FS_TYPE=ext3
E: ID_FS_VERSION=1.0
E: ID_FS_UUID=903f74d8-cc39-42d1-86b9-36c4846288ff
E: ID_FS_LABEL=
E: ID_FS_LABEL_SAFE=
The bold parts both show the UUID.

I don't use GUI's for these things, so I cannot point you to one.
 
Old 05-11-2008, 01:21 PM   #7
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Just remembered:

/lib/udev/vol_id -u /dev/sdc2

sdc2 should reflect your device.
 
Old 05-11-2008, 01:28 PM   #8
Jayla
Member
 
Registered: Nov 2005
Location: Suffolk, UK
Distribution: kubuntu 9.04
Posts: 188

Original Poster
Rep: Reputation: 30
Thanks druuna

Just found an awesome tutorial (doesnt include UUIDs, but I guess I can alter that later)

for future reference..

http://www.psychocats.net/ubuntu/mountlinux

Regards
 
Old 05-11-2008, 01:29 PM   #9
Jayla
Member
 
Registered: Nov 2005
Location: Suffolk, UK
Distribution: kubuntu 9.04
Posts: 188

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by druuna View Post
Hi,

What is the actuall output of the udevinfo command?

Code:
jimmy@nevada:~$ sudo udevinfo -q all -n /dev/sda
P: /block/sda
N: sda
S: disk/by-id/scsi-1ATA_ST310211A_7DB1D6ZX
S: disk/by-id/ata-ST310211A_7DB1D6ZX
S: disk/by-path/pci-0000:00:0d.0-scsi-0:0:0:0
E: DEVTYPE=disk
E: ID_VENDOR=ATA
E: ID_MODEL=ST310211A
E: ID_REVISION=3.54
E: ID_SERIAL=1ATA_ST310211A_7DB1D6ZX
E: ID_SERIAL_SHORT=ATA_ST310211A_7DB1D6ZX
E: ID_TYPE=disk
E: ID_BUS=scsi
E: ID_ATA_COMPAT=ST310211A_7DB1D6ZX
E: ID_PATH=pci-0000:00:0d.0-scsi-0:0:0:0
 
Old 05-11-2008, 01:54 PM   #10
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

The command you used doesn't give the UUID because your are asking information for the raw disk (/dev/sda)

/dev/sda -> Your HD. The raw container, nothing more.

/dev/sda1 -> A partition with a filesystem on it.
/dev/sda2 -> A partition with a filesystem on it.
.
.
.

You need the /dev/sda[number] part. or parts if you have more partitions on that disk.

After the disk is formatted(!), this should give you the UUID info:

/lib/udev/vol_id -u /dev/sda1

If you have more partitions (or /dev/sda1 is swap space), repeat with 2 3 4 etc.

BTW: Everytime you reformat a partition, the UUID changes. Most people format only once, so it should not be a problem.

Hope this clears things up a bit.
 
Old 05-12-2008, 09:58 AM   #11
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Have you tried:

Code:
bash-3.1$ /sbin/blkid
/dev/hda1: UUID="4ec801af-e521-4ad4-ac24-28e33e084fca" TYPE="jfs" 
/dev/hda2: UUID="1928f341-9591-436d-94de-500df05a291b" TYPE="swap" 
/dev/hdc: LABEL="NOD95" TYPE="iso9660" 
/dev/loop0: LABEL="SIMBRYO" TYPE="iso9660"
You need a GUI for this ... my goodness, I'm speechless. Do you need a GUI for everything. Do you realize how bloated your computer would be if you did ?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ubuntu Studio UUID versus /dev/sdaxx NicholasA Ubuntu 2 08-04-2007 02:53 PM
UUID: wrong values in Ubuntu /etc/fstab files grautu Ubuntu 7 05-05-2007 04:28 PM
How many Hard disks ? BizHat.com Linux - Software 5 01-18-2005 07:38 PM
Problem installing jfsutils-1.1.7, cannot find uuid library kit_johnson Linux - Software 1 11-30-2004 08:07 AM
2 Hard Disks and 2 OS? How to? nbn792 Linux - General 5 12-26-2003 07:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration