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
Welcome to
LinuxQuestions.org , a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free.
Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please
contact us . If you need to reset your password,
click here .
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
05-11-2008, 12:41 PM
#1
Member
Registered: Nov 2005
Location: Suffolk, UK
Distribution: kubuntu 9.04
Posts: 188
Rep:
[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
05-11-2008, 12:47 PM
#2
LQ Veteran
Registered: Sep 2003
Location: the Netherlands
Distribution: lfs, debian, rhel
Posts: 7,514
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.
05-11-2008, 12:49 PM
#3
Member
Registered: Nov 2005
Location: Suffolk, UK
Distribution: kubuntu 9.04
Posts: 188
Original Poster
Rep:
Thanks,
I've just tried that and getting an "unknown command query" back
Regards
05-11-2008, 12:55 PM
#4
LQ Veteran
Registered: Sep 2003
Location: the Netherlands
Distribution: lfs, debian, rhel
Posts: 7,514
Hi,
Sorry, my mistake (although you could have found it in the manpage). It should be:
udevinfo -q
all -n /dev/sdc2
05-11-2008, 01:03 PM
#5
Member
Registered: Nov 2005
Location: Suffolk, UK
Distribution: kubuntu 9.04
Posts: 188
Original Poster
Rep:
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
05-11-2008, 01:15 PM
#6
LQ Veteran
Registered: Sep 2003
Location: the Netherlands
Distribution: lfs, debian, rhel
Posts: 7,514
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.
05-11-2008, 01:21 PM
#7
LQ Veteran
Registered: Sep 2003
Location: the Netherlands
Distribution: lfs, debian, rhel
Posts: 7,514
Hi,
Just remembered:
/lib/udev/vol_id -u /dev/sdc2
sdc2 should reflect your device.
05-11-2008, 01:28 PM
#8
Member
Registered: Nov 2005
Location: Suffolk, UK
Distribution: kubuntu 9.04
Posts: 188
Original Poster
Rep:
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
05-11-2008, 01:29 PM
#9
Member
Registered: Nov 2005
Location: Suffolk, UK
Distribution: kubuntu 9.04
Posts: 188
Original Poster
Rep:
Quote:
Originally Posted by
druuna
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
05-11-2008, 01:54 PM
#10
LQ Veteran
Registered: Sep 2003
Location: the Netherlands
Distribution: lfs, debian, rhel
Posts: 7,514
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.
05-12-2008, 09:58 AM
#11
Guru
Registered: Oct 2005
Posts: 11,388
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 ?
Thread Tools
Search this Thread
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
All times are GMT -5. The time now is 02:55 PM .
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know .
Latest Threads
LQ News