Grub disk mapping

Can someone help me resolve an issue I'm having when restoring a disk image to a new Hard drive,
the issue is that grub is creating the device mapping for the hard drive as per below line and this points to a model and serial.
(hd0)      /dev/disk/by-id/ata-WDC_WD400BB-23JHC0_WD-WMAMA5669406

Is there a way I could make it a generic mapping like /dev/sda rather then hard drive pacific so when I restore the image grub will load the OS.
atorexAsked:
Who is Participating?
 
rindiCommented:
The Grub menu file should be the only one. It is correct, actually until some years ago that was how grub was normally setup. Today it is usually done using UUID's (a partition ID type of thing) or the way it is done in your case, as that way it won't matter which port the HD is connected to. Using the /dev/sdax way would mean that every time you connect from IDE 0 to IDE2, or SATA 0 to SATA 1, you'd have to change the menu.

I usually use the UUID, and if I change to a cloned or imaged disk, I just change the UUID in the grub menu to reflect the new value.
0
 
rindiCommented:
You could change it to /dev/sda1 for the first disk and first partition, or /dev/sda2 if it is the 2nd partition on the same disk, or /dev/sda5 if it is the first logical partition of the same disk.
0
 
atorexAuthor Commented:
Rindi,
in addition to device.map I will need to change the menu.lst, is there any other file I need to make the change and is what I'm asking  a correct way of resolving my issue?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
atorexAuthor Commented:
Now that's a better option, what is the best way to obtain the UUID for a drive?
I currently have a cloned drive attached to my server so I can make the edit is there a command that will provide the UUID?
0
 
rindiCommented:
I don't remember the command (but yes, there is one). Most of the Linux Distro's I use have gparted or another graphical partitioning tool included. When I check the partition's properties using that tool it's ID is listed, and I then mark it and copy it into the clipboard, so I can paste into into the Grub file.
0
 
JelcinCommented:
the command is "blkid /dev/sdaX"
0
 
atorexAuthor Commented:
by making the change to grub this is how I see it please validate

(hd0)      /dev/disk/by-id/908b1bf7-8d45-4b62-852c-69daffd6cb7a

when I run the blkid of my /dev/sda2 i get 908b1bf7-8d45-4b62-852c-69daffd6cb7a so I just need to insert it as above or as below

(hd0)      /dev/908b1bf7-8d45-4b62-852c-69daffd6cb7a
0
 
rindiCommented:
It would have to be like this:

 Linux      /boot/Kernel-3.0.6.xxxxx   root=UUID=908b1bf7-8d45-4b62-852c-69daffd6cb7a

Where Linux can also be kernel, and you'd have to replace the /boot/kernelxxxxxx with what you have. It can sometimes be differently used, depending on the Distro (my example is from Ubuntu).
0
 
rindiCommented:
One thing I just remembered you would also have to check is the /etc/fstab file.
0
 
atorexAuthor Commented:
I'm using SUSE 11, what I have on the menu.lst is


root (hd0,1)
    kernel /boot/vmlinuz-2.6.32.12-0.7-default root=908b1bf7-8d45-4b62-852c-69daffd6cb7a resume=/908b1bf7-8d45-4b62-852c-69daffd6cb7a splash=silent  showopts vga=0x317


what about the device.map should that be changed at all?
0
 
rindiCommented:
Device.map should be OK.

Use this:

root (hd0,1)
    kernel /boot/vmlinuz-2.6.32.12-0.7-default root=UUID=908b1bf7-8d45-4b62-852c-69daffd6cb7a resume=/908b1bf7-8d45-4b62-852c-69daffd6cb7a splash=silent  showopts vga=0x317

0
 
atorexAuthor Commented:
root (hd0,1)
    kernel /boot/vmlinuz-2.6.32.12-0.7-default root=UUID=908b1bf7-8d45-4b62-852c-69daffd6cb7a resume=UUID=908b1bf7-8d45-4b62-852c-69daffd6cb7a splash=silent  showopts vga=0x317


the above gets me beyond the error I was getting no I get Only CONTROL-D will reboot
0
 
atorexAuthor Commented:
fstab is using the below
/dev/disk/by-id/ata-WDC_WD400BB-23JHC0_WD-WMAMA5669406-part2 /

should it be
 root=UUID=908b1bf7-8d45-4b62-852c-69daffd6cb7a /
0
 
rindiCommented:
Leave the root= out of fstab, just use UUID=908b1bf7-8d45-4b62-852c-69daffd6cb7a /
0
 
atorexAuthor Commented:
Man, you are the best, I noticed that root= should be out and I am in, thanks a bunch man this is awesome.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.